From: Timo Heister Date: Sun, 4 Oct 2015 19:40:40 +0000 (-0400) Subject: cleanup and fix tests X-Git-Tag: v8.4.0-rc2~277^2~22 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=391f53c844147f5d631ae59c71a65e73800cd6f1;p=dealii.git cleanup and fix tests --- diff --git a/tests/multigrid/constrained_dofs_01.cc b/tests/multigrid/constrained_dofs_01.cc index 59c2ab358f..0fdbe3b8c7 100644 --- a/tests/multigrid/constrained_dofs_01.cc +++ b/tests/multigrid/constrained_dofs_01.cc @@ -42,13 +42,6 @@ using namespace std; -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void setup_tria(parallel::distributed::Triangulation &tr) { @@ -58,7 +51,7 @@ void setup_tria(parallel::distributed::Triangulation &tr) for (typename parallel::distributed::Triangulation::active_cell_iterator cell = tr.begin_active(); cell != tr.end(); ++cell) { - if (id_to_string(cell->id()) == "0_2:11") + if (cell->id().to_string() == "0_2:11") cell->set_refine_flag(); } tr.execute_coarsening_and_refinement(); @@ -103,7 +96,7 @@ void check_fe(FiniteElement &fe) if (!cell->is_locally_owned_on_level()) continue; - std::vector &d = mgdofmap[id_to_string(cell->id())]; + std::vector &d = mgdofmap[cell->id().to_string()]; d.resize(fe.dofs_per_cell); cell->get_mg_dof_indices(d); } @@ -114,7 +107,7 @@ void check_fe(FiniteElement &fe) if (cell->level_subdomain_id()==numbers::artificial_subdomain_id) continue; - std::vector &renumbered = mgdofmap[id_to_string(cell->id())]; + std::vector &renumbered = mgdofmap[cell->id().to_string()]; cell->set_mg_dof_indices(renumbered); cell->update_cell_dof_indices_cache(); } diff --git a/tests/multigrid/transfer_04.cc b/tests/multigrid/transfer_04.cc index 7912c169e5..cdfd22b820 100644 --- a/tests/multigrid/transfer_04.cc +++ b/tests/multigrid/transfer_04.cc @@ -14,10 +14,7 @@ // --------------------------------------------------------------------- -// check mg transfer in parallel - -// This is currently broken, because we are not correctly communicating -// MGTransfer::copy_indices +// check mg transfer in parallel, especially communication of copy_indices #include "../tests.h" #include @@ -48,13 +45,6 @@ using namespace std; -std::string id_to_string(const CellId &id) -{ - std::ostringstream ss; - ss << id; - return ss.str(); -} - template void setup_tria(parallel::distributed::Triangulation &tr) { @@ -64,18 +54,18 @@ void setup_tria(parallel::distributed::Triangulation &tr) for (typename parallel::distributed::Triangulation::active_cell_iterator cell = tr.begin_active(); cell != tr.end(); ++cell) { - if (id_to_string(cell->id()) == "0_2:03" - || id_to_string(cell->id()) == "0_2:00" - || id_to_string(cell->id()) == "0_2:01" - || id_to_string(cell->id()) == "0_2:12") + if (cell->id().to_string() == "0_2:03" + || cell->id().to_string() == "0_2:00" + || cell->id().to_string() == "0_2:01" + || cell->id().to_string() == "0_2:12") cell->set_refine_flag(); } tr.execute_coarsening_and_refinement(); for (typename parallel::distributed::Triangulation::active_cell_iterator cell = tr.begin_active(); cell != tr.end(); ++cell) { - if (id_to_string(cell->id()) == "0_3:032" - || id_to_string(cell->id()) == "0_3:000") + if (cell->id().to_string() == "0_3:032" + || cell->id().to_string() == "0_3:000") cell->set_refine_flag(); } tr.execute_coarsening_and_refinement(); diff --git a/tests/multigrid/transfer_04.mpirun=1.output b/tests/multigrid/transfer_04.mpirun=1.output new file mode 100644 index 0000000000..9127b0b5de --- /dev/null +++ b/tests/multigrid/transfer_04.mpirun=1.output @@ -0,0 +1,60 @@ + +DEAL:0::FE_Q<2>(1) +DEAL:0::cell=0_0: level_subdomain_id=0 +DEAL:0::cell=0_1:0 level_subdomain_id=0 +DEAL:0::cell=0_1:1 level_subdomain_id=0 +DEAL:0::cell=0_1:2 level_subdomain_id=0 +DEAL:0::cell=0_1:3 level_subdomain_id=0 +DEAL:0::cell=0_2:00 level_subdomain_id=0 +DEAL:0::cell=0_2:01 level_subdomain_id=0 +DEAL:0::cell=0_2:02 level_subdomain_id=0 +DEAL:0::cell=0_2:03 level_subdomain_id=0 +DEAL:0::cell=0_2:10 level_subdomain_id=0 +DEAL:0::cell=0_2:11 level_subdomain_id=0 +DEAL:0::cell=0_2:12 level_subdomain_id=0 +DEAL:0::cell=0_2:13 level_subdomain_id=0 +DEAL:0::cell=0_2:20 level_subdomain_id=0 +DEAL:0::cell=0_2:21 level_subdomain_id=0 +DEAL:0::cell=0_2:22 level_subdomain_id=0 +DEAL:0::cell=0_2:23 level_subdomain_id=0 +DEAL:0::cell=0_2:30 level_subdomain_id=0 +DEAL:0::cell=0_2:31 level_subdomain_id=0 +DEAL:0::cell=0_2:32 level_subdomain_id=0 +DEAL:0::cell=0_2:33 level_subdomain_id=0 +DEAL:0::cell=0_3:000 level_subdomain_id=0 +DEAL:0::cell=0_3:001 level_subdomain_id=0 +DEAL:0::cell=0_3:002 level_subdomain_id=0 +DEAL:0::cell=0_3:003 level_subdomain_id=0 +DEAL:0::cell=0_3:010 level_subdomain_id=0 +DEAL:0::cell=0_3:011 level_subdomain_id=0 +DEAL:0::cell=0_3:012 level_subdomain_id=0 +DEAL:0::cell=0_3:013 level_subdomain_id=0 +DEAL:0::cell=0_3:030 level_subdomain_id=0 +DEAL:0::cell=0_3:031 level_subdomain_id=0 +DEAL:0::cell=0_3:032 level_subdomain_id=0 +DEAL:0::cell=0_3:033 level_subdomain_id=0 +DEAL:0::cell=0_3:120 level_subdomain_id=0 +DEAL:0::cell=0_3:121 level_subdomain_id=0 +DEAL:0::cell=0_3:122 level_subdomain_id=0 +DEAL:0::cell=0_3:123 level_subdomain_id=0 +DEAL:0::cell=0_3:020 level_subdomain_id=0 +DEAL:0::cell=0_3:021 level_subdomain_id=0 +DEAL:0::cell=0_3:022 level_subdomain_id=0 +DEAL:0::cell=0_3:023 level_subdomain_id=0 +DEAL:0::cell=0_3:200 level_subdomain_id=0 +DEAL:0::cell=0_3:201 level_subdomain_id=0 +DEAL:0::cell=0_3:202 level_subdomain_id=0 +DEAL:0::cell=0_3:203 level_subdomain_id=0 +DEAL:0::cell=0_3:210 level_subdomain_id=0 +DEAL:0::cell=0_3:211 level_subdomain_id=0 +DEAL:0::cell=0_3:212 level_subdomain_id=0 +DEAL:0::cell=0_3:213 level_subdomain_id=0 +DEAL:0::cell=0_4:0000 level_subdomain_id=0 +DEAL:0::cell=0_4:0001 level_subdomain_id=0 +DEAL:0::cell=0_4:0002 level_subdomain_id=0 +DEAL:0::cell=0_4:0003 level_subdomain_id=0 +DEAL:0::cell=0_4:0320 level_subdomain_id=0 +DEAL:0::cell=0_4:0321 level_subdomain_id=0 +DEAL:0::cell=0_4:0322 level_subdomain_id=0 +DEAL:0::cell=0_4:0323 level_subdomain_id=0 +DEAL:0::ok diff --git a/tests/multigrid/transfer_04a.cc b/tests/multigrid/transfer_04a.cc new file mode 100644 index 0000000000..5e5fa2676f --- /dev/null +++ b/tests/multigrid/transfer_04a.cc @@ -0,0 +1,186 @@ +// --------------------------------------------------------------------- +// +// Copyright (C) 2006 - 2015 by the deal.II authors +// +// This file is part of the deal.II library. +// +// The deal.II library is free software; you can use it, redistribute +// it, and/or modify it under the terms of the GNU Lesser General +// Public License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// The full text of the license can be found in the file LICENSE at +// the top level of the deal.II distribution. +// +// --------------------------------------------------------------------- + + +// check mg transfer in parallel + +#include "../tests.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +using namespace std; + +template +void setup_tria(parallel::distributed::Triangulation &tr) +{ + GridGenerator::hyper_cube(tr); + tr.refine_global(1); + + for (typename parallel::distributed::Triangulation::active_cell_iterator cell = tr.begin_active(); + cell != tr.end(); ++cell) + { + if (cell->id().to_string() != "0_1:3") + cell->set_refine_flag(); + } + tr.execute_coarsening_and_refinement(); + + for (typename parallel::distributed::Triangulation::active_cell_iterator cell = tr.begin_active(); + cell != tr.end(); ++cell) + { + if (cell->id().to_string() == "0_2:00" + || cell->id().to_string() == "0_2:01" + || cell->id().to_string() == "0_2:02") + cell->set_refine_flag(); + } + tr.execute_coarsening_and_refinement(); + + + for (typename parallel::distributed::Triangulation::cell_iterator cell = tr.begin(); + cell != tr.end(); ++cell) + { + deallog << "cell=" << cell->id() + << " level_subdomain_id=" << cell->level_subdomain_id() + << std::endl; + } +} + + + + + + + + + +template +void check_fe(FiniteElement &fe) +{ + deallog << fe.get_name() << std::endl; + + parallel::distributed::Triangulation tr(MPI_COMM_WORLD, + Triangulation::none, + parallel::distributed::Triangulation::construct_multigrid_hierarchy); + setup_tria(tr); + + if (false) + { + DataOut data_out; + Vector subdomain (tr.n_active_cells()); + for (unsigned int i=0; i zero; + typename FunctionMap::type fmap; + fmap.insert(std::make_pair(0, &zero)); + + DoFHandler dofh(tr); + dofh.distribute_dofs(fe); + dofh.distribute_mg_dofs(fe); + typedef TrilinosWrappers::MPI::Vector vector_t; + { + + + + } + MGTransferPrebuilt transfer; + transfer.build_matrices(dofh); + transfer.print_indices(deallog.get_file_stream()); + + MGLevelObject u(0, tr.n_global_levels()-1); + for (unsigned int level=u.min_level(); level<=u.max_level(); ++level) + { + u[level].reinit(dofh.locally_owned_mg_dofs(level), MPI_COMM_WORLD); + for (unsigned int i=0; i +void check() +{ + FE_Q q1(1); + FE_Q q2(2); +// FE_DGQ dq1(1); + + FESystem s1(q1, 2, q2,1); + + check_fe(q1); + // check_fe(q2); + //check_fe(s1); +} + +int main(int argc, char *argv[]) +{ + Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv, 1); + MPILogInitAll log; + + check<2> (); + //check<3> (); +} diff --git a/tests/multigrid/transfer_04a.mpirun=1.debug.output b/tests/multigrid/transfer_04a.mpirun=1.debug.output new file mode 100644 index 0000000000..86ad6eb4a4 --- /dev/null +++ b/tests/multigrid/transfer_04a.mpirun=1.debug.output @@ -0,0 +1,75 @@ + +DEAL:0::FE_Q<2>(1) +DEAL:0::cell=0_0: level_subdomain_id=0 +DEAL:0::cell=0_1:0 level_subdomain_id=0 +DEAL:0::cell=0_1:1 level_subdomain_id=0 +DEAL:0::cell=0_1:2 level_subdomain_id=0 +DEAL:0::cell=0_1:3 level_subdomain_id=0 +DEAL:0::cell=0_2:00 level_subdomain_id=0 +DEAL:0::cell=0_2:01 level_subdomain_id=0 +DEAL:0::cell=0_2:02 level_subdomain_id=0 +DEAL:0::cell=0_2:03 level_subdomain_id=0 +DEAL:0::cell=0_2:10 level_subdomain_id=0 +DEAL:0::cell=0_2:11 level_subdomain_id=0 +DEAL:0::cell=0_2:12 level_subdomain_id=0 +DEAL:0::cell=0_2:13 level_subdomain_id=0 +DEAL:0::cell=0_2:20 level_subdomain_id=0 +DEAL:0::cell=0_2:21 level_subdomain_id=0 +DEAL:0::cell=0_2:22 level_subdomain_id=0 +DEAL:0::cell=0_2:23 level_subdomain_id=0 +DEAL:0::cell=0_3:000 level_subdomain_id=0 +DEAL:0::cell=0_3:001 level_subdomain_id=0 +DEAL:0::cell=0_3:002 level_subdomain_id=0 +DEAL:0::cell=0_3:003 level_subdomain_id=0 +DEAL:0::cell=0_3:010 level_subdomain_id=0 +DEAL:0::cell=0_3:011 level_subdomain_id=0 +DEAL:0::cell=0_3:012 level_subdomain_id=0 +DEAL:0::cell=0_3:013 level_subdomain_id=0 +DEAL:0::cell=0_3:020 level_subdomain_id=0 +DEAL:0::cell=0_3:021 level_subdomain_id=0 +DEAL:0::cell=0_3:022 level_subdomain_id=0 +DEAL:0::cell=0_3:023 level_subdomain_id=0 +copy_indices[1] 0 3 +copy_indices[1] 1 5 +copy_indices[1] 2 7 +copy_indices[1] 3 8 +copy_indices[2] 0 8 +copy_indices[2] 1 14 +copy_indices[2] 2 20 +copy_indices[2] 4 3 +copy_indices[2] 5 5 +copy_indices[2] 6 7 +copy_indices[2] 7 4 +copy_indices[2] 8 9 +copy_indices[2] 9 10 +copy_indices[2] 10 11 +copy_indices[2] 11 12 +copy_indices[2] 12 13 +copy_indices[2] 13 6 +copy_indices[2] 14 15 +copy_indices[2] 15 16 +copy_indices[2] 16 17 +copy_indices[2] 17 18 +copy_indices[2] 18 19 +copy_indices[3] 4 8 +copy_indices[3] 5 14 +copy_indices[3] 6 20 +copy_indices[3] 7 11 +copy_indices[3] 13 18 +copy_indices[3] 19 0 +copy_indices[3] 20 1 +copy_indices[3] 21 2 +copy_indices[3] 22 3 +copy_indices[3] 23 4 +copy_indices[3] 24 5 +copy_indices[3] 25 6 +copy_indices[3] 26 7 +copy_indices[3] 27 9 +copy_indices[3] 28 10 +copy_indices[3] 29 12 +copy_indices[3] 30 13 +copy_indices[3] 31 15 +copy_indices[3] 32 16 +copy_indices[3] 33 17 +copy_indices[3] 34 19 +DEAL:0::1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 ok diff --git a/tests/multigrid/transfer_04a.mpirun=2.debug.output b/tests/multigrid/transfer_04a.mpirun=2.debug.output new file mode 100644 index 0000000000..a60ed7643f --- /dev/null +++ b/tests/multigrid/transfer_04a.mpirun=2.debug.output @@ -0,0 +1,109 @@ + +DEAL:0::FE_Q<2>(1) +DEAL:0::cell=0_0: level_subdomain_id=0 +DEAL:0::cell=0_1:0 level_subdomain_id=0 +DEAL:0::cell=0_1:1 level_subdomain_id=1 +DEAL:0::cell=0_1:2 level_subdomain_id=1 +DEAL:0::cell=0_1:3 level_subdomain_id=1 +DEAL:0::cell=0_2:00 level_subdomain_id=0 +DEAL:0::cell=0_2:01 level_subdomain_id=0 +DEAL:0::cell=0_2:02 level_subdomain_id=0 +DEAL:0::cell=0_2:03 level_subdomain_id=1 +DEAL:0::cell=0_2:10 level_subdomain_id=1 +DEAL:0::cell=0_2:11 level_subdomain_id=4294967294 +DEAL:0::cell=0_2:12 level_subdomain_id=1 +DEAL:0::cell=0_2:13 level_subdomain_id=4294967294 +DEAL:0::cell=0_2:20 level_subdomain_id=1 +DEAL:0::cell=0_2:21 level_subdomain_id=1 +DEAL:0::cell=0_2:22 level_subdomain_id=4294967294 +DEAL:0::cell=0_2:23 level_subdomain_id=4294967294 +DEAL:0::cell=0_3:000 level_subdomain_id=0 +DEAL:0::cell=0_3:001 level_subdomain_id=0 +DEAL:0::cell=0_3:002 level_subdomain_id=0 +DEAL:0::cell=0_3:003 level_subdomain_id=0 +DEAL:0::cell=0_3:010 level_subdomain_id=0 +DEAL:0::cell=0_3:011 level_subdomain_id=0 +DEAL:0::cell=0_3:012 level_subdomain_id=0 +DEAL:0::cell=0_3:013 level_subdomain_id=0 +DEAL:0::cell=0_3:020 level_subdomain_id=0 +DEAL:0::cell=0_3:021 level_subdomain_id=0 +DEAL:0::cell=0_3:022 level_subdomain_id=0 +DEAL:0::cell=0_3:023 level_subdomain_id=0 +copy_indices[2] 8 3 +copy_indices[2] 11 4 +copy_indices[2] 14 5 +copy_indices[2] 18 6 +copy_indices[2] 20 7 +copy_indices[3] 0 0 +copy_indices[3] 1 1 +copy_indices[3] 2 2 +copy_indices[3] 3 3 +copy_indices[3] 4 4 +copy_indices[3] 5 5 +copy_indices[3] 6 6 +copy_indices[3] 7 7 +copy_indices[3] 8 8 +copy_indices[3] 9 9 +copy_indices[3] 10 10 +copy_indices[3] 11 11 +copy_indices[3] 12 12 +copy_indices[3] 13 13 +copy_indices[3] 14 14 +copy_indices[3] 15 15 +copy_indices[3] 16 16 +copy_indices[3] 17 17 +copy_indices[3] 18 18 +copy_indices[3] 19 19 +copy_indices[3] 20 20 +copy_ifrom [1] 21 3 +DEAL:0::1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 ok + +DEAL:1::FE_Q<2>(1) +DEAL:1::cell=0_0: level_subdomain_id=0 +DEAL:1::cell=0_1:0 level_subdomain_id=0 +DEAL:1::cell=0_1:1 level_subdomain_id=1 +DEAL:1::cell=0_1:2 level_subdomain_id=1 +DEAL:1::cell=0_1:3 level_subdomain_id=1 +DEAL:1::cell=0_2:00 level_subdomain_id=0 +DEAL:1::cell=0_2:01 level_subdomain_id=0 +DEAL:1::cell=0_2:02 level_subdomain_id=0 +DEAL:1::cell=0_2:03 level_subdomain_id=1 +DEAL:1::cell=0_2:10 level_subdomain_id=1 +DEAL:1::cell=0_2:11 level_subdomain_id=1 +DEAL:1::cell=0_2:12 level_subdomain_id=1 +DEAL:1::cell=0_2:13 level_subdomain_id=1 +DEAL:1::cell=0_2:20 level_subdomain_id=1 +DEAL:1::cell=0_2:21 level_subdomain_id=1 +DEAL:1::cell=0_2:22 level_subdomain_id=1 +DEAL:1::cell=0_2:23 level_subdomain_id=1 +DEAL:1::cell=0_3:000 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:001 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:002 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:003 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:010 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:011 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:012 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:013 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:020 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:021 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:022 level_subdomain_id=4294967294 +DEAL:1::cell=0_3:023 level_subdomain_id=4294967294 +copy_indices[1] 22 5 +copy_indices[1] 23 7 +copy_indices[1] 24 8 +copy_indices[2] 21 8 +copy_indices[2] 22 14 +copy_indices[2] 23 20 +copy_indices[2] 25 9 +copy_indices[2] 26 10 +copy_indices[2] 27 11 +copy_indices[2] 28 12 +copy_indices[2] 29 13 +copy_indices[2] 30 15 +copy_indices[2] 31 16 +copy_indices[2] 32 17 +copy_indices[2] 33 18 +copy_indices[2] 34 19 +copy_ito [1] 21 3 +DEAL:1::1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000 ok +