16#ifndef dealii_mpi_mpi_remote_point_evaluation_h
17#define dealii_mpi_mpi_remote_point_evaluation_h
33 template <
int dim,
int spacedim>
52 template <
int dim,
int spacedim = dim>
121 std::vector<std::pair<int, int>>
cells;
156 template <
typename T>
159 std::vector<T> &output,
172 template <
typename T>
175 const std::vector<T> &input,
184 const std::vector<unsigned int> &
331 template <
int dim,
int spacedim>
332 template <
typename T>
335 std::vector<T> &output,
340#ifndef DEAL_II_WITH_MPI
349 const unsigned int my_rank =
353 output.resize(point_ptrs.back());
355 point_ptrs.back() + send_permutation.size()));
362 send_permutation.size());
372 std::find(recv_ranks.begin(), recv_ranks.end(), my_rank);
379 std::find(send_ranks.begin(),
384 for (
unsigned int i = 0; i < send_permutation.size(); ++i)
386 const unsigned int send_index = send_permutation[i];
403 std::vector<MPI_Request> send_requests;
404 send_requests.reserve(send_ranks.size());
406 for (
unsigned int i = 0; i < send_ranks.size(); ++i)
408 if (send_ranks[i] == my_rank)
411 send_requests.emplace_back(MPI_Request());
423 tria->get_communicator(),
424 &send_requests.back());
431 for (
unsigned int i = 0; i < recv_ranks.size(); ++i)
433 if (recv_ranks[i] == my_rank)
440 tria->get_communicator(),
455 tria->get_communicator(),
461 Utilities::unpack<std::vector<T>>(
buffer_char,
false);
465 std::find(recv_ranks.begin(), recv_ranks.end(), status.MPI_SOURCE);
469 const unsigned int j = std::distance(recv_ranks.begin(), ptr);
473 for (
unsigned int i = recv_ptrs[
j], c = 0; i < recv_ptrs[
j + 1];
475 output[recv_permutation[i]] =
buffer[c];
480 send_requests.data(),
487 template <
int dim,
int spacedim>
488 template <
typename T>
491 const std::vector<T> &input,
496#ifndef DEAL_II_WITH_MPI
505 const unsigned int my_rank =
510 for (
unsigned int c = 0; c < recv_permutation.size(); ++c)
514 for (
unsigned int c = 0; c < send_permutation.size(); ++c)
518 const auto &point_ptrs = this->get_point_ptrs();
521 point_ptrs.back() + send_permutation.size()));
535 std::find(recv_ranks.begin(), recv_ranks.end(), my_rank);
542 std::find(send_ranks.begin(),
547 for (
unsigned int i = 0, c = 0; i < point_ptrs.size() - 1; ++i)
549 const auto n_entries = point_ptrs[i + 1] - point_ptrs[i];
571 std::vector<MPI_Request> send_requests;
572 send_requests.reserve(recv_ranks.size());
574 for (
unsigned int i = 0; i < recv_ranks.size(); ++i)
576 if (recv_ranks[i] == my_rank)
579 send_requests.push_back(MPI_Request());
591 tria->get_communicator(),
592 &send_requests.back());
599 for (
unsigned int i = 0; i < send_ranks.size(); ++i)
601 if (send_ranks[i] == my_rank)
608 tria->get_communicator(),
623 tria->get_communicator(),
629 Utilities::unpack<std::vector<T>>(
recv_buffer,
false);
633 std::find(send_ranks.begin(), send_ranks.end(), status.MPI_SOURCE);
637 const unsigned int j = std::distance(send_ranks.begin(), ptr);
640 send_ptrs[
j + 1] - send_ptrs[
j]);
642 for (
unsigned int i = send_ptrs[
j], c = 0; i < send_ptrs[
j + 1];
648 send_requests.data(),
value_type * data() const noexcept
void evaluate_and_process(std::vector< T > &output, std::vector< T > &buffer, const std::function< void(const ArrayView< T > &, const CellData &)> &evaluation_function) const
std::vector< unsigned int > send_ptrs
bool all_points_found() const
const bool enforce_unique_mapping
boost::signals2::connection tria_signal
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
void process_and_evaluate(const std::vector< T > &input, std::vector< T > &buffer, const std::function< void(const ArrayView< const T > &, const CellData &)> &evaluation_function) const
const std::vector< unsigned int > & get_point_ptrs() const
const unsigned int rtree_level
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 std::function< std::vector< bool >()> marked_vertices
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 & ExcNotImplemented()
static ::ExceptionBase & ExcNeedsMPI()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
static const unsigned int invalid_unsigned_int
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
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