38 template <
int dim,
int spacedim>
40 const double tolerance,
41 const bool enforce_unique_mapping,
42 const unsigned int rtree_level,
43 const std::function<std::vector<bool>()> &marked_vertices)
44 : tolerance(tolerance)
45 , enforce_unique_mapping(enforce_unique_mapping)
46 , rtree_level(rtree_level)
47 , marked_vertices(marked_vertices)
53 template <
int dim,
int spacedim>
56 if (tria_signal.connected())
57 tria_signal.disconnect();
62 template <
int dim,
int spacedim>
69#ifndef DEAL_II_WITH_MPI
75 if (tria_signal.connected())
76 tria_signal.disconnect();
79 tria.
signals.any_change.connect([&]() { this->ready_flag =
false; });
81 std::vector<BoundingBox<spacedim>> local_boxes;
82 for (
const auto &cell :
84 local_boxes.push_back(mapping.get_bounding_box(cell));
87 const auto local_tree =
pack_rtree(local_boxes);
90 std::vector<std::vector<BoundingBox<spacedim>>> global_bboxes(1);
100 marked_vertices ? marked_vertices() :
std::vector<
bool>(),
103 enforce_unique_mapping);
105 this->reinit(data,
tria, mapping);
111 template <
int dim,
int spacedim>
115 DistributedComputePointLocationsInternal<dim, spacedim> &data,
117 const
Mapping<dim, spacedim> & mapping)
130 this->
point_ptrs.assign(data.n_searched_points + 1, 0);
131 for (
unsigned int i = 0; i < data.recv_components.size(); ++i)
134 this->recv_permutation.size());
138 this->point_ptrs.size());
139 this->
point_ptrs[std::get<1>(data.recv_components[i]) + 1]++;
142 std::tuple<unsigned int, unsigned int> n_owning_processes_default{
144 std::tuple<unsigned int, unsigned int> n_owning_processes_local =
145 n_owning_processes_default;
147 for (
unsigned int i = 0; i < data.n_searched_points; ++i)
149 std::get<0>(n_owning_processes_local) =
150 std::min(std::get<0>(n_owning_processes_local),
152 std::get<1>(n_owning_processes_local) =
153 std::max(std::get<1>(n_owning_processes_local),
159 const auto n_owning_processes_global =
160 Utilities::MPI::all_reduce<std::tuple<unsigned int, unsigned int>>(
161 n_owning_processes_local,
162 tria.get_communicator(),
164 const auto &b) -> std::tuple<unsigned int, unsigned int> {
165 if (a == n_owning_processes_default)
168 if (b == n_owning_processes_default)
171 return std::tuple<unsigned int, unsigned int>{
172 std::min(std::get<0>(a), std::get<0>(b)),
173 std::max(std::get<1>(a), std::get<1>(b))};
176 if (n_owning_processes_global == n_owning_processes_default)
184 (std::get<1>(n_owning_processes_global) == 1);
194 std::pair<int, int> dummy{-1, -1};
195 for (
const auto &i : data.send_components)
197 if (dummy != std::get<0>(i))
199 dummy = std::get<0>(i);
217 template <
int dim,
int spacedim>
226 template <
int dim,
int spacedim>
227 const std::vector<unsigned int> &
235 template <
int dim,
int spacedim>
239 return unique_mapping;
244 template <
int dim,
int spacedim>
248 return all_points_found_flag;
253 template <
int dim,
int spacedim>
256 const unsigned int i)
const
260 if (all_points_found_flag)
263 return (point_ptrs[i + 1] - point_ptrs[i]) > 0;
268 template <
int dim,
int spacedim>
277 template <
int dim,
int spacedim>
286 template <
int dim,
int spacedim>
296#include "mpi_remote_point_evaluation.inst"
Abstract base class for mapping classes.
RemotePointEvaluation(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={})
std::vector< unsigned int > send_ptrs
bool all_points_found() const
const bool enforce_unique_mapping
std::vector< unsigned int > point_ptrs
std::vector< unsigned int > recv_permutation
const Triangulation< dim, spacedim > & get_triangulation() const
SmartPointer< const Mapping< dim, spacedim > > mapping
const std::vector< unsigned int > & get_point_ptrs() const
bool is_map_unique() const
std::vector< unsigned int > recv_ranks
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
void reinit(const std::vector< Point< spacedim > > &points, const Triangulation< dim, spacedim > &tria, const Mapping< dim, spacedim > &mapping)
SmartPointer< const Triangulation< dim, spacedim > > tria
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()
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > min(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
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)
std::vector< std::pair< int, int > > cells
std::vector< unsigned int > reference_point_ptrs
std::vector< Point< dim > > reference_point_values
const ::Triangulation< dim, spacedim > & tria