]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fix CellDataTransfer tests for complex Petsc complex scalar type 8404/head
authorDaniel Arndt <arndtd@ornl.gov>
Mon, 22 Jul 2019 22:06:38 +0000 (18:06 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Mon, 22 Jul 2019 22:06:38 +0000 (18:06 -0400)
tests/sharedtria/cell_data_transfer_01.cc
tests/sharedtria/cell_data_transfer_02.cc

index caf10a8549e5e8bdc7ebf30e1e053062717aa330..bd973d32d31e6880f991cb254050949c46c20c63 100644 (file)
@@ -61,7 +61,7 @@ test()
 
   // ----- gather -----
   // store parent id of all locally owned cells
-  Vector<unsigned int> cell_ids_pre(tria.n_active_cells());
+  Vector<PetscScalar> cell_ids_pre(tria.n_active_cells());
   for (const auto &cell : tria.active_cell_iterators())
     if (cell->is_locally_owned())
       {
@@ -88,8 +88,8 @@ test()
   // output initial situation
   for (const auto &cell : tria.active_cell_iterators())
     {
-      deallog << "cellid=" << cell->id()
-              << " parentid=" << cell_ids_pre(cell->active_cell_index());
+      deallog << "cellid=" << cell->id() << " parentid="
+              << std::real(cell_ids_pre(cell->active_cell_index()));
       if (cell->coarsen_flag_set())
         deallog << " coarsening";
       else if (cell->refine_flag_set())
@@ -98,22 +98,20 @@ test()
     }
 
   // ----- transfer -----
-  CellDataTransfer<dim, spacedim, Vector<unsigned int>> cell_data_transfer(
-    tria);
+  CellDataTransfer<dim, spacedim, Vector<PetscScalar>> cell_data_transfer(tria);
 
   cell_data_transfer.prepare_for_coarsening_and_refinement();
   tria.execute_coarsening_and_refinement();
   deallog << "cells after: " << tria.n_global_active_cells() << std::endl;
 
-  Vector<unsigned int> cell_ids_post(tria.n_active_cells());
+  Vector<PetscScalar> cell_ids_post(tria.n_active_cells());
   cell_data_transfer.unpack(cell_ids_pre, cell_ids_post);
 
   // ------ verify ------
   // check if all children adopted the correct id
   for (auto &cell : tria.active_cell_iterators())
-    deallog << "cellid=" << cell->id()
-            << " parentid=" << cell_ids_post(cell->active_cell_index())
-            << std::endl;
+    deallog << "cellid=" << cell->id() << " parentid="
+            << std::real(cell_ids_post(cell->active_cell_index())) << std::endl;
 
   deallog << "OK" << std::endl;
 }
index e49db83365b454ea6df5567a09ee31d8ea350a7a..e777475a4f7d1ef94086449b1894656f32426958 100644 (file)
@@ -61,7 +61,7 @@ test()
 
   // ----- gather -----
   // store parent id of all locally owned cells
-  Vector<unsigned int> cell_ids_pre(tria.n_active_cells());
+  Vector<PetscScalar> cell_ids_pre(tria.n_active_cells());
   for (const auto &cell : tria.active_cell_iterators())
     if (cell->is_locally_owned())
       {
@@ -88,8 +88,8 @@ test()
   // output initial situation
   for (const auto &cell : tria.active_cell_iterators())
     {
-      deallog << "cellid=" << cell->id()
-              << " parentid=" << cell_ids_pre(cell->active_cell_index());
+      deallog << "cellid=" << cell->id() << " parentid="
+              << std::real(cell_ids_pre(cell->active_cell_index()));
       if (cell->coarsen_flag_set())
         deallog << " coarsening";
       else if (cell->refine_flag_set())
@@ -98,22 +98,20 @@ test()
     }
 
   // ----- transfer -----
-  CellDataTransfer<dim, spacedim, Vector<unsigned int>> cell_data_transfer(
-    tria);
+  CellDataTransfer<dim, spacedim, Vector<PetscScalar>> cell_data_transfer(tria);
 
   cell_data_transfer.prepare_for_coarsening_and_refinement();
   tria.execute_coarsening_and_refinement();
   deallog << "cells after: " << tria.n_global_active_cells() << std::endl;
 
-  Vector<unsigned int> cell_ids_post(tria.n_active_cells());
+  Vector<PetscScalar> cell_ids_post(tria.n_active_cells());
   cell_data_transfer.unpack(cell_ids_pre, cell_ids_post);
 
   // ------ verify ------
   // check if all children adopted the correct id
   for (auto &cell : tria.active_cell_iterators())
-    deallog << "cellid=" << cell->id()
-            << " parentid=" << cell_ids_post(cell->active_cell_index())
-            << std::endl;
+    deallog << "cellid=" << cell->id() << " parentid="
+            << std::real(cell_ids_post(cell->active_cell_index())) << std::endl;
 
   deallog << "OK" << 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.