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

index 05770bbca1a1180e7b9ae538760d186727a68f41..fe4725e53f6e01b21c35b307a48940d040af3564 100644 (file)
@@ -86,7 +86,11 @@ void test()
     for (unsigned int i=0; i<locally_owned_dofs.n_elements(); ++i)
       {
         unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
+#ifdef PETSC_USE_COMPLEX
+        x(idx)=std::complex<double>(idx,0);
+#else
         x(idx)=idx;
+#endif
 
 //  std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
       }
@@ -127,14 +131,18 @@ void test()
 
     PETScWrappers::MPI::Vector solution(locally_owned_dofs, MPI_COMM_WORLD);
     parallel::distributed::SolutionTransfer<dim,PETScWrappers::MPI::Vector> soltrans(dh);
+#if PETSC_USE_COMPLEX
+    solution = std::complex<double>(2,0);
+#else
     solution = 2;
+#endif
     soltrans.deserialize(solution);
 
     for (unsigned int i=0; i<locally_owned_dofs.n_elements(); ++i)
       {
         unsigned int idx = locally_owned_dofs.nth_index_in_set(i);
         //std::cout << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
-        Assert(idx == solution(idx),ExcInternalError());
+        Assert(idx == PetscRealPart(solution(idx)),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.