]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
adopted to the recently introduced Vector<Number>::operator= (const PETScWrappers...
authordenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Mar 2014 16:00:24 +0000 (16:00 +0000)
committerdenis.davydov <denis.davydov@0785d39b-7218-0410-832d-ea1e28bc413d>
Wed, 5 Mar 2014 16:00:24 +0000 (16:00 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_petscscalar_complex@32623 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/include/deal.II/lac/parallel_vector.templates.h

index 252c5b926cadb1abb53e3fe6ca823465e7783fa1..af145077fa7972c86542e70fda07d9db5d6802a2 100644 (file)
@@ -210,6 +210,33 @@ namespace parallel
 
 #ifdef DEAL_II_WITH_PETSC
 
+       namespace internal 
+       { 
+         template <typename PETSC_Number, typename Number> 
+         void copy_petsc_vector (const PETSC_Number *petsc_start_ptr, 
+                                                         const PETSC_Number *petsc_end_ptr, 
+                                                         Number *ptr) 
+         { 
+               std::copy(petsc_start_ptr, petsc_end_ptr, ptr); 
+         } 
+
+         template <typename PETSC_Number, typename Number> 
+         void copy_petsc_vector (const std::complex<PETSC_Number> *petsc_start_ptr, 
+                                                         const std::complex<PETSC_Number> *petsc_end_ptr, 
+                                                         std::complex<Number> *ptr) 
+         { 
+               std::copy(petsc_start_ptr, petsc_end_ptr, ptr); 
+         } 
+
+         template <typename PETSC_Number, typename Number> 
+         void copy_petsc_vector (const std::complex<PETSC_Number> *petsc_start_ptr, 
+                                                         const std::complex<PETSC_Number> *petsc_end_ptr, 
+                                                         Number *ptr) 
+         { 
+               AssertThrow(false, ExcMessage("Tried to copy complex -> real")); 
+         } 
+       } 
+
     template <typename Number>
     Vector<Number> &
     Vector<Number>::operator = (const PETScWrappers::MPI::Vector &petsc_vec)
@@ -223,7 +250,7 @@ namespace parallel
       AssertThrow (ierr == 0, ExcPETScError(ierr));
 
       const size_type vec_size = local_size();
-      std::copy (start_ptr, start_ptr + vec_size, begin());
+      internal::copy_petsc_vector (start_ptr, start_ptr + vec_size, begin());
 
       // restore the representation of the vector
       ierr = VecRestoreArray (static_cast<const Vec &>(petsc_vec), &start_ptr);
@@ -236,7 +263,7 @@ namespace parallel
       // return a pointer to this object per normal c++ operator overloading
       // semantics
       return *this;
-    }
+    }  
 
 #endif
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.