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

index d77b202357e2c3adc841ef6860dd5f1eff946259..53a621dccb105eca4044cca95742b75b42879fd7 100644 (file)
@@ -87,8 +87,12 @@ 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;
-          deallog << '[' << idx << ']' << ' ' << x(idx) << std::endl;
+#endif
+          deallog << '[' << idx << ']' << ' ' << PetscRealPart(x(idx)) << std::endl;
         }
 
 
@@ -124,7 +128,7 @@ void test()
     DoFTools::extract_locally_relevant_dofs (dh, locally_relevant_dofs);
 
     PETScWrappers::MPI::Vector solution (locally_owned_dofs, com_all);
-    solution = 0;
+    solution = PetscScalar();
 
     parallel::distributed::SolutionTransfer<dim, PETScWrappers::MPI::Vector> soltrans (dh);
     soltrans.deserialize (solution);
@@ -132,7 +136,7 @@ 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);
-        deallog << '[' << idx << ']' << ' ' << solution(idx) << std::endl;
+        deallog << '[' << idx << ']' << ' ' << PetscRealPart(solution(idx)) << std::endl;
       }
 
     deallog << "#cells = " << tr.n_global_active_cells() << std::endl;

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.