From: Luca Heltai Date: Mon, 30 Nov 2020 10:00:44 +0000 (+0100) Subject: Fixed tests. X-Git-Tag: v9.3.0-rc1~88^2~5 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9a974bac53472a70a977cd231cdb939bd12ed62;p=dealii.git Fixed tests. --- diff --git a/tests/grid/build_global_description_tree.cc b/tests/grid/build_global_description_tree.cc index 1967327a74..67c975b65d 100644 --- a/tests/grid/build_global_description_tree.cc +++ b/tests/grid/build_global_description_tree.cc @@ -28,13 +28,6 @@ #include -#include -#include -#include -#include -#include -#include - #include #include diff --git a/tests/grid/distributed_compute_point_locations_01.cc b/tests/grid/distributed_compute_point_locations_01.cc index f28e06dc42..a537c533c8 100644 --- a/tests/grid/distributed_compute_point_locations_01.cc +++ b/tests/grid/distributed_compute_point_locations_01.cc @@ -77,8 +77,9 @@ test_compute_pt_loc(unsigned int n_points) // Testing in serial against the serial version auto cell_qpoint_map = GridTools::compute_point_locations(cache, points); - auto & serial_cells = std::get<0>(cell_qpoint_map); - auto & serial_qpoints = std::get<1>(cell_qpoint_map); + const auto &serial_cells = std::get<0>(cell_qpoint_map); + const auto &serial_qpoints = std::get<1>(cell_qpoint_map); + const auto &serial_map = std::get<2>(cell_qpoint_map); std::size_t n_cells = std::get<0>(output_tuple).size(); deallog << "Points found in " << n_cells << " cells" << std::endl; @@ -87,13 +88,14 @@ test_compute_pt_loc(unsigned int n_points) // the serial one for (unsigned int c = 0; c < n_cells; ++c) { - auto &cell = std::get<0>(output_tuple)[c]; - auto &quad = std::get<1>(output_tuple)[c]; - auto &local_map = std::get<2>(output_tuple)[c]; - auto &original_points = std::get<3>(output_tuple)[c]; - auto &ranks = std::get<4>(output_tuple)[c]; - - auto pos_cell = std::find(serial_cells.begin(), serial_cells.end(), cell); + const auto &cell = std::get<0>(output_tuple)[c]; + const auto &quad = std::get<1>(output_tuple)[c]; + const auto &local_map = std::get<2>(output_tuple)[c]; + const auto &original_points = std::get<3>(output_tuple)[c]; + const auto &ranks = std::get<4>(output_tuple)[c]; + + const auto pos_cell = + std::find(serial_cells.begin(), serial_cells.end(), cell); for (auto r : ranks) if (r != 0) deallog << "ERROR: rank is not 0 but " << std::to_string(r) @@ -111,13 +113,15 @@ test_compute_pt_loc(unsigned int n_points) deallog << "ERROR: in the number of points for cell" << std::to_string(serial_cell_idx) << std::endl; - unsigned int pt_num = 0; + unsigned int pt_num = 0; + const auto serial_local_map = serial_map[serial_cell_idx]; for (const auto &p_idx : local_map) { - auto serial_pt_pos = - std::find(local_map.begin(), local_map.end(), p_idx); - auto serial_pt_idx = serial_pt_pos - local_map.begin(); - if (serial_pt_pos == local_map.end()) + auto serial_pt_pos = std::find(serial_local_map.begin(), + serial_local_map.end(), + p_idx); + auto serial_pt_idx = serial_pt_pos - serial_local_map.begin(); + if (serial_pt_pos == serial_local_map.end()) deallog << "ERROR: point index not found for " << std::to_string(serial_pt_idx) << std::endl; else diff --git a/tests/grid/distributed_compute_point_locations_02.cc b/tests/grid/distributed_compute_point_locations_02.cc index 979dc1258d..ec2e356f32 100644 --- a/tests/grid/distributed_compute_point_locations_02.cc +++ b/tests/grid/distributed_compute_point_locations_02.cc @@ -92,42 +92,36 @@ test_compute_pt_loc(unsigned int ref_cube, unsigned int ref_sphere) // Store the point only if it is inside a locally owned sphere cell if (cell->subdomain_id() == my_rank) loc_owned_points.emplace_back(center_pt); - try + // Find the cube cell where center pt lies + auto my_pair = GridTools::find_active_cell_around_point(cache, center_pt); + // If it is inside a locally owned cell it shall be returned + // from distributed compute point locations + if (my_pair.first.state() == IteratorState::valid && + my_pair.first->is_locally_owned()) { - // Find the cube cell where center pt lies - auto my_pair = - GridTools::find_active_cell_around_point(cache, center_pt); - // If it is inside a locally owned cell it shall be returned - // from distributed compute point locations - if (my_pair.first->is_locally_owned()) - { - computed_pts++; - auto cells_it = std::find(computed_cells.begin(), - computed_cells.end(), - my_pair.first); + computed_pts++; + auto cells_it = std::find(computed_cells.begin(), + computed_cells.end(), + my_pair.first); - if (cells_it == computed_cells.end()) - { - // Cell not found: adding a new cell - computed_cells.emplace_back(my_pair.first); - computed_qpoints.emplace_back(1, my_pair.second); - computed_points.emplace_back(1, center_pt); - computed_ranks.emplace_back(1, cell->subdomain_id()); - } - else - { - // Cell found: just adding the point index and qpoint to the - // list - unsigned int current_cell = cells_it - computed_cells.begin(); - computed_qpoints[current_cell].emplace_back(my_pair.second); - computed_points[current_cell].emplace_back(center_pt); - computed_ranks[current_cell].emplace_back( - cell->subdomain_id()); - } + if (cells_it == computed_cells.end()) + { + // Cell not found: adding a new cell + computed_cells.emplace_back(my_pair.first); + computed_qpoints.emplace_back(1, my_pair.second); + computed_points.emplace_back(1, center_pt); + computed_ranks.emplace_back(1, cell->subdomain_id()); + } + else + { + // Cell found: just adding the point index and qpoint to the + // list + unsigned int current_cell = cells_it - computed_cells.begin(); + computed_qpoints[current_cell].emplace_back(my_pair.second); + computed_points[current_cell].emplace_back(center_pt); + computed_ranks[current_cell].emplace_back(cell->subdomain_id()); } } - catch (const GridTools::ExcPointNotFound &) - {} } // Computing bounding boxes describing the locally owned part of the mesh diff --git a/tests/grid/find_active_cell_around_point_04.mpirun=2.with_p4est=true.output b/tests/grid/find_active_cell_around_point_04.mpirun=2.with_p4est=true.output index 8e8bd93de6..87158ebc0b 100644 --- a/tests/grid/find_active_cell_around_point_04.mpirun=2.with_p4est=true.output +++ b/tests/grid/find_active_cell_around_point_04.mpirun=2.with_p4est=true.output @@ -1,4 +1,2 @@ - -DEAL:1::found on one processor - +DEAL:0::found on one processor \ No newline at end of file diff --git a/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output b/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output index f60b28e24c..fad5985a48 100644 --- a/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output +++ b/tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output @@ -31,37 +31,7 @@ DEAL:2d/2d::Particle id 8 is in cell 2.15 DEAL:2d/2d:: at location 0.850000 0.850000 DEAL:2d/2d:: at reference location 0.400000 0.400000 DEAL:2d/2d::OK -DEAL:2d/3d::Particle number: 10 -DEAL:2d/3d::Particle id 2 is in cell 2.0 -DEAL:2d/3d:: at location 0.250000 0.250000 0.250000 -DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 1 is in cell 2.0 -DEAL:2d/3d:: at location 0.150000 0.150000 0.150000 -DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 0 is in cell 2.0 -DEAL:2d/3d:: at location 0.0500000 0.0500000 0.0500000 -DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 4 is in cell 2.3 -DEAL:2d/3d:: at location 0.450000 0.450000 0.450000 -DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 3 is in cell 2.3 -DEAL:2d/3d:: at location 0.350000 0.350000 0.350000 -DEAL:2d/3d:: at reference location 0.400000 0.400000 -DEAL:2d/3d::Particle id 7 is in cell 2.12 -DEAL:2d/3d:: at location 0.750000 0.750000 0.750000 -DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 6 is in cell 2.12 -DEAL:2d/3d:: at location 0.650000 0.650000 0.650000 -DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 5 is in cell 2.12 -DEAL:2d/3d:: at location 0.550000 0.550000 0.550000 -DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 9 is in cell 2.15 -DEAL:2d/3d:: at location 0.950000 0.950000 0.950000 -DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 8 is in cell 2.15 -DEAL:2d/3d:: at location 0.850000 0.850000 0.850000 -DEAL:2d/3d:: at reference location 0.400000 0.400000 +DEAL:2d/3d::Particle number: 0 DEAL:2d/3d::OK DEAL:3d/3d::Particle number: 10 DEAL:3d/3d::Particle id 2 is in cell 2.0 diff --git a/tests/particles/particle_handler_serial_07.output b/tests/particles/particle_handler_serial_07.output index f60b28e24c..fad5985a48 100644 --- a/tests/particles/particle_handler_serial_07.output +++ b/tests/particles/particle_handler_serial_07.output @@ -31,37 +31,7 @@ DEAL:2d/2d::Particle id 8 is in cell 2.15 DEAL:2d/2d:: at location 0.850000 0.850000 DEAL:2d/2d:: at reference location 0.400000 0.400000 DEAL:2d/2d::OK -DEAL:2d/3d::Particle number: 10 -DEAL:2d/3d::Particle id 2 is in cell 2.0 -DEAL:2d/3d:: at location 0.250000 0.250000 0.250000 -DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 1 is in cell 2.0 -DEAL:2d/3d:: at location 0.150000 0.150000 0.150000 -DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 0 is in cell 2.0 -DEAL:2d/3d:: at location 0.0500000 0.0500000 0.0500000 -DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 4 is in cell 2.3 -DEAL:2d/3d:: at location 0.450000 0.450000 0.450000 -DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 3 is in cell 2.3 -DEAL:2d/3d:: at location 0.350000 0.350000 0.350000 -DEAL:2d/3d:: at reference location 0.400000 0.400000 -DEAL:2d/3d::Particle id 7 is in cell 2.12 -DEAL:2d/3d:: at location 0.750000 0.750000 0.750000 -DEAL:2d/3d:: at reference location 1.00000 1.00000 -DEAL:2d/3d::Particle id 6 is in cell 2.12 -DEAL:2d/3d:: at location 0.650000 0.650000 0.650000 -DEAL:2d/3d:: at reference location 0.600000 0.600000 -DEAL:2d/3d::Particle id 5 is in cell 2.12 -DEAL:2d/3d:: at location 0.550000 0.550000 0.550000 -DEAL:2d/3d:: at reference location 0.200000 0.200000 -DEAL:2d/3d::Particle id 9 is in cell 2.15 -DEAL:2d/3d:: at location 0.950000 0.950000 0.950000 -DEAL:2d/3d:: at reference location 0.800000 0.800000 -DEAL:2d/3d::Particle id 8 is in cell 2.15 -DEAL:2d/3d:: at location 0.850000 0.850000 0.850000 -DEAL:2d/3d:: at reference location 0.400000 0.400000 +DEAL:2d/3d::Particle number: 0 DEAL:2d/3d::OK DEAL:3d/3d::Particle number: 10 DEAL:3d/3d::Particle id 2 is in cell 2.0