]> https://gitweb.dealii.org/ - dealii.git/commitdiff
extend tests/mpi/petsc_distribute_01.cc to complex-valued PETSc
authorDenis Davydov <davydden@gmail.com>
Mon, 28 Mar 2016 20:30:24 +0000 (22:30 +0200)
committerDenis Davydov <davydden@gmail.com>
Tue, 29 Mar 2016 18:48:46 +0000 (20:48 +0200)
tests/mpi/petsc_distribute_01.cc

index 5ecc909337f1471ae4501eef4a7a1fddba289b18..38c0120a16564c8f6205d1544d852c2c4f16569c 100644 (file)
@@ -99,11 +99,11 @@ void test()
 
   // verify correctness
   if (myid != 0)
-    AssertThrow (vec(vec.local_range().first+10) == vec.local_range().first-25,
+    AssertThrow (PetscRealPart(vec(vec.local_range().first+10)) == vec.local_range().first-25,
                  ExcInternalError());
 
   if (myid != n_processes-1)
-    AssertThrow (vec(vec.local_range().first+90) == vec.local_range().first+105,
+    AssertThrow (PetscRealPart(vec(vec.local_range().first+90)) == vec.local_range().first+105,
                  ExcInternalError());
 
   for (unsigned int i=vec.local_range().first; i<vec.local_range().second; ++i)
@@ -112,8 +112,9 @@ void test()
           &&
           (i != vec.local_range().first+90))
         {
-          double val = vec(i);
-          AssertThrow (std::fabs(val - i) <= 1e-6, ExcInternalError());
+          PetscScalar val = vec(i);
+          AssertThrow (std::fabs(PetscRealPart(val) - i) <= 1e-6, ExcInternalError());
+          AssertThrow (std::fabs(PetscImaginaryPart(val)) <= 1e-6, ExcInternalError());
         }
     }
 

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.