From fd082fdaccc99c8bfbae5f844ca01bb7e0ef6df7 Mon Sep 17 00:00:00 2001 From: Daniel Arndt Date: Wed, 23 Jan 2019 21:10:16 +0100 Subject: [PATCH] Ensure mpi/periodicity_06 has consistent output --- tests/mpi/periodicity_06.cc | 60 ++- tests/mpi/periodicity_06.mpirun=2.output | 451 ++++++++++++----------- tests/mpi/periodicity_07.cc | 20 +- 3 files changed, 263 insertions(+), 268 deletions(-) diff --git a/tests/mpi/periodicity_06.cc b/tests/mpi/periodicity_06.cc index b5f2e0bb1f..21d1e136bb 100644 --- a/tests/mpi/periodicity_06.cc +++ b/tests/mpi/periodicity_06.cc @@ -141,17 +141,17 @@ test(const unsigned numRefinementLevels = 2) } if (this_mpi_process == 0) - std::cout << "number of elements: " << triangulation.n_global_active_cells() - << std::endl; + deallog << "number of elements: " << triangulation.n_global_active_cells() + << '\n'; - // create dofHandler + // create dof_handler FESystem FE(FE_Q(QGaussLobatto<1>(2)), 1); - DoFHandler dofHandler(triangulation); - dofHandler.distribute_dofs(FE); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(FE); // write mesh for visualization DataOut data_out; - data_out.attach_dof_handler(dofHandler); + data_out.attach_dof_handler(dof_handler); Vector subdomain(triangulation.n_active_cells()); for (unsigned int i = 0; i < subdomain.size(); ++i) subdomain(i) = triangulation.locally_owned_subdomain(); @@ -161,23 +161,23 @@ test(const unsigned numRefinementLevels = 2) mpi_communicator); IndexSet locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs(dofHandler, locally_relevant_dofs); + DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs); std::map> supportPoints; DoFTools::map_dofs_to_support_points(MappingQ1(), - dofHandler, + dof_handler, supportPoints); /// creating combined hanging node and periodic constraint matrix AffineConstraints constraints; constraints.clear(); constraints.reinit(locally_relevant_dofs); - DoFTools::make_hanging_node_constraints(dofHandler, constraints); + DoFTools::make_hanging_node_constraints(dof_handler, constraints); std::vector< GridTools::PeriodicFacePair::cell_iterator>> periodicity_vectorDof; for (int d = 0; d < dim; ++d) - GridTools::collect_periodic_faces(dofHandler, + GridTools::collect_periodic_faces(dof_handler, /*b_id1*/ 2 * d + 1, /*b_id2*/ 2 * d + 2, /*direction*/ d, @@ -187,30 +187,21 @@ test(const unsigned numRefinementLevels = 2) constraints); constraints.close(); - for (unsigned int i = 0; i < n_mpi_processes; ++i) + deallog << "=== Process " << this_mpi_process << std::endl + << "Constraints:" << std::endl; + constraints.print(deallog.get_file_stream()); + deallog << "Owned DoFs:" << std::endl; + dof_handler.locally_owned_dofs().print(deallog); + deallog << "Ghost DoFs:" << std::endl; + locally_relevant_dofs.print(deallog); + // we have issues with constraints for u_52 = .... + const unsigned int i = 52; + if (locally_relevant_dofs.is_element(i) && constraints.is_constrained(i)) { - if (this_mpi_process == i) - { - std::cout << "=== Process " << i << std::endl - << "Constraints:" << std::endl; - constraints.print(std::cout); - std::cout << "Owned DoFs:" << std::endl; - dofHandler.locally_owned_dofs().print(std::cout); - std::cout << "Ghost DoFs:" << std::endl; - locally_relevant_dofs.print(std::cout); - std::cout << "Coordinates:" << std::endl; - // we have issues with constraints for u_52 = .... - const unsigned int i = 52; - if (locally_relevant_dofs.is_element(i) && - constraints.is_constrained(i)) - { - std::cout << i << "@" << supportPoints[i] << std::endl; - for (auto c : *constraints.get_constraint_entries(i)) - std::cout << c.first << "@" << supportPoints[c.first] - << std::endl; - } - } - MPI_Barrier(mpi_communicator); + deallog << "Coordinates:" << std::endl; + deallog << i << "@" << supportPoints[i] << std::endl; + for (auto c : *constraints.get_constraint_entries(i)) + deallog << c.first << "@" << supportPoints[c.first] << std::endl; } } @@ -218,5 +209,6 @@ int main(int argc, char *argv[]) { Utilities::MPI::MPI_InitFinalize mpi_initialization(argc, argv); + MPILogInitAll mpi_log; test<3>(); -} \ No newline at end of file +} diff --git a/tests/mpi/periodicity_06.mpirun=2.output b/tests/mpi/periodicity_06.mpirun=2.output index 36e69ad116..1e7bb63e7d 100644 --- a/tests/mpi/periodicity_06.mpirun=2.output +++ b/tests/mpi/periodicity_06.mpirun=2.output @@ -1,225 +1,228 @@ -number of elements: 71 + +DEAL:0::number of elements: 71 === Process 0 -Constraints: - 31 8: 1 - 32 16: 1 - 33 11: 1 - 36 9: 1 - 37 12: 1 - 40 17: 1 - 41 19: 1 - 43 23: 1 - 50 30: 1 - 51 0: 1 - 52 16: 1 - 53 4: 1 - 54 1: 1 - 55 5: 1 - 59 17: 1 - 60 18: 1 - 61 21: 1 - 64 44: 1 - 65 46: 1 - 66 26: 1 - 67 28: 1 - 68 30: 1 - 69 16: 1 - 71 56: 1 - 72 38: 1 - 73 17: 1 - 74 30: 1 - 75 0: 0.5 - 75 30: 0.5 - 76 8: 0.5 - 76 30: 0.5 - 77 0: 0.25 - 77 2: 0.25 - 77 8: 0.25 - 77 30: 0.25 - 78 16: 0.5 - 78 30: 0.5 - 79 0: 0.25 - 79 4: 0.25 - 79 16: 0.25 - 79 30: 0.25 - 80 8: 0.25 - 80 11: 0.25 - 80 16: 0.25 - 80 30: 0.25 - 82 0: 0.5 - 82 2: 0.5 - 83 0: 0.5 - 83 4: 0.5 - 84 0: 0.25 - 84 2: 0.25 - 84 4: 0.25 - 84 6: 0.25 - 85 2: 0.5 - 85 8: 0.5 - 86 8: 0.5 - 86 11: 0.5 - 87 2: 0.25 - 87 6: 0.25 - 87 8: 0.25 - 87 11: 0.25 - 88 2: 0.5 - 88 6: 0.5 - 89 4: 0.5 - 89 16: 0.5 - 90 11: 0.5 - 90 16: 0.5 - 91 4: 0.25 - 91 6: 0.25 - 91 11: 0.25 - 91 16: 0.25 - 92 4: 0.5 - 92 6: 0.5 - 93 6: 0.5 - 93 11: 0.5 - 103 30: 1 - 104 0: 1 - 105 8: 1 - 106 2: 1 - 107 1: 1 - 108 3: 1 - 109 9: 1 - 110 10: 1 - 111 14: 1 - 114 94: 1 - 115 96: 1 - 117 100: 1 - 118 26: 1 - 119 27: 1 - 120 30: 1 - 121 8: 1 - 122 34: 1 - 123 9: 1 - 127 94: 1 - 128 95: 1 - 129 98: 1 - 130 44: 1 - 131 45: 1 - 132 48: 1 - 133 30: 1 - 134 0: 1 - 135 1: 1 - 137 124: 1 - 138 112: 1 - 139 94: 1 - 140 62: 1 - 141 44: 1 - 142 26: 1 - 143 30: 1 -Owned DoFs: -{[0,93]} -Ghost DoFs: -{[0,143]} -Coordinates: -52@-20 20 -10 -16@-20 -20 -10 -=== Process 1 -Constraints: - 31 8: 1 - 32 16: 1 - 33 11: 1 - 36 9: 1 - 37 12: 1 - 40 17: 1 - 41 19: 1 - 43 23: 1 - 50 30: 1 - 51 0: 1 - 52 16: 1 - 53 4: 1 - 54 1: 1 - 55 5: 1 - 59 17: 1 - 60 18: 1 - 61 21: 1 - 64 44: 1 - 65 46: 1 - 66 26: 1 - 67 28: 1 - 68 30: 1 - 69 16: 1 - 71 56: 1 - 72 38: 1 - 73 17: 1 - 74 30: 1 - 75 0: 0.5 - 75 30: 0.5 - 76 8: 0.5 - 76 30: 0.5 - 77 0: 0.25 - 77 2: 0.25 - 77 8: 0.25 - 77 30: 0.25 - 78 16: 0.5 - 78 30: 0.5 - 79 0: 0.25 - 79 4: 0.25 - 79 16: 0.25 - 79 30: 0.25 - 80 8: 0.25 - 80 11: 0.25 - 80 16: 0.25 - 80 30: 0.25 - 82 0: 0.5 - 82 2: 0.5 - 83 0: 0.5 - 83 4: 0.5 - 84 0: 0.25 - 84 2: 0.25 - 84 4: 0.25 - 84 6: 0.25 - 85 2: 0.5 - 85 8: 0.5 - 86 8: 0.5 - 86 11: 0.5 - 87 2: 0.25 - 87 6: 0.25 - 87 8: 0.25 - 87 11: 0.25 - 88 2: 0.5 - 88 6: 0.5 - 103 30: 1 - 104 0: 1 - 105 8: 1 - 106 2: 1 - 107 1: 1 - 108 3: 1 - 109 9: 1 - 110 10: 1 - 111 14: 1 - 114 94: 1 - 115 96: 1 - 117 100: 1 - 118 26: 1 - 119 27: 1 - 120 30: 1 - 121 8: 1 - 122 34: 1 - 123 9: 1 - 127 94: 1 - 128 95: 1 - 129 98: 1 - 130 44: 1 - 131 45: 1 - 132 48: 1 - 133 30: 1 - 134 0: 1 - 135 1: 1 - 137 124: 1 - 138 112: 1 - 139 94: 1 - 140 62: 1 - 141 44: 1 - 142 26: 1 - 143 30: 1 -Owned DoFs: -{[94,143]} -Ghost DoFs: -{[0,88], [94,143]} -Coordinates: -52@-20 20 -10 -16@-20 -20 -10 +DEAL:0::Constraints: + 31 8: 1.00000 + 32 16: 1.00000 + 33 11: 1.00000 + 36 9: 1.00000 + 37 12: 1.00000 + 40 17: 1.00000 + 41 19: 1.00000 + 43 23: 1.00000 + 50 30: 1.00000 + 51 0: 1.00000 + 52 16: 1.00000 + 53 4: 1.00000 + 54 1: 1.00000 + 55 5: 1.00000 + 59 17: 1.00000 + 60 18: 1.00000 + 61 21: 1.00000 + 64 44: 1.00000 + 65 46: 1.00000 + 66 26: 1.00000 + 67 28: 1.00000 + 68 30: 1.00000 + 69 16: 1.00000 + 71 56: 1.00000 + 72 38: 1.00000 + 73 17: 1.00000 + 74 30: 1.00000 + 75 0: 0.500000 + 75 30: 0.500000 + 76 8: 0.500000 + 76 30: 0.500000 + 77 0: 0.250000 + 77 2: 0.250000 + 77 8: 0.250000 + 77 30: 0.250000 + 78 16: 0.500000 + 78 30: 0.500000 + 79 0: 0.250000 + 79 4: 0.250000 + 79 16: 0.250000 + 79 30: 0.250000 + 80 8: 0.250000 + 80 11: 0.250000 + 80 16: 0.250000 + 80 30: 0.250000 + 82 0: 0.500000 + 82 2: 0.500000 + 83 0: 0.500000 + 83 4: 0.500000 + 84 0: 0.250000 + 84 2: 0.250000 + 84 4: 0.250000 + 84 6: 0.250000 + 85 2: 0.500000 + 85 8: 0.500000 + 86 8: 0.500000 + 86 11: 0.500000 + 87 2: 0.250000 + 87 6: 0.250000 + 87 8: 0.250000 + 87 11: 0.250000 + 88 2: 0.500000 + 88 6: 0.500000 + 89 4: 0.500000 + 89 16: 0.500000 + 90 11: 0.500000 + 90 16: 0.500000 + 91 4: 0.250000 + 91 6: 0.250000 + 91 11: 0.250000 + 91 16: 0.250000 + 92 4: 0.500000 + 92 6: 0.500000 + 93 6: 0.500000 + 93 11: 0.500000 + 103 30: 1.00000 + 104 0: 1.00000 + 105 8: 1.00000 + 106 2: 1.00000 + 107 1: 1.00000 + 108 3: 1.00000 + 109 9: 1.00000 + 110 10: 1.00000 + 111 14: 1.00000 + 114 94: 1.00000 + 115 96: 1.00000 + 117 100: 1.00000 + 118 26: 1.00000 + 119 27: 1.00000 + 120 30: 1.00000 + 121 8: 1.00000 + 122 34: 1.00000 + 123 9: 1.00000 + 127 94: 1.00000 + 128 95: 1.00000 + 129 98: 1.00000 + 130 44: 1.00000 + 131 45: 1.00000 + 132 48: 1.00000 + 133 30: 1.00000 + 134 0: 1.00000 + 135 1: 1.00000 + 137 124: 1.00000 + 138 112: 1.00000 + 139 94: 1.00000 + 140 62: 1.00000 + 141 44: 1.00000 + 142 26: 1.00000 + 143 30: 1.00000 +DEAL:0::Owned DoFs: +DEAL:0::{[0,93]} +DEAL:0::Ghost DoFs: +DEAL:0::{[0,143]} +DEAL:0::Coordinates: +DEAL:0::52@-20.0000 20.0000 -10.0000 +DEAL:0::16@-20.0000 -20.0000 -10.0000 + +DEAL:1::=== Process 1 +DEAL:1::Constraints: + 31 8: 1.00000 + 32 16: 1.00000 + 33 11: 1.00000 + 36 9: 1.00000 + 37 12: 1.00000 + 40 17: 1.00000 + 41 19: 1.00000 + 43 23: 1.00000 + 50 30: 1.00000 + 51 0: 1.00000 + 52 16: 1.00000 + 53 4: 1.00000 + 54 1: 1.00000 + 55 5: 1.00000 + 59 17: 1.00000 + 60 18: 1.00000 + 61 21: 1.00000 + 64 44: 1.00000 + 65 46: 1.00000 + 66 26: 1.00000 + 67 28: 1.00000 + 68 30: 1.00000 + 69 16: 1.00000 + 71 56: 1.00000 + 72 38: 1.00000 + 73 17: 1.00000 + 74 30: 1.00000 + 75 0: 0.500000 + 75 30: 0.500000 + 76 8: 0.500000 + 76 30: 0.500000 + 77 0: 0.250000 + 77 2: 0.250000 + 77 8: 0.250000 + 77 30: 0.250000 + 78 16: 0.500000 + 78 30: 0.500000 + 79 0: 0.250000 + 79 4: 0.250000 + 79 16: 0.250000 + 79 30: 0.250000 + 80 8: 0.250000 + 80 11: 0.250000 + 80 16: 0.250000 + 80 30: 0.250000 + 82 0: 0.500000 + 82 2: 0.500000 + 83 0: 0.500000 + 83 4: 0.500000 + 84 0: 0.250000 + 84 2: 0.250000 + 84 4: 0.250000 + 84 6: 0.250000 + 85 2: 0.500000 + 85 8: 0.500000 + 86 8: 0.500000 + 86 11: 0.500000 + 87 2: 0.250000 + 87 6: 0.250000 + 87 8: 0.250000 + 87 11: 0.250000 + 88 2: 0.500000 + 88 6: 0.500000 + 103 30: 1.00000 + 104 0: 1.00000 + 105 8: 1.00000 + 106 2: 1.00000 + 107 1: 1.00000 + 108 3: 1.00000 + 109 9: 1.00000 + 110 10: 1.00000 + 111 14: 1.00000 + 114 94: 1.00000 + 115 96: 1.00000 + 117 100: 1.00000 + 118 26: 1.00000 + 119 27: 1.00000 + 120 30: 1.00000 + 121 8: 1.00000 + 122 34: 1.00000 + 123 9: 1.00000 + 127 94: 1.00000 + 128 95: 1.00000 + 129 98: 1.00000 + 130 44: 1.00000 + 131 45: 1.00000 + 132 48: 1.00000 + 133 30: 1.00000 + 134 0: 1.00000 + 135 1: 1.00000 + 137 124: 1.00000 + 138 112: 1.00000 + 139 94: 1.00000 + 140 62: 1.00000 + 141 44: 1.00000 + 142 26: 1.00000 + 143 30: 1.00000 +DEAL:1::Owned DoFs: +DEAL:1::{[94,143]} +DEAL:1::Ghost DoFs: +DEAL:1::{[0,88], [94,143]} +DEAL:1::Coordinates: +DEAL:1::52@-20.0000 20.0000 -10.0000 +DEAL:1::16@-20.0000 -20.0000 -10.0000 + diff --git a/tests/mpi/periodicity_07.cc b/tests/mpi/periodicity_07.cc index 33586a1cc8..6b4b72fb4b 100644 --- a/tests/mpi/periodicity_07.cc +++ b/tests/mpi/periodicity_07.cc @@ -116,14 +116,14 @@ test(const unsigned numRefinementLevels = 2) pcout << "number of elements: " << triangulation.n_global_active_cells() << std::endl; - // create dofHandler + // create dof_handler FESystem FE(FE_Q(QGaussLobatto<1>(2)), 1); - DoFHandler dofHandler(triangulation); - dofHandler.distribute_dofs(FE); + DoFHandler dof_handler(triangulation); + dof_handler.distribute_dofs(FE); // write mesh for visualization DataOut data_out; - data_out.attach_dof_handler(dofHandler); + data_out.attach_dof_handler(dof_handler); Vector subdomain(triangulation.n_active_cells()); for (unsigned int i = 0; i < subdomain.size(); ++i) subdomain(i) = triangulation.locally_owned_subdomain(); @@ -133,17 +133,17 @@ test(const unsigned numRefinementLevels = 2) mpi_communicator); IndexSet locally_relevant_dofs; - DoFTools::extract_locally_relevant_dofs(dofHandler, locally_relevant_dofs); + DoFTools::extract_locally_relevant_dofs(dof_handler, locally_relevant_dofs); IndexSet locally_active_dofs; - DoFTools::extract_locally_active_dofs(dofHandler, locally_active_dofs); + DoFTools::extract_locally_active_dofs(dof_handler, locally_active_dofs); const std::vector &locally_owned_dofs = - dofHandler.locally_owned_dofs_per_processor(); + dof_handler.locally_owned_dofs_per_processor(); std::map> supportPoints; DoFTools::map_dofs_to_support_points(MappingQ1(), - dofHandler, + dof_handler, supportPoints); /// creating combined hanging node and periodic constraint matrix @@ -155,7 +155,7 @@ test(const unsigned numRefinementLevels = 2) GridTools::PeriodicFacePair::cell_iterator>> periodicity_vectorDof; for (int d = 0; d < dim; ++d) - GridTools::collect_periodic_faces(dofHandler, + GridTools::collect_periodic_faces(dof_handler, /*b_id1*/ 2 * d + 1, /*b_id2*/ 2 * d + 2, /*direction*/ d, @@ -173,7 +173,7 @@ test(const unsigned numRefinementLevels = 2) pcout << "Periodicity constraints are consistent in parallel: " << consistent << std::endl; - DoFTools::make_hanging_node_constraints(dofHandler, constraints); + DoFTools::make_hanging_node_constraints(dof_handler, constraints); const bool hanging_consistent = constraints.is_consistent_in_parallel(locally_owned_dofs, -- 2.39.5