From: Daniel Garcia-Sanchez Date: Wed, 12 May 2021 16:49:59 +0000 (+0200) Subject: Use the new version of find_active_cell_around_point() X-Git-Tag: v9.3.0-rc1~61^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cdd32c7e66de140782908d4afcf0700dd8d54759;p=dealii.git Use the new version of find_active_cell_around_point() --- diff --git a/examples/step-62/step-62.cc b/examples/step-62/step-62.cc index bc47448485..ed8b8c6453 100644 --- a/examples/step-62/step-62.cc +++ b/examples/step-62/step-62.cc @@ -64,9 +64,11 @@ // to evaluate the result of the simulation. #include -// We need this header for the function GridTools::find_active_cell_around_point -// that we use in the function `ElasticWave::store_frequency_step_data()` +// We need these headers for the function +// GridTools::find_active_cell_around_point that we use in the function +// `ElasticWave::store_frequency_step_data()` #include +#include namespace step62 { @@ -1054,6 +1056,13 @@ namespace step62 // displacement_data contains the value of the displacement at these points. std::vector coordinates; std::vector> displacement_data; + + const auto &mapping = get_default_linear_mapping(triangulation); + GridTools::Cache cache(triangulation, mapping); + typename Triangulation::active_cell_iterator cell_hint{}; + std::vector marked_vertices = {}; + const double tolerance = 1.e-10; + for (unsigned int position_idx = 0; position_idx < parameters.nb_probe_points; ++position_idx) @@ -1063,17 +1072,16 @@ namespace step62 { point[dim_idx] = probe_positions[position_idx][dim_idx]; } - bool point_in_locally_owned_cell; + bool point_in_locally_owned_cell = false; { - // First we have to find out if the point is in a locally owned cell. - auto mapping = StaticMappingQ1::mapping; - const std::pair::active_cell_iterator, - Point> - cell_point = GridTools::find_active_cell_around_point(mapping, - dof_handler, - point); - - point_in_locally_owned_cell = cell_point.first->is_locally_owned(); + auto cell_and_ref_point = GridTools::find_active_cell_around_point( + cache, point, cell_hint, marked_vertices, tolerance); + if (cell_and_ref_point.first.state() == IteratorState::valid) + { + cell_hint = cell_and_ref_point.first; + point_in_locally_owned_cell = + cell_and_ref_point.first->is_locally_owned(); + } } if (point_in_locally_owned_cell) {