20#include <deal.II/base/mpi_consensus_algorithms.templates.h>
38 template <
int dim,
int spacedim>
40 const double tolerance,
41 const bool enforce_unique_mapping)
42 : tolerance(tolerance)
43 , enforce_unique_mapping(enforce_unique_mapping)
49 template <
int dim,
int spacedim>
52 if (tria_signal.connected())
53 tria_signal.disconnect();
58 template <
int dim,
int spacedim>
65#ifndef DEAL_II_WITH_MPI
71 if (tria_signal.connected())
72 tria_signal.disconnect();
75 tria.
signals.any_change.connect([&]() { this->ready_flag =
false; });
78 this->mapping = &mapping;
80 std::vector<BoundingBox<spacedim>> local_boxes;
82 if (cell->is_locally_owned())
86 const auto local_tree =
pack_rtree(local_boxes);
92 const auto global_bboxes =
104 enforce_unique_mapping);
106 this->recv_ranks = data.recv_ranks;
107 this->recv_ptrs = data.recv_ptrs;
109 this->send_ranks = data.send_ranks;
110 this->send_ptrs = data.send_ptrs;
112 this->recv_permutation = {};
113 this->recv_permutation.resize(data.recv_components.size());
114 this->point_ptrs.assign(points.size() + 1, 0);
115 for (
unsigned int i = 0; i < data.recv_components.size(); ++i)
118 this->recv_permutation.size());
119 this->recv_permutation[std::get<2>(data.recv_components[i])] = i;
122 this->point_ptrs.size());
123 this->point_ptrs[std::get<1>(data.recv_components[i]) + 1]++;
126 unique_mapping =
true;
127 for (
unsigned int i = 0; i < points.size(); ++i)
129 if (unique_mapping && this->point_ptrs[i + 1] != 1)
130 unique_mapping =
false;
131 this->point_ptrs[i + 1] += this->point_ptrs[i];
135 send_permutation = {};
137 std::pair<int, int> dummy{-1, -1};
138 for (
const auto &i : data.send_components)
140 if (dummy != std::get<0>(i))
142 dummy = std::get<0>(i);
143 cell_data.cells.emplace_back(dummy);
144 cell_data.reference_point_ptrs.emplace_back(
145 cell_data.reference_point_values.size());
148 cell_data.reference_point_values.emplace_back(std::get<3>(i));
149 send_permutation.emplace_back(std::get<5>(i));
152 cell_data.reference_point_ptrs.emplace_back(
153 cell_data.reference_point_values.size());
155 this->ready_flag =
true;
160 template <
int dim,
int spacedim>
161 const std::vector<unsigned int> &
169 template <
int dim,
int spacedim>
173 return unique_mapping;
178 template <
int dim,
int spacedim>
187 template <
int dim,
int spacedim>
196 template <
int dim,
int spacedim>
206#include "mpi_remote_point_evaluation.inst"
virtual BoundingBox< spacedim > get_bounding_box(const typename Triangulation< dim, spacedim >::cell_iterator &cell) const
virtual MPI_Comm get_communicator() const
const Triangulation< dim, spacedim > & get_triangulation() const
const std::vector< unsigned int > & get_point_ptrs() const
bool is_map_unique() const
RemotePointEvaluation(const double tolerance=1e-6, const bool enforce_unique_mapping=false)
const Mapping< dim, spacedim > & get_mapping() const
void reinit(const std::vector< Point< spacedim > > &points, const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping)
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< active_cell_iterator > active_cell_iterators() const
static ::ExceptionBase & ExcNeedsMPI()
#define Assert(cond, exc)
#define AssertIndexRange(index, range)
std::vector< T > all_gather(const MPI_Comm &comm, const T &object_to_send)
std::vector< BoundingBox< boost::geometry::dimension< typename Rtree::indexable_type >::value > > extract_rtree_level(const Rtree &tree, const unsigned int level)
RTree< typename LeafTypeIterator::value_type, IndexType, IndexableGetter > pack_rtree(const LeafTypeIterator &begin, const LeafTypeIterator &end)