15#ifndef dealii_grid_tools_h
16#define dealii_grid_tools_h
48#include <boost/archive/binary_iarchive.hpp>
49#include <boost/archive/binary_oarchive.hpp>
50#include <boost/random/mersenne_twister.hpp>
51#include <boost/serialization/array.hpp>
52#include <boost/serialization/vector.hpp>
54#ifdef DEAL_II_WITH_ZLIB
55# include <boost/iostreams/device/back_inserter.hpp>
56# include <boost/iostreams/filter/gzip.hpp>
57# include <boost/iostreams/filtering_stream.hpp>
58# include <boost/iostreams/stream.hpp>
64#ifdef DEAL_II_HAVE_CXX20
77 template <
int dim,
int spacedim>
86 class MappingCollection;
93 template <
int dim,
int spacedim>
100 template <
int dim,
int spacedim,
typename MeshType>
106 using type =
typename MeshType::active_cell_iterator;
113 template <
int dim,
int spacedim>
219 template <
int dim,
typename Transformation,
int spacedim>
222 std::assignable_from<
234 template <
int dim,
int spacedim>
250 template <
int dim,
int spacedim>
333 const
Function<dim,
double> *coefficient =
nullptr,
334 const
bool solve_for_absolute_positions = false);
343 template <
int dim,
int spacedim>
345 scale(const
double scaling_factor,
377 template <
int dim,
int spacedim>
382 const
bool keep_boundary = true,
383 const
unsigned int seed =
boost::random::mt19937::default_seed);
474 template <
int dim,
int spacedim>
477 const
double limit_angle_fraction = .75);
542 template <
int dim,
int spacedim>
545 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
546 std::vector<std::vector<Point<dim>>>,
547 std::vector<std::vector<unsigned int>>>
591 template <
int dim,
int spacedim>
594 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
595 std::vector<std::vector<Point<dim>>>,
596 std::vector<std::vector<unsigned int>>,
597 std::vector<unsigned int>>
687 template <
int dim,
int spacedim>
690 std::vector<typename Triangulation<dim, spacedim>::active_cell_iterator>,
691 std::vector<std::vector<Point<dim>>>,
692 std::vector<std::vector<unsigned int>>,
693 std::vector<std::vector<Point<spacedim>>>,
694 std::vector<std::vector<unsigned int>>>
702 const double tolerance = 1e-10,
703 const std::vector<bool> &marked_vertices = {},
704 const bool enforce_unique_mapping =
true);
722 template <
int dim,
int spacedim>
747 std::vector<std::tuple<std::pair<int, int>,
777 std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
802 template <
int dim,
int spacedim>
808 const std::vector<bool> &marked_vertices,
809 const double tolerance,
810 const bool perform_handshake,
811 const bool enforce_unique_mapping =
false);
821 template <
int structdim,
int spacedim>
828 std::array<::Point<spacedim>, structdim + 1>;
838 std::vector<std::tuple<std::pair<int, int>,
852 std::vector<std::tuple<unsigned int, unsigned int, IntersectionType>>
884 const unsigned int n_points_1D,
889 const bool consistent_numbering_of_sender_and_receiver =
false)
const;
899 std::map<unsigned int, std::vector<unsigned int>>
901 const std::vector<std::tuple<unsigned int, unsigned int, unsigned int>>
902 &point_recv_components,
913 template <
int structdim,
int dim,
int spacedim>
917 const std::vector<std::vector<
Point<spacedim>>> &intersection_requests,
919 const std::vector<bool> &marked_vertices,
920 const double tolerance);
933 template <
int spacedim>
964 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
968 const MeshType<dim, spacedim> &mesh,
969 const
Point<spacedim> &p,
970 const
std::vector<
bool> &marked_vertices = {});
998 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1002 const
Mapping<dim, spacedim> &mapping,
1003 const MeshType<dim, spacedim> &mesh,
1004 const
Point<spacedim> &p,
1005 const
std::vector<
bool> &marked_vertices = {});
1030 template <
typename MeshType>
1033 std::vector<typename MeshType::active_cell_iterator>
1036 typename ::internal::ActiveCellIterator<MeshType::dimension,
1037 MeshType::space_dimension,
1041 const unsigned int vertex_index);
1108 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1112 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1114 std::pair<typename ::internal::
1115 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1119 const MeshType<dim, spacedim> &mesh,
1121 const std::vector<bool> &marked_vertices = {},
1122 const double tolerance = 1.e-10);
1134 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1138 typename MeshType<dim, spacedim>::active_cell_iterator
1140 typename ::internal::
1141 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
1145 const std::vector<bool> &marked_vertices = {},
1146 const double tolerance = 1.e-10);
1154 template <
int dim,
int spacedim>
1155 std::pair<typename DoFHandler<dim, spacedim>::active_cell_iterator,
1161 const double tolerance = 1.e-10);
1214 template <
int dim,
int spacedim>
1215 std::pair<typename Triangulation<dim, spacedim>::active_cell_iterator,
1218 const Cache<dim, spacedim> &cache,
1222 const std::vector<bool> &marked_vertices = {},
1223 const double tolerance = 1.e-10);
1241 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1245 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
1247 std::pair<typename ::internal::
1248 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1253 const MeshType<dim, spacedim> &mesh,
1256 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1259 &vertex_to_cell_centers,
1260 const typename MeshType<dim, spacedim>::active_cell_iterator &cell_hint =
1261 typename MeshType<dim, spacedim>::active_cell_iterator(),
1262 const std::vector<bool> &marked_vertices = {},
1265 const double tolerance = 1.e-10,
1267 std::pair<BoundingBox<spacedim>,
1269 *relevant_cell_bounding_boxes_rtree =
nullptr);
1300 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1304 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1307 std::vector<std::pair<
1308 typename ::internal::
1309 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1314 const MeshType<dim, spacedim> &mesh,
1316 const double tolerance,
1317 const std::pair<
typename MeshType<dim, spacedim>::active_cell_iterator,
1320 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>>
1321 *vertex_to_cells =
nullptr);
1332 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
1336 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
1339 std::vector<std::pair<
1340 typename ::internal::
1341 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
1346 const MeshType<dim, spacedim> &mesh,
1348 const double tolerance = 1e-10,
1349 const std::vector<bool> &marked_vertices = {});
1374 template <
typename MeshType>
1377 const typename MeshType::cell_iterator &cell);
1405 template <typename MeshType>
1408 const typename MeshType::active_cell_iterator &cell,
1409 std::vector<typename MeshType::active_cell_iterator> &active_neighbors);
1462 template <typename MeshType>
1466 const MeshType &mesh,
1467 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1480 template <typename MeshType>
1484 const MeshType &mesh,
1485 const
std::function<
bool(const typename MeshType::cell_iterator &)>
1487 const
unsigned int level);
1504 template <typename MeshType>
1560 template <typename MeshType>
1564 const MeshType &mesh,
1565 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1567 const
double layer_thickness);
1593 template <typename MeshType>
1597 const MeshType &mesh,
1598 const
double layer_thickness);
1672 template <typename MeshType>
1676 const MeshType &mesh,
1677 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
1679 const
unsigned int refinement_level = 0,
1680 const
bool allow_merge = false,
1681 const
unsigned int max_boxes =
numbers::invalid_unsigned_int);
1710 template <
int spacedim>
1712 std::tuple<std::vector<std::vector<unsigned int>>,
1713 std::map<unsigned int, unsigned int>,
1714 std::map<unsigned int, std::vector<unsigned int>>>
1757 template <
int spacedim>
1759 std::tuple<std::map<unsigned int, std::vector<unsigned int>>,
1760 std::map<unsigned int, unsigned int>,
1761 std::map<unsigned int, std::vector<unsigned int>>>
1781 template <
int dim,
int spacedim>
1782 std::vector<std::vector<Tensor<1, spacedim>>>
1797 template <
int dim,
int spacedim>
1803 (ReferenceCells::get_hypercube<dim>()
1805 .
template get_default_linear_mapping<dim, spacedim>()
1807 .ReferenceCell::get_default_linear_mapping<dim, spacedim>()
1822 template <
int dim,
int spacedim>
1823 std::map<unsigned int, types::global_vertex_index>
1853 template <
int dim,
int spacedim>
1870 template <
int dim,
int spacedim>
1873 const std::vector<unsigned int> &cell_weights,
1923 template <
int dim,
int spacedim>
1941 template <
int dim,
int spacedim>
1944 const std::vector<unsigned int> &cell_weights,
1964 template <
int dim,
int spacedim>
1968 const bool group_siblings =
true);
1981 template <
int dim,
int spacedim>
1992 template <
int dim,
int spacedim>
1993 std::vector<types::subdomain_id>
1995 const std::vector<CellId> &cell_ids);
2007 template <
int dim,
int spacedim>
2010 std::vector<types::subdomain_id> &subdomain);
2026 template <
int dim,
int spacedim>
2061 template <
int dim,
int spacedim>
2091 template <
int dim,
int spacedim>
2149 template <
typename MeshType>
2152 const typename MeshType::active_cell_iterator &cell);
2176 template <
class Container>
2177 std::vector<typename Container::cell_iterator>
2179 const std::vector<typename Container::active_cell_iterator> &patch_cells);
2247 template <
class Container>
2250 const std::vector<typename Container::active_cell_iterator> &patch,
2252 &local_triangulation,
2255 Container::space_dimension>::active_cell_iterator,
2256 typename Container::active_cell_iterator> &patch_to_global_tria_map);
2289 template <
int dim,
int spacedim>
2292 std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>>
2310 template <
typename CellIterator>
2375 template <
typename FaceIterator>
2376 std::optional<types::geometric_orientation>
2378 const FaceIterator &face1,
2379 const FaceIterator &face2,
2380 const unsigned int direction,
2443 template <
typename MeshType>
2446 const MeshType &mesh,
2449 const unsigned int direction,
2481 template <
typename MeshType>
2484 const MeshType &mesh,
2485 const
types::boundary_id b_id,
2486 const
unsigned int direction,
2489 const ::
Tensor<1, MeshType::space_dimension> &offset =
2490 ::
Tensor<1, MeshType::space_dimension>(),
2519 template <
int dim,
int spacedim>
2522 const
bool reset_boundary_ids = false);
2545 template <
int dim,
int spacedim>
2548 const
std::vector<
types::boundary_id> &src_boundary_ids,
2549 const
std::vector<
types::manifold_id> &dst_manifold_ids,
2551 const
std::vector<
types::boundary_id> &reset_boundary_ids = {});
2582 template <
int dim,
int spacedim>
2585 const bool compute_face_ids =
false);
2611 template <
int dim,
int spacedim>
2616 const std::set<types::manifold_id> &)> &disambiguation_function =
2617 [](
const std::set<types::manifold_id> &manifold_ids) {
2618 if (manifold_ids.size() == 1)
2619 return *manifold_ids.begin();
2623 bool overwrite_only_flat_manifold_ids =
true);
2712 template <
typename DataType,
typename MeshType>
2715 const MeshType &mesh,
2716 const
std::function<
std::optional<DataType>(
2717 const typename MeshType::active_cell_iterator &)> &pack,
2718 const
std::function<
void(const typename MeshType::active_cell_iterator &,
2719 const DataType &)> &unpack,
2720 const
std::function<
bool(const typename MeshType::active_cell_iterator &)>
2722 always_return<typename MeshType::active_cell_iterator,
bool>{
true});
2736 template <
typename DataType,
typename MeshType>
2739 const MeshType &mesh,
2740 const
std::function<
std::optional<DataType>(
2741 const typename MeshType::level_cell_iterator &)> &pack,
2742 const
std::function<
void(const typename MeshType::level_cell_iterator &,
2743 const DataType &)> &unpack,
2744 const
std::function<
bool(const typename MeshType::level_cell_iterator &)> &
2745 cell_filter =
always_return<typename MeshType::level_cell_iterator,
bool>{
2759 template <
int spacedim>
2760 std::vector<std::vector<BoundingBox<spacedim>>>
2797 template <
int spacedim>
2820 template <
int dim,
int spacedim>
2824 std::map<
unsigned int, std::vector<unsigned int>> &coinciding_vertex_groups,
2825 std::map<unsigned int, unsigned int> &vertex_to_coinciding_vertex_group);
2846 template <
int dim,
int spacedim>
2847 std::map<unsigned int, std::set<::types::subdomain_id>>
2871 template <
int dim,
typename VectorType>
2900 const VectorType &ls_vector,
2901 const double iso_level,
2911 const VectorType &ls_vector,
2912 const double iso_level,
2926 const VectorType &ls_vector,
2927 const double iso_level,
2937 const VectorType &ls_vector,
2938 const double iso_level,
2955 const double iso_level,
2958 const bool write_back_cell_data =
true)
const;
2966 const std::vector<unsigned int> &,
2983 const std::vector<
Point<2>> &points,
2984 const std::vector<unsigned int> &mask,
2985 const double iso_level,
2988 const bool write_back_cell_data)
const;
2995 const std::vector<
Point<3>> &points,
2996 const std::vector<unsigned int> &mask,
2997 const double iso_level,
3000 const bool write_back_cell_data)
const;
3033 <<
"The number of partitions you gave is " << arg1
3034 <<
", but must be greater than zero.");
3040 <<
"The subdomain id " << arg1
3041 <<
" has no cells associated with it.");
3052 <<
"The scaling factor must be positive, but it is " << arg1
3060 <<
"The given vertex with index " << arg1
3061 <<
" is not used in the given triangulation.");
3100 template <
int dim,
typename Transformation,
int spacedim>
3103 std::assignable_from<
3106 void
transform(const Transformation &transformation,
3109 std::vector<bool> treated_vertices(
triangulation.n_vertices(),
false);
3120 for (; cell != endc; ++cell)
3122 if (treated_vertices[cell->vertex_index(v)] == false)
3125 cell->vertex(v) = transformation(cell->vertex(v));
3127 treated_vertices[cell->vertex_index(v)] =
true;
3137 for (; cell != endc; ++cell)
3138 for (
const unsigned int face : cell->face_indices())
3139 if (cell->face(face)->has_children() &&
3140 !cell->face(face)->at_boundary())
3142 Assert(cell->reference_cell() ==
3143 ReferenceCells::get_hypercube<dim>(),
3147 cell->face(face)->child(0)->vertex(1) =
3148 (cell->face(face)->vertex(0) + cell->face(face)->vertex(1)) /
3157 for (; cell != endc; ++cell)
3158 for (
const unsigned int face : cell->face_indices())
3159 if (cell->face(face)->has_children() &&
3160 !cell->face(face)->at_boundary())
3162 if (
static_cast<uint8_t
>(cell->face(face)->refinement_case()) ==
3165 Assert(cell->reference_cell() ==
3166 ReferenceCells::get_hypercube<dim>(),
3170 cell->face(face)->child(0)->vertex(1) =
3171 (cell->face(face)->vertex(0) +
3172 cell->face(face)->vertex(1)) /
3174 cell->face(face)->child(0)->vertex(2) =
3175 (cell->face(face)->vertex(0) +
3176 cell->face(face)->vertex(2)) /
3178 cell->face(face)->child(1)->vertex(3) =
3179 (cell->face(face)->vertex(1) +
3180 cell->face(face)->vertex(3)) /
3182 cell->face(face)->child(2)->vertex(3) =
3183 (cell->face(face)->vertex(2) +
3184 cell->face(face)->vertex(3)) /
3188 cell->face(face)->child(0)->vertex(3) =
3189 (cell->face(face)->vertex(0) +
3190 cell->face(face)->vertex(1) +
3191 cell->face(face)->vertex(2) +
3192 cell->face(face)->vertex(3)) /
3198 for (
unsigned int line = 0;
3201 if (cell->face(face)->line(line)->has_children())
3202 cell->face(face)->line(line)->child(0)->vertex(1) =
3203 (cell->face(face)->line(line)->vertex(0) +
3204 cell->face(face)->line(line)->vertex(1)) /
3216 template <
typename MeshType>
3219 const typename MeshType::cell_iterator &cell)
3221 std::vector<typename MeshType::active_cell_iterator> child_cells;
3223 if (cell->has_children())
3225 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3226 if (cell->child(child)->has_children())
3228 const std::vector<typename MeshType::active_cell_iterator>
3229 children = get_active_child_cells<MeshType>(cell->child(child));
3230 child_cells.insert(child_cells.end(),
3235 child_cells.push_back(cell->child(child));
3243 template <
typename MeshType>
3246 const typename MeshType::active_cell_iterator &cell,
3247 std::vector<typename MeshType::active_cell_iterator> &active_neighbors)
3249 active_neighbors.clear();
3250 for (
const unsigned int n : cell->face_indices())
3251 if (!cell->at_boundary(n))
3253 if (MeshType::dimension == 1)
3260 typename MeshType::cell_iterator neighbor_child =
3262 if (!neighbor_child->is_active())
3264 while (neighbor_child->has_children())
3265 neighbor_child = neighbor_child->child(n == 0 ? 1 : 0);
3267 Assert(neighbor_child->neighbor(n == 0 ? 1 : 0) == cell,
3270 active_neighbors.push_back(neighbor_child);
3274 if (cell->face(n)->has_children())
3278 for (
unsigned int c = 0;
3279 c < cell->face(n)->n_active_descendants();
3281 active_neighbors.push_back(
3282 cell->neighbor_child_on_subface(n, c));
3288 active_neighbors.push_back(cell->neighbor(n));
3296 template <
typename CellIterator>
3300 return sizeof(*this) +
matrix.memory_consumption();
3307 template <
typename DataType,
3309 typename MeshCellIteratorType>
3311 inline void exchange_cell_data(
3312 const MeshType &mesh,
3313 const std::function<std::optional<DataType>(
const MeshCellIteratorType &)>
3315 const std::function<
void(
const MeshCellIteratorType &,
const DataType &)>
3317 const std::function<
bool(
const MeshCellIteratorType &)> &cell_filter,
3318 const std::function<
void(
3319 const std::function<
void(
const MeshCellIteratorType &,
3321 const std::function<std::set<types::subdomain_id>(
3323 MeshType::space_dimension> &)>
3324 &compute_ghost_owners)
3326# ifndef DEAL_II_WITH_MPI
3331 (void)process_cells;
3332 (void)compute_ghost_owners;
3335 constexpr int dim = MeshType::dimension;
3336 constexpr int spacedim = MeshType::space_dimension;
3339 &mesh.get_triangulation());
3343 "The function exchange_cell_data_to_ghosts() only works with parallel triangulations."));
3345 if (
const auto tria =
dynamic_cast<
3347 &mesh.get_triangulation()))
3350 tria->with_artificial_cells(),
3352 "The functions GridTools::exchange_cell_data_to_ghosts() and "
3353 "GridTools::exchange_cell_data_to_level_ghosts() can only "
3354 "operate on a single layer of ghost cells. However, you have "
3355 "given a Triangulation object of type "
3356 "parallel::shared::Triangulation without artificial cells "
3357 "resulting in an arbitrary number of ghost layers. "
3358 "To use this function for a Triangulation object of type "
3359 "parallel::shared::Triangulation, make sure to create the "
3360 "Triangulation object with allow_artificial_cells set to true. "
3361 "This results in a parallel::shared::Triangulation with only "
3362 "a single layer of ghost cells."));
3366 std::set<::types::subdomain_id> ghost_owners =
3367 compute_ghost_owners(*tria);
3369 std::vector<typename CellId::binary_type>>
3372 for (
const auto ghost_owner : ghost_owners)
3373 neighbor_cell_list[ghost_owner] = {};
3375 process_cells([&](
const auto &cell,
const auto key) ->
void {
3376 if (cell_filter(cell))
3378 constexpr int spacedim = MeshType::space_dimension;
3379 neighbor_cell_list[key].emplace_back(
3380 cell->id().template to_binary<spacedim>());
3384 Assert(ghost_owners.size() == neighbor_cell_list.size(),
3396 const int mpi_tag_reply =
3400 std::vector<MPI_Request> requests(ghost_owners.size());
3402 unsigned int idx = 0;
3403 for (
const auto &it : neighbor_cell_list)
3406 const int ierr = MPI_Isend(it.second.data(),
3407 it.second.size() *
sizeof(it.second[0]),
3419 std::vector<MPI_Request> reply_requests(ghost_owners.size());
3420 std::vector<std::vector<char>> sendbuffers(ghost_owners.size());
3422 for (
unsigned int idx = 0; idx < ghost_owners.size(); ++idx)
3425 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3432 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3439 std::vector<typename CellId::binary_type> cells_with_requests(
3441 std::vector<DataType> data_to_send;
3442 data_to_send.reserve(n_cells);
3443 std::vector<bool> cell_carries_data(n_cells,
false);
3445 ierr = MPI_Recv(cells_with_requests.data(),
3455 for (
unsigned int c = 0; c < static_cast<unsigned int>(n_cells); ++c)
3460 MeshCellIteratorType mesh_it(tria,
3465 const std::optional<DataType>
data =
pack(mesh_it);
3468 data_to_send.emplace_back(*
data);
3469 cell_carries_data[c] =
true;
3477 sendbuffers[idx].resize(
sizeof(std::size_t));
3482 std::size_t size_of_send =
3486 std::memcpy(sendbuffers[idx].
data(),
3488 sizeof(std::size_t));
3492 if (data_to_send.size() < n_cells)
3498 ierr = MPI_Isend(sendbuffers[idx].
data(),
3499 sendbuffers[idx].
size(),
3504 &reply_requests[idx]);
3509 std::vector<char> receive;
3510 for (
unsigned int id = 0;
id < neighbor_cell_list.size(); ++id)
3513 int ierr = MPI_Probe(MPI_ANY_SOURCE,
3520 ierr = MPI_Get_count(&status, MPI_BYTE, &len);
3523 receive.resize(len);
3525 ierr = MPI_Recv(receive.data(),
3536 auto data_iterator = receive.begin();
3537 std::size_t size_of_received_data =
3538 Utilities::unpack<std::size_t>(data_iterator,
3539 data_iterator +
sizeof(std::size_t));
3540 data_iterator +=
sizeof(std::size_t);
3543 auto received_data = Utilities::unpack<std::vector<DataType>>(
3545 data_iterator + size_of_received_data,
3547 data_iterator += size_of_received_data;
3552 const std::vector<typename CellId::binary_type> &this_cell_list =
3553 neighbor_cell_list[status.MPI_SOURCE];
3555 std::vector<bool> cells_with_data;
3556 if (received_data.size() < this_cell_list.size())
3558 cells_with_data = Utilities::unpack<std::vector<bool>>(
3559 data_iterator, receive.end(),
false);
3565 auto received_data_iterator = received_data.begin();
3566 for (
unsigned int c = 0; c < this_cell_list.size(); ++c)
3567 if (cells_with_data.empty() || cells_with_data[c])
3572 MeshCellIteratorType cell(tria,
3577 unpack(cell, *received_data_iterator);
3578 ++received_data_iterator;
3584 if (requests.size() > 0)
3587 MPI_Waitall(requests.size(), requests.data(), MPI_STATUSES_IGNORE);
3590 if (reply_requests.size() > 0)
3592 const int ierr = MPI_Waitall(reply_requests.size(),
3593 reply_requests.data(),
3594 MPI_STATUSES_IGNORE);
3604 template <
typename DataType,
typename MeshType>
3607 const MeshType &mesh,
3608 const std::function<std::optional<DataType>(
3609 const typename MeshType::active_cell_iterator &)> &pack,
3610 const std::function<
void(
const typename MeshType::active_cell_iterator &,
3611 const DataType &)> &unpack,
3612 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
3615# ifndef DEAL_II_WITH_MPI
3622 internal::exchange_cell_data<DataType,
3624 typename MeshType::active_cell_iterator>(
3629 [&](
const auto &process) {
3630 for (
const auto &cell : mesh.active_cell_iterators())
3631 if (cell->is_ghost())
3634 [](
const auto &tria) {
return tria.ghost_owners(); });
3640 template <
typename DataType,
typename MeshType>
3643 const MeshType &mesh,
3644 const std::function<std::optional<DataType>(
3645 const typename MeshType::level_cell_iterator &)> &pack,
3646 const std::function<
void(
const typename MeshType::level_cell_iterator &,
3647 const DataType &)> &unpack,
3648 const std::function<
bool(
const typename MeshType::level_cell_iterator &)>
3651# ifndef DEAL_II_WITH_MPI
3658 internal::exchange_cell_data<DataType,
3660 typename MeshType::level_cell_iterator>(
3665 [&](
const auto &process) {
3666 for (
const auto &cell : mesh.cell_iterators())
3667 if (cell->is_ghost_on_level())
3668 process(cell, cell->level_subdomain_id());
3670 [](
const auto &tria) {
return tria.level_ghost_owners(); });
std::array< unsigned int, 4 > binary_type
Abstract base class for mapping classes.
cell_iterator create_cell_iterator(const CellId &cell_id) const
virtual MPI_Comm get_mpi_communicator() const
typename MeshType::active_cell_iterator type
#define DEAL_II_DEPRECATED
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define DeclException0(Exception0)
static ::ExceptionBase & ExcNotImplemented()
static ::ExceptionBase & ExcNeedsMPI()
static ::ExceptionBase & ExcNonExistentSubdomain(int arg1)
#define Assert(cond, exc)
static ::ExceptionBase & ExcVertexNotUsed(unsigned int arg1)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcTriangulationHasBeenRefined()
#define DeclException1(Exception1, type1, outsequence)
static ::ExceptionBase & ExcInvalidNumberOfPartitions(int arg1)
static ::ExceptionBase & ExcMessage(std::string arg1)
static ::ExceptionBase & ExcScalingFactorNotPositive(double arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::active_cell_iterator active_cell_iterator
void copy_boundary_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool reset_boundary_ids=false)
void copy_material_to_manifold_id(Triangulation< dim, spacedim > &tria, const bool compute_face_ids=false)
void map_boundary_to_manifold_ids(const std::vector< types::boundary_id > &src_boundary_ids, const std::vector< types::manifold_id > &dst_manifold_ids, Triangulation< dim, spacedim > &tria, const std::vector< types::boundary_id > &reset_boundary_ids={})
void assign_co_dimensional_manifold_indicators(Triangulation< dim, spacedim > &tria, const std::function< types::manifold_id(const std::set< types::manifold_id > &)> &disambiguation_function=[](const std::set< types::manifold_id > &manifold_ids) { if(manifold_ids.size()==1) return *manifold_ids.begin();else return numbers::flat_manifold_id;}, bool overwrite_only_flat_manifold_ids=true)
std::vector< index_type > data
@ matrix
Contents is actually a matrix.
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
unsigned int n_cells(const internal::TriangulationImplementation::NumberCache< 1 > &c)
const types::manifold_id flat_manifold_id
unsigned int global_dof_index
unsigned int subdomain_id
unsigned char geometric_orientation
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
boost::geometry::index::rtree< LeafType, IndexType, IndexableGetter > RTree