]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Fixed tests.
authorLuca Heltai <luca.heltai@sissa.it>
Mon, 30 Nov 2020 10:00:44 +0000 (11:00 +0100)
committerLuca Heltai <luca.heltai@sissa.it>
Tue, 11 May 2021 16:55:36 +0000 (18:55 +0200)
tests/grid/build_global_description_tree.cc
tests/grid/distributed_compute_point_locations_01.cc
tests/grid/distributed_compute_point_locations_02.cc
tests/grid/find_active_cell_around_point_04.mpirun=2.with_p4est=true.output
tests/particles/particle_handler_07.with_p4est=true.mpirun=1.output
tests/particles/particle_handler_serial_07.output

index 1967327a74fb8784ff2d96ae55a99d3ebd1aabe8..67c975b65d575e084c87130e770eae7ddb813a2d 100644 (file)
 
 #include <deal.II/numerics/rtree.h>
 
-#include <boost/archive/binary_iarchive.hpp>
-#include <boost/archive/binary_oarchive.hpp>
-#include <boost/optional.hpp>
-#include <boost/serialization/array.hpp>
-#include <boost/serialization/vector.hpp>
-#include <boost/signals2.hpp>
-
 #include <algorithm>
 #include <utility>
 
index f28e06dc4223e22330b39501b7af477f39badd9b..a537c533c803b54d5822c643fb744a0b6ad3180b 100644 (file)
@@ -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
index 979dc1258d12eef84ddb1bcb9f469d3252c01f6e..ec2e356f32adb62eb13c7e3100314c69e3cd6807 100644 (file)
@@ -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<dim> &)
-        {}
     }
 
   // Computing bounding boxes describing the locally owned part of the mesh
index 8e8bd93de6324fab7d4dda0879352cf017b7e48c..87158ebc0b689d9cc701012ad81da15d6de60dc8 100644 (file)
@@ -1,4 +1,2 @@
 
-
-DEAL:1::found on one processor
-
+DEAL:0::found on one processor
\ No newline at end of file
index f60b28e24c776c222f9c352aba612204a33d5f35..fad5985a482152bbdd046f2899e93e7ec7468dc5 100644 (file)
@@ -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
index f60b28e24c776c222f9c352aba612204a33d5f35..fad5985a482152bbdd046f2899e93e7ec7468dc5 100644 (file)
@@ -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

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.