37 template <
int dim,
int spacedim>
39 const double tolerance,
40 const bool enforce_unique_mapping,
41 const unsigned int rtree_level,
42 const std::function<std::vector<bool>()> &marked_vertices)
43 : tolerance(tolerance)
44 , enforce_unique_mapping(enforce_unique_mapping)
45 , rtree_level(rtree_level)
46 , marked_vertices(marked_vertices)
51 template <
int dim,
int spacedim>
60 template <
int dim,
int spacedim>
62 const double tolerance,
63 const bool enforce_unique_mapping,
64 const unsigned int rtree_level,
65 const std::function<std::vector<bool>()> &marked_vertices)
66 : additional_data(tolerance,
67 enforce_unique_mapping,
75 template <
int dim,
int spacedim>
78 if (tria_signal.connected())
79 tria_signal.disconnect();
84 template <
int dim,
int spacedim>
93 this->reinit(cache, points);
98 template <
int dim,
int spacedim>
104#ifndef DEAL_II_WITH_MPI
109 if (tria_signal.connected())
110 tria_signal.disconnect();
113 [&]() { this->ready_flag =
false; });
116 std::vector<std::vector<BoundingBox<spacedim>>> global_bboxes;
117 global_bboxes.emplace_back(
119 additional_data.rtree_level));
126 additional_data.marked_vertices ? additional_data.marked_vertices() :
128 additional_data.tolerance,
130 additional_data.enforce_unique_mapping);
138 template <
int dim,
int spacedim>
142 DistributedComputePointLocationsInternal<dim, spacedim> &
data,
144 const
Mapping<dim, spacedim> &mapping)
158 for (
unsigned int i = 0; i <
data.recv_components.size(); ++i)
161 this->recv_permutation.size());
165 this->point_ptrs.size());
169 std::tuple<unsigned int, unsigned int> n_owning_processes_default{
171 std::tuple<unsigned int, unsigned int> n_owning_processes_local =
172 n_owning_processes_default;
174 for (
unsigned int i = 0; i <
data.n_searched_points; ++i)
176 std::get<0>(n_owning_processes_local) =
177 std::min(std::get<0>(n_owning_processes_local),
179 std::get<1>(n_owning_processes_local) =
180 std::max(std::get<1>(n_owning_processes_local),
186 const auto n_owning_processes_global =
187 Utilities::MPI::all_reduce<std::tuple<unsigned int, unsigned int>>(
188 n_owning_processes_local,
189 tria.get_mpi_communicator(),
191 const auto &b) -> std::tuple<unsigned int, unsigned int> {
192 if (a == n_owning_processes_default)
195 if (b == n_owning_processes_default)
198 return std::tuple<unsigned int, unsigned int>{
199 std::min(std::get<0>(a), std::get<0>(b)),
200 std::max(std::get<1>(a), std::get<1>(b))};
203 if (n_owning_processes_global == n_owning_processes_default)
211 (std::get<1>(n_owning_processes_global) == 1);
221 std::pair<int, int> dummy{-1, -1};
222 for (
const auto &i :
data.send_components)
224 if (dummy != std::get<0>(i))
226 dummy = std::get<0>(i);
228 cell_data->reference_point_ptrs.emplace_back(
229 cell_data->reference_point_values.size());
232 cell_data->reference_point_values.emplace_back(std::get<3>(i));
236 cell_data->reference_point_ptrs.emplace_back(
237 cell_data->reference_point_values.size());
239 unsigned int max_size_recv = 0;
240 for (
unsigned int i = 0; i <
recv_ranks.size(); ++i)
244 unsigned int max_size_send = 0;
245 for (
unsigned int i = 0; i <
send_ranks.size(); ++i)
269 template <
int dim,
int spacedim>
277 template <
int dim,
int spacedim>
281 return {0,
static_cast<unsigned int>(cells.size())};
286 template <
int dim,
int spacedim>
289 const unsigned int cell)
const
292 return {&
triangulation, cells[cell].first, cells[cell].second};
297 template <
int dim,
int spacedim>
300 const unsigned int cell)
const
303 return {reference_point_values.data() + reference_point_ptrs[cell],
304 reference_point_ptrs[cell + 1] - reference_point_ptrs[cell]};
309 template <
int dim,
int spacedim>
318 template <
int dim,
int spacedim>
319 const std::vector<unsigned int> &
327 template <
int dim,
int spacedim>
336 template <
int dim,
int spacedim>
345 template <
int dim,
int spacedim>
348 const unsigned int i)
const
360 template <
int dim,
int spacedim>
369 template <
int dim,
int spacedim>
378 template <
int dim,
int spacedim>
387 template <
int dim,
int spacedim>
388 const std::vector<unsigned int> &
396 template <
int dim,
int spacedim>
397 const std::vector<unsigned int> &
406#include "mpi_remote_point_evaluation.inst"
Abstract base class for mapping classes.
std_cxx20::ranges::iota_view< unsigned int, unsigned int > cell_indices() const
ArrayView< const Point< dim > > get_unit_points(const unsigned int cell) const
Triangulation< dim, spacedim >::active_cell_iterator get_active_cell_iterator(const unsigned int cell) const
CellData(const Triangulation< dim, spacedim > &triangulation)
const std::vector< unsigned int > & get_send_permutation() const
std::vector< unsigned int > send_ptrs
std::unique_ptr< CellData > cell_data
bool all_points_found() const
unsigned int buffer_size_without_sorting
ObserverPointer< const Mapping< dim, spacedim > > mapping
std::vector< unsigned int > point_ptrs
RemotePointEvaluation(const AdditionalData &additional_data=AdditionalData())
std::vector< unsigned int > recv_permutation
const Triangulation< dim, spacedim > & get_triangulation() const
ObserverPointer< const Triangulation< dim, spacedim > > tria
const std::vector< unsigned int > & get_point_ptrs() const
const std::vector< unsigned int > & get_inverse_recv_permutation() const
std::vector< unsigned int > send_permutation_inv
const AdditionalData additional_data
bool is_map_unique() const
std::vector< unsigned int > recv_ranks
std::vector< unsigned int > recv_permutation_inv
std::vector< unsigned int > recv_ptrs
const Mapping< dim, spacedim > & get_mapping() const
const CellData & get_cell_data() const
std::vector< unsigned int > send_ranks
bool all_points_found_flag
unsigned int buffer_size_with_sorting
bool point_found(const unsigned int i) const
std::vector< unsigned int > send_permutation
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNeedsMPI()
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
std::vector< index_type > data
static const unsigned int invalid_unsigned_int
boost::integer_range< IncrementableType > iota_view
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
std::vector< BoundingBox< boost::geometry::dimension< typename Rtree::indexable_type >::value > > extract_rtree_level(const Rtree &tree, const unsigned int level)
AdditionalData(const double tolerance=1e-6, const bool enforce_unique_mapping=false, const unsigned int rtree_level=0, const std::function< std::vector< bool >()> &marked_vertices={})
bool enforce_unique_mapping