From 2ca9fd281d9969b907ff972ee45a3ce766fb8cce Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Fri, 30 Oct 2015 23:48:53 +0100 Subject: [PATCH] added extra Asserts to shared::Tria tests; do not output partition results --- tests/sharedtria/dof_01.cc | 25 +++++----- ...rue.with_64bit_indices=off.mpirun=3.output | 30 ----------- ...e.with_64bit_indices=off.mpirun=3.output.2 | 50 ------------------- ...true.with_64bit_indices=on.mpirun=3.output | 30 ----------- tests/sharedtria/dof_02.cc | 24 ++++----- ...rue.with_64bit_indices=off.mpirun=3.output | 30 ----------- ...true.with_64bit_indices=on.mpirun=3.output | 30 ----------- tests/sharedtria/dof_03.cc | 24 ++++----- ...rue.with_64bit_indices=off.mpirun=3.output | 30 ----------- tests/sharedtria/dof_04.cc | 24 ++++----- ...rue.with_64bit_indices=off.mpirun=3.output | 30 ----------- tests/sharedtria/tria_01.cc | 19 +++++-- ...rue.with_64bit_indices=off.mpirun=3.output | 12 ++--- ...e.with_64bit_indices=off.mpirun=3.output.2 | 41 --------------- ...true.with_64bit_indices=on.mpirun=3.output | 12 ++--- tests/sharedtria/tria_02.cc | 27 +++++++--- ...rue.with_64bit_indices=off.mpirun=3.output | 12 ++--- 17 files changed, 103 insertions(+), 347 deletions(-) delete mode 100644 tests/sharedtria/dof_01.with_metis=true.with_64bit_indices=off.mpirun=3.output.2 delete mode 100644 tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output.2 diff --git a/tests/sharedtria/dof_01.cc b/tests/sharedtria/dof_01.cc index 77a0c8078c..81968d92c6 100644 --- a/tests/sharedtria/dof_01.cc +++ b/tests/sharedtria/dof_01.cc @@ -92,19 +92,20 @@ void test() triangulation.execute_coarsening_and_refinement (); dof_handler.distribute_dofs (fe); + // avoid outputing any partitioning info until Parmetis gives reproducable results deallog - << "n_dofs: " << dof_handler.n_dofs() << std::endl - << "n_locally_owned_dofs: " << dof_handler.n_locally_owned_dofs() << std::endl; - - deallog << "n_locally_owned_dofs_per_processor: "; - std::vector v = dof_handler.n_locally_owned_dofs_per_processor(); - unsigned int sum = 0; - for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); +// unsigned int sum = 0; +// for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); - unsigned int sum = 0; - for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); +// unsigned int sum = 0; +// for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); - unsigned int sum = 0; - for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); +// unsigned int sum = 0; +// for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); - unsigned int sum = 0; - for (unsigned int i=0; i v = dof_handler.n_locally_owned_dofs_per_processor(); +// unsigned int sum = 0; +// for (unsigned int i=0; i tr(MPI_COMM_WORLD); + AssertThrow( tr.with_artificial_cells() == false, + ExcInternalError()); + + const std::vector & + true_subdomain_ids_of_cells = tr.get_true_subdomain_ids_of_cells(); + + AssertThrow (true_subdomain_ids_of_cells.size() == tr.n_active_cells(), + ExcInternalError()); + GridGenerator::hyper_cube(tr); tr.begin_active()->set_refine_flag(); @@ -81,11 +90,15 @@ void test() deallog << v[i] << " "; deallog << std::endl;*/ - deallog << "subdomains: "; + // untill parmetis is stable, do not output partitioning + //deallog << "subdomains: "; typename parallel::shared::Triangulation::active_cell_iterator it=tr.begin_active(); - for (; it!=tr.end(); ++it) + for (unsigned int index=0; it!=tr.end(); ++it,++index) { - deallog << it->subdomain_id() << " "; + // check that true subdomain_ids are the same as those, stored in cell->subdomain_id() + AssertThrow(true_subdomain_ids_of_cells[index] == it->subdomain_id(), + ExcInternalError()); + //deallog << it->subdomain_id() << " "; } deallog << std::endl; diff --git a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output b/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output index 4c4808a145..e470e96bf8 100644 --- a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output +++ b/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output @@ -4,26 +4,26 @@ DEAL:0:2d:: locally_owned_subdomain(): 0 n_levels: 3 n_global_levels: 3 -DEAL:0:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:0:2d:: DEAL:0:3d:: locally_owned_subdomain(): 0 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:0:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:0:3d:: DEAL:1:2d:: locally_owned_subdomain(): 1 n_active_cells: 7 n_levels: 3 n_global_levels: 3 -DEAL:1:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:1:2d:: DEAL:1:3d:: locally_owned_subdomain(): 1 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:1:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:1:3d:: DEAL:2:2d:: locally_owned_subdomain(): 2 @@ -31,11 +31,11 @@ DEAL:2:2d:: locally_owned_subdomain(): 2 n_levels: 3 n_global_levels: 3 -DEAL:2:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:2:2d:: DEAL:2:3d:: locally_owned_subdomain(): 2 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:2:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:2:3d:: diff --git a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output.2 b/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output.2 deleted file mode 100644 index c7b9a98fa0..0000000000 --- a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=off.mpirun=3.output.2 +++ /dev/null @@ -1,41 +0,0 @@ - -DEAL:0:2d:: locally_owned_subdomain(): 0 - n_active_cells: 7 - n_levels: 3 - n_global_levels: 3 - -DEAL:0:2d::subdomains: 2 1 2 0 0 1 1 -DEAL:0:3d:: locally_owned_subdomain(): 0 - n_active_cells: 15 - n_levels: 3 - n_global_levels: 3 - -DEAL:0:3d::subdomains: 2 0 0 1 0 0 0 2 2 2 2 1 1 1 1 - -DEAL:1:2d:: locally_owned_subdomain(): 1 - n_active_cells: 7 - n_levels: 3 - n_global_levels: 3 - -DEAL:1:2d::subdomains: 2 1 2 0 0 1 1 -DEAL:1:3d:: locally_owned_subdomain(): 1 - n_active_cells: 15 - n_levels: 3 - n_global_levels: 3 - -DEAL:1:3d::subdomains: 2 0 0 1 0 0 0 2 2 2 2 1 1 1 1 - - -DEAL:2:2d:: locally_owned_subdomain(): 2 - n_active_cells: 7 - n_levels: 3 - n_global_levels: 3 - -DEAL:2:2d::subdomains: 2 1 2 0 0 1 1 -DEAL:2:3d:: locally_owned_subdomain(): 2 - n_active_cells: 15 - n_levels: 3 - n_global_levels: 3 - -DEAL:2:3d::subdomains: 2 0 0 1 0 0 0 2 2 2 2 1 1 1 1 - diff --git a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=on.mpirun=3.output b/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=on.mpirun=3.output index 4c4808a145..e470e96bf8 100644 --- a/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=on.mpirun=3.output +++ b/tests/sharedtria/tria_01.with_metis=true.with_64bit_indices=on.mpirun=3.output @@ -4,26 +4,26 @@ DEAL:0:2d:: locally_owned_subdomain(): 0 n_levels: 3 n_global_levels: 3 -DEAL:0:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:0:2d:: DEAL:0:3d:: locally_owned_subdomain(): 0 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:0:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:0:3d:: DEAL:1:2d:: locally_owned_subdomain(): 1 n_active_cells: 7 n_levels: 3 n_global_levels: 3 -DEAL:1:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:1:2d:: DEAL:1:3d:: locally_owned_subdomain(): 1 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:1:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:1:3d:: DEAL:2:2d:: locally_owned_subdomain(): 2 @@ -31,11 +31,11 @@ DEAL:2:2d:: locally_owned_subdomain(): 2 n_levels: 3 n_global_levels: 3 -DEAL:2:2d::subdomains: 0 1 0 2 2 1 1 +DEAL:2:2d:: DEAL:2:3d:: locally_owned_subdomain(): 2 n_active_cells: 15 n_levels: 3 n_global_levels: 3 -DEAL:2:3d::subdomains: 0 1 0 2 0 0 0 2 2 1 1 2 2 1 1 +DEAL:2:3d:: diff --git a/tests/sharedtria/tria_02.cc b/tests/sharedtria/tria_02.cc index 16352122c3..ae8be13332 100644 --- a/tests/sharedtria/tria_02.cc +++ b/tests/sharedtria/tria_02.cc @@ -63,6 +63,14 @@ void test() Triangulation::none, /*artificial*/true); + AssertThrow( tr.with_artificial_cells() == true, + ExcInternalError()); + + const std::vector & + true_subdomain_ids_of_cells = tr.get_true_subdomain_ids_of_cells(); + + AssertThrow (true_subdomain_ids_of_cells.size() == tr.n_active_cells(), + ExcInternalError()); GridGenerator::hyper_cube(tr); tr.refine_global(); @@ -86,18 +94,23 @@ void test() deallog << v[i] << " "; deallog << std::endl;*/ - deallog << "subdomains: "; + // untill parmetis is stable, do not output partitioning + //deallog << "subdomains: "; typename parallel::shared::Triangulation::active_cell_iterator it=tr.begin_active(); - for (; it!=tr.end(); ++it) + for (unsigned int index=0; it!=tr.end(); ++it,++index) { - deallog << (int) it->subdomain_id() << " "; + // check that true subdomain_ids are the same as those, stored in cell->subdomain_id() + AssertThrow( (it->is_artificial() == true) || + (true_subdomain_ids_of_cells[index] == it->subdomain_id()), + ExcInternalError()); + //deallog << (int) it->subdomain_id() << " "; } deallog << std::endl; - const std::string filename = ("mesh_" + - Utilities::int_to_string(dim)+ - "D_"); - write_mesh(tr, filename.c_str()); +// const std::string filename = ("mesh_" + +// Utilities::int_to_string(dim)+ +// "D_"); +// write_mesh(tr, filename.c_str()); } diff --git a/tests/sharedtria/tria_02.with_metis=true.with_64bit_indices=off.mpirun=3.output b/tests/sharedtria/tria_02.with_metis=true.with_64bit_indices=off.mpirun=3.output index 027bf51dc5..0e97c55ec5 100644 --- a/tests/sharedtria/tria_02.with_metis=true.with_64bit_indices=off.mpirun=3.output +++ b/tests/sharedtria/tria_02.with_metis=true.with_64bit_indices=off.mpirun=3.output @@ -4,26 +4,26 @@ DEAL:0:2d:: locally_owned_subdomain(): 0 n_levels: 3 n_global_levels: 3 -DEAL:0:2d::subdomains: 1 1 0 0 0 0 2 -2 1 -2 +DEAL:0:2d:: DEAL:0:3d:: locally_owned_subdomain(): 0 n_active_cells: 22 n_levels: 3 n_global_levels: 3 -DEAL:0:3d::subdomains: 2 0 2 0 2 0 -2 1 -2 2 -2 1 -2 2 1 1 1 0 1 0 0 0 +DEAL:0:3d:: DEAL:1:2d:: locally_owned_subdomain(): 1 n_active_cells: 10 n_levels: 3 n_global_levels: 3 -DEAL:1:2d::subdomains: 1 1 -2 0 0 0 2 2 1 2 +DEAL:1:2d:: DEAL:1:3d:: locally_owned_subdomain(): 1 n_active_cells: 22 n_levels: 3 n_global_levels: 3 -DEAL:1:3d::subdomains: 2 0 2 0 -2 -2 1 1 2 2 2 1 2 2 1 1 1 0 1 0 0 0 +DEAL:1:3d:: DEAL:2:2d:: locally_owned_subdomain(): 2 @@ -31,11 +31,11 @@ DEAL:2:2d:: locally_owned_subdomain(): 2 n_levels: 3 n_global_levels: 3 -DEAL:2:2d::subdomains: -2 1 -2 0 -2 0 2 2 1 2 +DEAL:2:2d:: DEAL:2:3d:: locally_owned_subdomain(): 2 n_active_cells: 22 n_levels: 3 n_global_levels: 3 -DEAL:2:3d::subdomains: 2 0 2 0 2 0 1 1 2 2 2 1 2 2 1 -2 1 -2 1 -2 0 -2 +DEAL:2:3d:: -- 2.39.5