16 #include <deal.II/base/geometry_info.h> 17 #include <deal.II/base/point.h> 18 #include <deal.II/base/tensor.h> 20 #include <deal.II/distributed/shared_tria.h> 21 #include <deal.II/distributed/tria.h> 23 #include <deal.II/dofs/dof_accessor.h> 24 #include <deal.II/dofs/dof_handler.h> 26 #include <deal.II/fe/mapping_q1.h> 27 #include <deal.II/fe/mapping_q_generic.h> 29 #include <deal.II/grid/filtered_iterator.h> 30 #include <deal.II/grid/grid_tools.h> 31 #include <deal.II/grid/tria.h> 32 #include <deal.II/grid/tria_accessor.h> 33 #include <deal.II/grid/tria_iterator.h> 35 #include <deal.II/hp/dof_handler.h> 36 #include <deal.II/hp/mapping_collection.h> 38 #include <deal.II/lac/full_matrix.h> 50 DEAL_II_NAMESPACE_OPEN
54 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
58 const std::vector<bool> & marked_vertices)
66 const std::vector<Point<spacedim>> &vertices = tria.
get_vertices();
69 marked_vertices.size() == 0,
71 marked_vertices.size()));
81 marked_vertices.size() == 0 ||
82 std::equal(marked_vertices.begin(),
83 marked_vertices.end(),
85 [](
bool p,
bool q) {
return !p || q; }),
87 "marked_vertices should be a subset of used vertices in the triangulation " 88 "but marked_vertices contains one or more vertices that are not used vertices!"));
96 const std::vector<bool> &used = (marked_vertices.size() == 0) ?
102 std::vector<bool>::const_iterator first =
103 std::find(used.begin(), used.end(),
true);
109 unsigned int best_vertex = std::distance(used.begin(), first);
110 double best_dist = (p - vertices[best_vertex]).norm_square();
114 for (
unsigned int j = best_vertex + 1; j < vertices.size(); j++)
117 double dist = (p - vertices[j]).norm_square();
118 if (dist < best_dist)
130 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
133 const MeshType<dim, spacedim> &mesh,
135 const std::vector<bool> & marked_vertices)
150 marked_vertices.size() == 0,
152 marked_vertices.size()));
162 marked_vertices.size() == 0 ||
163 std::equal(marked_vertices.begin(),
164 marked_vertices.end(),
166 [](
bool p,
bool q) {
return !p || q; }),
168 "marked_vertices should be a subset of used vertices in the triangulation " 169 "but marked_vertices contains one or more vertices that are not used vertices!"));
172 if (marked_vertices.size())
173 for (
auto it = vertices.begin(); it != vertices.end();)
175 if (marked_vertices[it->first] ==
false)
177 vertices.erase(it++);
190 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
192 std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
195 typename ::internal::
196 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>
199 const unsigned int vertex)
204 Assert(vertex < mesh.get_triangulation().n_vertices(),
205 ExcIndexRange(0, mesh.get_triangulation().n_vertices(), vertex));
206 Assert(mesh.get_triangulation().get_used_vertices()[vertex],
213 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>
216 typename ::internal::
217 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
218 cell = mesh.begin_active(),
254 for (; cell != endc; ++cell)
256 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; v++)
257 if (cell->vertex_index(v) == vertex)
262 adjacent_cells.insert(cell);
269 for (
unsigned int vface = 0; vface < dim; vface++)
271 const unsigned int face =
274 if (!cell->at_boundary(face) &&
275 cell->neighbor(face)->active())
287 adjacent_cells.insert(cell->neighbor(face));
298 for (
unsigned int e = 0; e < GeometryInfo<dim>::lines_per_cell; ++
e)
299 if (cell->line(e)->has_children())
303 if (cell->line(e)->child(0)->vertex_index(1) == vertex)
305 adjacent_cells.insert(cell);
327 typename ::internal::
328 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>(
329 adjacent_cells.begin(), adjacent_cells.end());
336 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
338 find_active_cell_around_point_internal(
339 const MeshType<dim, spacedim> &mesh,
341 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>
343 std::set<
typename MeshType<dim, spacedim>::active_cell_iterator>
347 typename ::internal::
348 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>
351 typename ::internal::
352 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type>
357 using cell_iterator =
358 typename MeshType<dim, spacedim>::active_cell_iterator;
360 using cell_iterator = typename ::internal::
361 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type;
365 searched_cells.insert(adjacent_cells.begin(), adjacent_cells.end());
369 std::set<cell_iterator> adjacent_cells_new;
371 typename std::set<cell_iterator>::const_iterator cell =
372 adjacent_cells.begin(),
374 adjacent_cells.end();
375 for (; cell != endc; ++cell)
377 std::vector<cell_iterator> active_neighbors;
378 get_active_neighbors<MeshType<dim, spacedim>>(*cell,
380 for (
unsigned int i = 0; i < active_neighbors.size(); ++i)
381 if (searched_cells.find(active_neighbors[i]) ==
382 searched_cells.end())
383 adjacent_cells_new.insert(active_neighbors[i]);
385 adjacent_cells.clear();
386 adjacent_cells.insert(adjacent_cells_new.begin(),
387 adjacent_cells_new.end());
388 if (adjacent_cells.size() == 0)
396 cell_iterator it = mesh.begin_active();
397 for (; it != mesh.end(); ++it)
398 if (searched_cells.find(it) == searched_cells.end())
400 adjacent_cells.insert(it);
408 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
410 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
414 typename ::internal::
415 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
418 find_active_cell_around_point_tolerance(
420 const MeshType<dim, spacedim> &mesh,
422 const std::vector<bool> & marked_vertices,
423 const double tolerance)
425 using active_cell_iterator = typename ::internal::
426 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type;
432 double best_distance = tolerance;
434 std::pair<active_cell_iterator, Point<dim>> best_cell;
438 std::vector<active_cell_iterator> adjacent_cells_tmp =
447 std::set<active_cell_iterator> adjacent_cells(adjacent_cells_tmp.begin(),
448 adjacent_cells_tmp.end());
449 std::set<active_cell_iterator> searched_cells;
457 const unsigned int n_active_cells =
458 mesh.get_triangulation().n_active_cells();
460 unsigned int cells_searched = 0;
461 while (!found && cells_searched < n_active_cells)
463 typename std::set<active_cell_iterator>::const_iterator
464 cell = adjacent_cells.begin(),
465 endc = adjacent_cells.end();
466 for (; cell != endc; ++cell)
482 if ((dist < best_distance) ||
483 ((dist == best_distance) &&
484 ((*cell)->level() > best_level)))
487 best_distance = dist;
488 best_level = (*cell)->level();
489 best_cell = std::make_pair(*cell, p_cell);
511 cells_searched += adjacent_cells.size();
516 if (marked_vertices.size() > 0)
517 cells_searched = n_active_cells;
526 if (!found && cells_searched < n_active_cells)
528 find_active_cell_around_point_internal<dim, MeshType, spacedim>(
529 mesh, searched_cells, adjacent_cells);
534 ExcPointNotFound<spacedim>(p));
542 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
544 typename MeshType<dim, spacedim>::active_cell_iterator
546 typename ::internal::
547 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type
551 const std::vector<bool> & marked_vertices)
553 return find_active_cell_around_point<dim, MeshType, spacedim>(
560 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
562 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
Point<dim>>
564 std::pair<typename ::internal::
565 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
569 const MeshType<dim, spacedim> &mesh,
571 const std::vector<bool> & marked_vertices)
573 return find_active_cell_around_point_tolerance(
574 mapping, mesh, p, marked_vertices, 1e-10);
579 template <
int dim,
template <
int,
int>
class MeshType,
int spacedim>
581 std::vector<std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
584 std::vector<std::pair<
585 typename ::internal::
586 ActiveCellIterator<dim, spacedim, MeshType<dim, spacedim>>::type,
590 const MeshType<dim, spacedim> &mesh,
592 const double tolerance,
593 const std::vector<bool> &marked_vertices)
601 std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
606 cells_and_points.push_back(find_active_cell_around_point_tolerance(
607 mapping, mesh, p, marked_vertices, tolerance));
609 catch (ExcPointNotFound<spacedim> &)
612 if (!cells_and_points.empty())
616 const Point<dim> unit_point = cells_and_points.front().second;
617 const auto my_cell = cells_and_points.front().first;
619 unsigned int n_dirs_at_threshold = 0;
621 for (
unsigned int d = 0; d < dim; ++d)
623 distance_to_center[d] = std::abs(unit_point[d] - 0.5);
624 if (distance_to_center[d] > 0.5 - tolerance)
626 ++n_dirs_at_threshold;
627 last_point_at_threshold = d;
631 std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
634 if (n_dirs_at_threshold == 1)
636 unsigned int neighbor_index =
637 2 * last_point_at_threshold +
638 (unit_point[last_point_at_threshold] > 0.5 ? 1 : 0);
639 if (!my_cell->at_boundary(neighbor_index))
640 cells_to_add.push_back(my_cell->neighbor(neighbor_index));
643 else if (n_dirs_at_threshold == dim)
645 unsigned int local_vertex_index = 0;
646 for (
unsigned int d = 0; d < dim; ++d)
647 local_vertex_index += (unit_point[d] > 0.5 ? 1 : 0) << d;
648 std::vector<typename MeshType<dim, spacedim>::active_cell_iterator>
650 mesh, my_cell->vertex_index(local_vertex_index));
651 for (
const auto &cell : cells)
653 cells_to_add.push_back(cell);
660 else if (n_dirs_at_threshold == 2)
662 std::pair<unsigned int, unsigned int> vertex_indices[3];
663 unsigned int count_vertex_indices = 0;
665 for (
unsigned int d = 0; d < dim; ++d)
667 if (distance_to_center[d] > 0.5 - tolerance)
669 vertex_indices[count_vertex_indices].first = d;
670 vertex_indices[count_vertex_indices].second =
671 unit_point[d] > 0.5 ? 1 : 0;
672 count_vertex_indices++;
682 const unsigned int first_vertex =
683 (vertex_indices[0].second << vertex_indices[0].first) +
684 (vertex_indices[1].second << vertex_indices[1].first);
685 for (
unsigned int d = 0; d < 2; ++d)
689 my_cell->vertex_index(first_vertex + (d << free_direction)));
690 for (
const auto &cell : tentative_cells)
692 bool cell_not_yet_present =
true;
693 for (
const auto &other_cell : cells_to_add)
694 if (cell == other_cell)
696 cell_not_yet_present =
false;
699 if (cell_not_yet_present)
700 cells_to_add.push_back(cell);
705 const double original_distance_to_unit_cell =
707 for (
const auto &cell : cells_to_add)
715 original_distance_to_unit_cell + tolerance)
716 cells_and_points.emplace_back(cell, p_unit);
723 cells_and_points.begin(),
724 cells_and_points.end(),
725 [](
const std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
727 const std::pair<typename MeshType<dim, spacedim>::active_cell_iterator,
728 Point<dim>> &b) {
return a.first < b.first; });
730 return cells_and_points;
735 template <
class MeshType>
736 std::vector<typename MeshType::active_cell_iterator>
738 const MeshType &mesh,
739 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
742 std::vector<typename MeshType::active_cell_iterator> active_halo_layer;
743 std::vector<bool> locally_active_vertices_on_subdomain(
744 mesh.get_triangulation().n_vertices(),
false);
749 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
753 for (
unsigned int v = 0;
754 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
756 locally_active_vertices_on_subdomain[cell->vertex_index(v)] =
true;
761 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
764 if (!predicate(cell))
765 for (
unsigned int v = 0;
766 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
768 if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
771 active_halo_layer.push_back(cell);
775 return active_halo_layer;
780 template <
class MeshType>
781 std::vector<typename MeshType::cell_iterator>
783 const MeshType &mesh,
784 const std::function<
bool(
const typename MeshType::cell_iterator &)>
786 const unsigned int level)
788 std::vector<typename MeshType::cell_iterator> level_halo_layer;
789 std::vector<bool> locally_active_vertices_on_level_subdomain(
790 mesh.get_triangulation().n_vertices(),
false);
795 for (
typename MeshType::cell_iterator cell = mesh.begin(level);
796 cell != mesh.end(level);
799 for (
unsigned int v = 0;
800 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
802 locally_active_vertices_on_level_subdomain[cell->vertex_index(v)] =
808 for (
typename MeshType::cell_iterator cell = mesh.begin(level);
809 cell != mesh.end(level);
811 if (!predicate(cell))
812 for (
unsigned int v = 0;
813 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
815 if (locally_active_vertices_on_level_subdomain[cell->vertex_index(
818 level_halo_layer.push_back(cell);
822 return level_halo_layer;
828 template <
class MeshType>
830 contains_locally_owned_cells(
831 const std::vector<typename MeshType::active_cell_iterator> &cells)
833 for (
typename std::vector<
834 typename MeshType::active_cell_iterator>::const_iterator it =
839 if ((*it)->is_locally_owned())
845 template <
class MeshType>
847 contains_artificial_cells(
848 const std::vector<typename MeshType::active_cell_iterator> &cells)
850 for (
typename std::vector<
851 typename MeshType::active_cell_iterator>::const_iterator it =
856 if ((*it)->is_artificial())
865 template <
class MeshType>
866 std::vector<typename MeshType::active_cell_iterator>
869 std::function<bool(const typename MeshType::active_cell_iterator &)>
872 const std::vector<typename MeshType::active_cell_iterator>
877 Assert(contains_locally_owned_cells<MeshType>(active_halo_layer) ==
false,
878 ExcMessage(
"Halo layer contains locally owned cells"));
879 Assert(contains_artificial_cells<MeshType>(active_halo_layer) ==
false,
880 ExcMessage(
"Halo layer contains artificial cells"));
882 return active_halo_layer;
887 template <
class MeshType>
888 std::vector<typename MeshType::active_cell_iterator>
890 const MeshType &mesh,
891 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
893 const double layer_thickness)
895 std::vector<typename MeshType::active_cell_iterator>
896 subdomain_boundary_cells, active_cell_layer_within_distance;
897 std::vector<bool> vertices_outside_subdomain(
898 mesh.get_triangulation().n_vertices(),
false);
900 const unsigned int spacedim = MeshType::space_dimension;
902 unsigned int n_non_predicate_cells = 0;
910 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
913 if (!predicate(cell))
915 for (
unsigned int v = 0;
916 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
918 vertices_outside_subdomain[cell->vertex_index(v)] =
true;
919 n_non_predicate_cells++;
926 if (n_non_predicate_cells == 0 ||
927 n_non_predicate_cells == mesh.get_triangulation().n_active_cells())
928 return std::vector<typename MeshType::active_cell_iterator>();
932 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
937 for (
unsigned int v = 0;
938 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
940 if (vertices_outside_subdomain[cell->vertex_index(v)] ==
true)
942 subdomain_boundary_cells.push_back(cell);
952 const double DOUBLE_EPSILON = 100. * std::numeric_limits<double>::epsilon();
955 for (
unsigned int d = 0; d < spacedim; ++d)
957 bounding_box.first[d] -= (layer_thickness + DOUBLE_EPSILON);
958 bounding_box.second[d] += (layer_thickness + DOUBLE_EPSILON);
961 std::vector<Point<spacedim>>
962 subdomain_boundary_cells_centers;
965 subdomain_boundary_cells_radii;
967 subdomain_boundary_cells_centers.reserve(subdomain_boundary_cells.size());
968 subdomain_boundary_cells_radii.reserve(subdomain_boundary_cells.size());
970 for (
typename std::vector<typename MeshType::active_cell_iterator>::
971 const_iterator subdomain_boundary_cell_iterator =
972 subdomain_boundary_cells.begin();
973 subdomain_boundary_cell_iterator != subdomain_boundary_cells.end();
974 ++subdomain_boundary_cell_iterator)
976 const std::pair<Point<spacedim>,
double>
977 &subdomain_boundary_cell_enclosing_ball =
978 (*subdomain_boundary_cell_iterator)->enclosing_ball();
980 subdomain_boundary_cells_centers.push_back(
981 subdomain_boundary_cell_enclosing_ball.first);
982 subdomain_boundary_cells_radii.push_back(
983 subdomain_boundary_cell_enclosing_ball.second);
985 AssertThrow(subdomain_boundary_cells_radii.size() ==
986 subdomain_boundary_cells_centers.size(),
995 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
1000 if (predicate(cell))
1003 const std::pair<Point<spacedim>,
double> &cell_enclosing_ball =
1004 cell->enclosing_ball();
1007 cell_enclosing_ball.first;
1008 const double cell_enclosing_ball_radius = cell_enclosing_ball.second;
1010 bool cell_inside =
true;
1012 for (
unsigned int d = 0; d < spacedim; ++d)
1014 (cell_enclosing_ball_center[d] + cell_enclosing_ball_radius >
1015 bounding_box.first[d]) &&
1016 (cell_enclosing_ball_center[d] - cell_enclosing_ball_radius <
1017 bounding_box.second[d]);
1023 for (
unsigned int i = 0; i < subdomain_boundary_cells_radii.size();
1026 subdomain_boundary_cells_centers[i]) <
1027 Utilities::fixed_power<2>(cell_enclosing_ball_radius +
1028 subdomain_boundary_cells_radii[i] +
1029 layer_thickness + DOUBLE_EPSILON))
1031 active_cell_layer_within_distance.push_back(cell);
1036 return active_cell_layer_within_distance;
1041 template <
class MeshType>
1042 std::vector<typename MeshType::active_cell_iterator>
1044 const double layer_thickness)
1047 std::function<bool(const typename MeshType::active_cell_iterator &)>
1048 predicate(locally_owned_cell_predicate);
1050 const std::vector<typename MeshType::active_cell_iterator>
1051 ghost_cell_layer_within_distance =
1059 contains_locally_owned_cells<MeshType>(
1060 ghost_cell_layer_within_distance) ==
false,
1062 "Ghost cells within layer_thickness contains locally owned cells."));
1064 contains_artificial_cells<MeshType>(ghost_cell_layer_within_distance) ==
1067 "Ghost cells within layer_thickness contains artificial cells." 1068 "The function compute_ghost_cell_layer_within_distance " 1069 "is probably called while using parallel::distributed::Triangulation. " 1070 "In such case please refer to the description of this function."));
1072 return ghost_cell_layer_within_distance;
1077 template <
class MeshType>
1080 const MeshType &mesh,
1081 const std::function<
bool(
const typename MeshType::active_cell_iterator &)>
1084 std::vector<bool> locally_active_vertices_on_subdomain(
1085 mesh.get_triangulation().n_vertices(),
false);
1087 const unsigned int spacedim = MeshType::space_dimension;
1094 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
1097 if (predicate(cell))
1099 minp = cell->center();
1100 maxp = cell->center();
1106 for (
typename MeshType::active_cell_iterator cell = mesh.begin_active();
1109 if (predicate(cell))
1110 for (
unsigned int v = 0;
1111 v < GeometryInfo<MeshType::dimension>::vertices_per_cell;
1113 if (locally_active_vertices_on_subdomain[cell->vertex_index(v)] ==
1116 locally_active_vertices_on_subdomain[cell->vertex_index(v)] =
1118 for (
unsigned int d = 0; d < spacedim; ++d)
1120 minp[d] = std::min(minp[d], cell->vertex(v)[d]);
1121 maxp[d] = std::max(maxp[d], cell->vertex(v)[d]);
1125 return std::make_pair(minp, maxp);
1130 template <
typename MeshType>
1131 std::list<std::pair<
typename MeshType::cell_iterator,
1132 typename MeshType::cell_iterator>>
1136 ExcMessage(
"The two meshes must be represent triangulations that " 1137 "have the same coarse meshes"));
1144 bool remove_ghost_cells =
false;
1145 #ifdef DEAL_II_WITH_MPI 1147 constexpr
int dim = MeshType::dimension;
1148 constexpr
int spacedim = MeshType::space_dimension;
1150 *
>(&mesh_1.get_triangulation()) !=
nullptr ||
1152 *
>(&mesh_2.get_triangulation()) !=
nullptr)
1154 Assert(&mesh_1.get_triangulation() == &mesh_2.get_triangulation(),
1155 ExcMessage(
"This function can only be used with meshes " 1156 "corresponding to distributed Triangulations when " 1157 "both Triangulations are equal."));
1158 remove_ghost_cells =
true;
1170 using CellList = std::list<std::pair<
typename MeshType::cell_iterator,
1171 typename MeshType::cell_iterator>>;
1175 typename MeshType::cell_iterator cell_1 = mesh_1.begin(0),
1176 cell_2 = mesh_2.begin(0);
1177 for (; cell_1 != mesh_1.end(0); ++cell_1, ++cell_2)
1178 cell_list.emplace_back(cell_1, cell_2);
1181 typename CellList::iterator cell_pair = cell_list.begin();
1182 while (cell_pair != cell_list.end())
1186 if (cell_pair->first->has_children() &&
1187 cell_pair->second->has_children())
1189 Assert(cell_pair->first->refinement_case() ==
1190 cell_pair->second->refinement_case(),
1192 for (
unsigned int c = 0; c < cell_pair->first->n_children(); ++c)
1193 cell_list.emplace_back(cell_pair->first->child(c),
1194 cell_pair->second->child(c));
1199 const auto previous_cell_pair = cell_pair;
1201 cell_list.erase(previous_cell_pair);
1206 if (remove_ghost_cells &&
1207 ((cell_pair->first->active() &&
1208 !cell_pair->first->is_locally_owned()) ||
1209 (cell_pair->second->active() &&
1210 !cell_pair->second->is_locally_owned())))
1213 const auto previous_cell_pair = cell_pair;
1215 cell_list.erase(previous_cell_pair);
1224 for (cell_pair = cell_list.begin(); cell_pair != cell_list.end();
1226 Assert(cell_pair->first->active() || cell_pair->second->active() ||
1227 (cell_pair->first->refinement_case() !=
1228 cell_pair->second->refinement_case()),
1236 template <
int dim,
int spacedim>
1253 endc = mesh_1.
end(0);
1254 for (; cell_1 != endc; ++cell_1, ++cell_2)
1255 for (
unsigned int v = 0; v < GeometryInfo<dim>::vertices_per_cell; ++v)
1256 if (cell_1->vertex(v) != cell_2->vertex(v))
1268 template <
typename MeshType>
1273 mesh_2.get_triangulation());
1278 template <
int dim,
int spacedim>
1279 std::pair<typename hp::DoFHandler<dim, spacedim>::active_cell_iterator,
1288 ExcMessage(
"Mapping collection needs to have either size 1 " 1289 "or size equal to the number of elements in " 1290 "the FECollection."));
1292 using cell_iterator =
1295 std::pair<cell_iterator, Point<dim>> best_cell;
1299 if (mapping.
size() == 1)
1307 double best_distance = 1e-10;
1308 int best_level = -1;
1315 std::vector<cell_iterator> adjacent_cells_tmp =
1323 std::set<cell_iterator> adjacent_cells(adjacent_cells_tmp.begin(),
1324 adjacent_cells_tmp.end());
1325 std::set<cell_iterator> searched_cells;
1335 unsigned int cells_searched = 0;
1336 while (!found && cells_searched < n_cells)
1338 typename std::set<cell_iterator>::const_iterator
1339 cell = adjacent_cells.begin(),
1340 endc = adjacent_cells.end();
1341 for (; cell != endc; ++cell)
1346 mapping[(*cell)->active_fe_index()]
1347 .transform_real_to_unit_cell(*cell, p);
1359 if (dist < best_distance || (dist == best_distance &&
1360 (*cell)->level() > best_level))
1363 best_distance = dist;
1364 best_level = (*cell)->level();
1365 best_cell = std::make_pair(*cell, p_cell);
1370 spacedim>::ExcTransformationFailed &)
1386 cells_searched += adjacent_cells.size();
1392 if (!found && cells_searched < n_cells)
1394 find_active_cell_around_point_internal<dim,
1397 mesh, searched_cells, adjacent_cells);
1403 ExcPointNotFound<spacedim>(p));
1409 template <
class MeshType>
1410 std::vector<typename MeshType::active_cell_iterator>
1413 Assert(cell->is_locally_owned(),
1414 ExcMessage(
"This function only makes sense if the cell for " 1415 "which you are asking for a patch, is locally " 1418 std::vector<typename MeshType::active_cell_iterator> patch;
1419 patch.push_back(cell);
1420 for (
unsigned int face_number = 0;
1421 face_number < GeometryInfo<MeshType::dimension>::faces_per_cell;
1423 if (cell->face(face_number)->at_boundary() ==
false)
1425 if (cell->neighbor(face_number)->has_children() ==
false)
1426 patch.push_back(cell->neighbor(face_number));
1431 if (MeshType::dimension > 1)
1433 for (
unsigned int subface = 0;
1434 subface < cell->face(face_number)->n_children();
1437 cell->neighbor_child_on_subface(face_number, subface));
1443 typename MeshType::cell_iterator neighbor =
1444 cell->neighbor(face_number);
1445 while (neighbor->has_children())
1446 neighbor = neighbor->child(1 - face_number);
1448 Assert(neighbor->neighbor(1 - face_number) == cell,
1450 patch.push_back(neighbor);
1458 template <
class Container>
1459 std::vector<typename Container::cell_iterator>
1461 const std::vector<typename Container::active_cell_iterator> &patch)
1465 "Vector containing patch cells should not be an empty vector!"));
1469 int min_level = patch[0]->level();
1471 for (
unsigned int i = 0; i < patch.size(); ++i)
1472 min_level = std::min(min_level, patch[i]->level());
1473 std::set<typename Container::cell_iterator> uniform_cells;
1474 typename std::vector<
1475 typename Container::active_cell_iterator>::const_iterator patch_cell;
1477 for (patch_cell = patch.begin(); patch_cell != patch.end(); ++patch_cell)
1482 if ((*patch_cell)->level() == min_level)
1483 uniform_cells.insert(*patch_cell);
1490 typename Container::cell_iterator parent = *patch_cell;
1492 while (parent->level() > min_level)
1493 parent = parent->parent();
1494 uniform_cells.insert(parent);
1498 return std::vector<typename Container::cell_iterator>(uniform_cells.begin(),
1499 uniform_cells.end());
1504 template <
class Container>
1507 const std::vector<typename Container::active_cell_iterator> &patch,
1509 &local_triangulation,
1512 Container::space_dimension>::active_cell_iterator,
1513 typename Container::active_cell_iterator> &patch_to_global_tria_map)
1516 const std::vector<typename Container::cell_iterator> uniform_cells =
1517 get_cells_at_coarsest_common_level<Container>(patch);
1519 local_triangulation.
clear();
1520 std::vector<Point<Container::space_dimension>> vertices;
1521 const unsigned int n_uniform_cells = uniform_cells.size();
1522 std::vector<CellData<Container::dimension>> cells(n_uniform_cells);
1525 typename std::vector<typename Container::cell_iterator>::const_iterator
1527 for (uniform_cell = uniform_cells.begin();
1528 uniform_cell != uniform_cells.end();
1531 for (
unsigned int v = 0;
1532 v < GeometryInfo<Container::dimension>::vertices_per_cell;
1536 (*uniform_cell)->vertex(v);
1537 bool repeat_vertex =
false;
1539 for (
unsigned int m = 0; m < i; ++m)
1541 if (position == vertices[m])
1543 repeat_vertex =
true;
1544 cells[k].vertices[v] = m;
1548 if (repeat_vertex ==
false)
1550 vertices.push_back(position);
1551 cells[k].vertices[v] = i;
1562 unsigned int index = 0;
1565 Container::space_dimension>::cell_iterator,
1566 typename Container::cell_iterator>
1567 patch_to_global_tria_map_tmp;
1569 Container::space_dimension>::cell_iterator
1570 coarse_cell = local_triangulation.
begin();
1571 coarse_cell != local_triangulation.
end();
1572 ++coarse_cell, ++index)
1574 patch_to_global_tria_map_tmp.insert(
1575 std::make_pair(coarse_cell, uniform_cells[index]));
1579 Assert(coarse_cell->center().distance(uniform_cells[index]->center()) <=
1580 1e-15 * coarse_cell->diameter(),
1583 bool refinement_necessary;
1588 refinement_necessary =
false;
1590 Container::space_dimension>::
1591 active_cell_iterator active_tria_cell =
1593 active_tria_cell != local_triangulation.
end();
1596 if (patch_to_global_tria_map_tmp[active_tria_cell]->has_children())
1598 active_tria_cell->set_refine_flag();
1599 refinement_necessary =
true;
1602 for (
unsigned int i = 0; i < patch.size(); ++i)
1607 if (patch_to_global_tria_map_tmp[active_tria_cell] ==
1612 for (
unsigned int v = 0;
1614 Container::dimension>::vertices_per_cell;
1616 active_tria_cell->vertex(v) = patch[i]->vertex(v);
1618 Assert(active_tria_cell->center().distance(
1619 patch_to_global_tria_map_tmp[active_tria_cell]
1621 1e-15 * active_tria_cell->diameter(),
1624 active_tria_cell->set_user_flag();
1630 if (refinement_necessary)
1635 Container::dimension,
1636 Container::space_dimension>::cell_iterator cell =
1637 local_triangulation.
begin();
1638 cell != local_triangulation.
end();
1641 if (patch_to_global_tria_map_tmp.find(cell) !=
1642 patch_to_global_tria_map_tmp.end())
1644 if (cell->has_children())
1651 for (
unsigned int c = 0; c < cell->n_children(); ++c)
1653 if (patch_to_global_tria_map_tmp.find(cell->child(
1654 c)) == patch_to_global_tria_map_tmp.end())
1656 patch_to_global_tria_map_tmp.insert(
1659 patch_to_global_tria_map_tmp[cell]->child(
1681 patch_to_global_tria_map_tmp.erase(cell);
1687 while (refinement_necessary);
1693 Container::space_dimension>::cell_iterator
1694 cell = local_triangulation.
begin();
1695 cell != local_triangulation.
end();
1698 if (cell->user_flag_set())
1700 Assert(patch_to_global_tria_map_tmp.find(cell) !=
1701 patch_to_global_tria_map_tmp.end(),
1704 Assert(cell->center().distance(
1705 patch_to_global_tria_map_tmp[cell]->center()) <=
1706 1e-15 * cell->diameter(),
1714 Container::space_dimension>::cell_iterator,
1715 typename Container::cell_iterator>::iterator
1716 map_tmp_it = patch_to_global_tria_map_tmp.
begin(),
1717 map_tmp_end = patch_to_global_tria_map_tmp.end();
1721 for (; map_tmp_it != map_tmp_end; ++map_tmp_it)
1722 patch_to_global_tria_map[map_tmp_it->first] = map_tmp_it->second;
1727 template <
class DoFHandlerType>
1729 std::vector<typename DoFHandlerType::active_cell_iterator>>
1743 std::set<typename DoFHandlerType::active_cell_iterator>>
1744 dof_to_set_of_cells_map;
1746 std::vector<types::global_dof_index> local_dof_indices;
1747 std::vector<types::global_dof_index> local_face_dof_indices;
1748 std::vector<types::global_dof_index> local_line_dof_indices;
1752 std::vector<bool> user_flags;
1757 std::map<
typename DoFHandlerType::active_line_iterator,
1758 typename DoFHandlerType::line_iterator>
1759 lines_to_parent_lines_map;
1760 if (DoFHandlerType::dimension == 3)
1763 dof_handler.get_triangulation().save_user_flags(user_flags);
1765 DoFHandlerType::space_dimension
> &>(
1766 dof_handler.get_triangulation())
1767 .clear_user_flags();
1770 typename DoFHandlerType::active_cell_iterator cell = dof_handler
1772 endc = dof_handler.end();
1773 for (; cell != endc; ++cell)
1779 if (cell->is_artificial() ==
false)
1781 for (
unsigned int l = 0;
1785 if (cell->line(l)->has_children())
1786 for (
unsigned int c = 0; c < cell->line(l)->n_children();
1789 lines_to_parent_lines_map[cell->line(l)->child(c)] =
1793 cell->line(l)->child(c)->set_user_flag();
1806 typename DoFHandlerType::active_cell_iterator cell =
1807 dof_handler.begin_active(),
1808 endc = dof_handler.end();
1809 for (; cell != endc; ++cell)
1814 if (cell->is_artificial() ==
false)
1816 const unsigned int n_dofs_per_cell = cell->get_fe().dofs_per_cell;
1817 local_dof_indices.resize(n_dofs_per_cell);
1821 cell->get_dof_indices(local_dof_indices);
1822 for (
unsigned int i = 0; i < n_dofs_per_cell; ++i)
1823 dof_to_set_of_cells_map[local_dof_indices[i]].insert(cell);
1833 for (
unsigned int f = 0;
1834 f < GeometryInfo<DoFHandlerType::dimension>::faces_per_cell;
1837 if (cell->face(f)->has_children())
1839 for (
unsigned int c = 0; c < cell->face(f)->n_children();
1854 Assert(cell->face(f)->child(c)->has_children() ==
false,
1857 const unsigned int n_dofs_per_face =
1858 cell->get_fe().dofs_per_face;
1859 local_face_dof_indices.resize(n_dofs_per_face);
1861 cell->face(f)->child(c)->get_dof_indices(
1862 local_face_dof_indices);
1863 for (
unsigned int i = 0; i < n_dofs_per_face; ++i)
1864 dof_to_set_of_cells_map[local_face_dof_indices[i]]
1868 else if ((cell->face(f)->at_boundary() ==
false) &&
1869 (cell->neighbor_is_coarser(f)))
1886 std::pair<unsigned int, unsigned int>
1887 neighbor_face_no_subface_no =
1888 cell->neighbor_of_coarser_neighbor(f);
1889 unsigned int face_no = neighbor_face_no_subface_no.first;
1890 unsigned int subface = neighbor_face_no_subface_no.second;
1892 const unsigned int n_dofs_per_face =
1893 cell->get_fe().dofs_per_face;
1894 local_face_dof_indices.resize(n_dofs_per_face);
1896 cell->neighbor(f)->face(face_no)->get_dof_indices(
1897 local_face_dof_indices);
1898 for (
unsigned int i = 0; i < n_dofs_per_face; ++i)
1899 dof_to_set_of_cells_map[local_face_dof_indices[i]].insert(
1904 for (
unsigned int c = 0;
1905 c < cell->neighbor(f)->face(face_no)->n_children();
1911 const unsigned int n_dofs_per_face =
1912 cell->get_fe().dofs_per_face;
1913 local_face_dof_indices.resize(n_dofs_per_face);
1918 ->has_children() ==
false,
1923 ->get_dof_indices(local_face_dof_indices);
1924 for (
unsigned int i = 0; i < n_dofs_per_face; ++i)
1925 dof_to_set_of_cells_map[local_face_dof_indices[i]]
1940 if (DoFHandlerType::dimension == 3)
1942 for (
unsigned int l = 0;
1947 if (cell->line(l)->has_children())
1949 for (
unsigned int c = 0;
1950 c < cell->line(l)->n_children();
1953 Assert(cell->line(l)->child(c)->has_children() ==
1959 const unsigned int n_dofs_per_line =
1960 2 * cell->get_fe().dofs_per_vertex +
1961 cell->get_fe().dofs_per_line;
1962 local_line_dof_indices.resize(n_dofs_per_line);
1964 cell->line(l)->child(c)->get_dof_indices(
1965 local_line_dof_indices);
1966 for (
unsigned int i = 0; i < n_dofs_per_line; ++i)
1967 dof_to_set_of_cells_map[local_line_dof_indices[i]]
1975 else if (cell->line(l)->user_flag_set() ==
true)
1977 typename DoFHandlerType::line_iterator parent_line =
1978 lines_to_parent_lines_map[cell->line(l)];
1983 const unsigned int n_dofs_per_line =
1984 2 * cell->get_fe().dofs_per_vertex +
1985 cell->get_fe().dofs_per_line;
1986 local_line_dof_indices.resize(n_dofs_per_line);
1988 parent_line->get_dof_indices(local_line_dof_indices);
1989 for (
unsigned int i = 0; i < n_dofs_per_line; ++i)
1990 dof_to_set_of_cells_map[local_line_dof_indices[i]]
1993 for (
unsigned int c = 0; c < parent_line->n_children();
1996 Assert(parent_line->child(c)->has_children() ==
2000 const unsigned int n_dofs_per_line =
2001 2 * cell->get_fe().dofs_per_vertex +
2002 cell->get_fe().dofs_per_line;
2003 local_line_dof_indices.resize(n_dofs_per_line);
2005 parent_line->child(c)->get_dof_indices(
2006 local_line_dof_indices);
2007 for (
unsigned int i = 0; i < n_dofs_per_line; ++i)
2008 dof_to_set_of_cells_map[local_line_dof_indices[i]]
2018 if (DoFHandlerType::dimension == 3)
2024 DoFHandlerType::space_dimension
> &>(
2025 dof_handler.get_triangulation())
2026 .load_user_flags(user_flags);
2032 std::vector<typename DoFHandlerType::active_cell_iterator>>
2033 dof_to_cell_patches;
2036 std::set<typename DoFHandlerType::active_cell_iterator>>::
2037 iterator it = dof_to_set_of_cells_map.begin(),
2038 it_end = dof_to_set_of_cells_map.end();
2039 for (; it != it_end; ++it)
2040 dof_to_cell_patches[it->first].assign(it->second.begin(),
2043 return dof_to_cell_patches;
2049 template <
typename CellIterator>
2051 match_periodic_face_pairs(
2052 std::set<std::pair<CellIterator, unsigned int>> &pairs1,
2053 std::set<std::pair<
typename identity<CellIterator>::type,
unsigned int>>
2055 const int direction,
2056 std::vector<PeriodicFacePair<CellIterator>> &matched_pairs,
2057 const ::Tensor<1, CellIterator::AccessorType::space_dimension>
2061 static const int space_dim = CellIterator::AccessorType::space_dimension;
2063 Assert(0 <= direction && direction < space_dim,
2066 Assert(pairs1.size() == pairs2.size(),
2067 ExcMessage(
"Unmatched faces on periodic boundaries"));
2069 unsigned int n_matches = 0;
2072 std::bitset<3> orientation;
2073 using PairIterator =
2074 typename std::set<std::pair<CellIterator, unsigned int>>::const_iterator;
2075 for (PairIterator it1 = pairs1.begin(); it1 != pairs1.end(); ++it1)
2077 for (PairIterator it2 = pairs2.begin(); it2 != pairs2.end(); ++it2)
2079 const CellIterator cell1 = it1->first;
2080 const CellIterator cell2 = it2->first;
2081 const unsigned int face_idx1 = it1->second;
2082 const unsigned int face_idx2 = it2->second;
2084 cell1->face(face_idx1),
2085 cell2->face(face_idx2),
2093 const PeriodicFacePair<CellIterator> matched_face = {
2094 {cell1, cell2}, {face_idx1, face_idx2}, orientation,
matrix};
2095 matched_pairs.push_back(matched_face);
2104 AssertThrow(n_matches == pairs1.size() && pairs2.size() == 0,
2105 ExcMessage(
"Unmatched faces on periodic boundaries"));
2110 template <
typename MeshType>
2113 const MeshType & mesh,
2115 const int direction,
2116 std::vector<PeriodicFacePair<typename MeshType::cell_iterator>>
2121 static const int dim = MeshType::dimension;
2122 static const int space_dim = MeshType::space_dimension;
2125 Assert(0 <= direction && direction < space_dim,
2133 std::set<std::pair<typename MeshType::cell_iterator, unsigned int>> pairs1;
2134 std::set<std::pair<typename MeshType::cell_iterator, unsigned int>> pairs2;
2136 for (
typename MeshType::cell_iterator cell = mesh.begin(0);
2137 cell != mesh.end(0);
2140 const typename MeshType::face_iterator face_1 =
2141 cell->face(2 * direction);
2142 const typename MeshType::face_iterator face_2 =
2143 cell->face(2 * direction + 1);
2145 if (face_1->at_boundary() && face_1->boundary_id() == b_id)
2147 const std::pair<typename MeshType::cell_iterator, unsigned int>
2148 pair1 = std::make_pair(cell, 2 * direction);
2149 pairs1.insert(pair1);
2152 if (face_2->at_boundary() && face_2->boundary_id() == b_id)
2154 const std::pair<typename MeshType::cell_iterator, unsigned int>
2155 pair2 = std::make_pair(cell, 2 * direction + 1);
2156 pairs2.insert(pair2);
2160 Assert(pairs1.size() == pairs2.size(),
2161 ExcMessage(
"Unmatched faces on periodic boundaries"));
2163 Assert(pairs1.size() > 0,
2164 ExcMessage(
"No new periodic face pairs have been found. " 2165 "Are you sure that you've selected the correct boundary " 2166 "id's and that the coarsest level mesh is colorized?"));
2169 const unsigned int size_old = matched_pairs.size();
2173 match_periodic_face_pairs(
2174 pairs1, pairs2, direction, matched_pairs, offset, matrix);
2178 const unsigned int size_new = matched_pairs.size();
2179 for (
unsigned int i = size_old; i < size_new; ++i)
2181 Assert(matched_pairs[i].orientation == 1,
2183 "Found a face match with non standard orientation. " 2184 "This function is only suitable for meshes with cells " 2185 "in default orientation"));
2192 template <
typename MeshType>
2195 const MeshType & mesh,
2198 const int direction,
2204 static const int dim = MeshType::dimension;
2205 static const int space_dim = MeshType::space_dimension;
2208 Assert(0 <= direction && direction < space_dim,
2214 std::set<std::pair<typename MeshType::cell_iterator, unsigned int>> pairs1;
2215 std::set<std::pair<typename MeshType::cell_iterator, unsigned int>> pairs2;
2217 for (
typename MeshType::cell_iterator cell = mesh.begin(0);
2218 cell != mesh.end(0);
2221 for (
unsigned int i = 0; i < GeometryInfo<dim>::faces_per_cell; ++i)
2223 const typename MeshType::face_iterator face = cell->face(i);
2224 if (face->at_boundary() && face->boundary_id() == b_id1)
2226 const std::pair<typename MeshType::cell_iterator, unsigned int>
2227 pair1 = std::make_pair(cell, i);
2228 pairs1.insert(pair1);
2231 if (face->at_boundary() && face->boundary_id() == b_id2)
2233 const std::pair<typename MeshType::cell_iterator, unsigned int>
2234 pair2 = std::make_pair(cell, i);
2235 pairs2.insert(pair2);
2240 Assert(pairs1.size() == pairs2.size(),
2241 ExcMessage(
"Unmatched faces on periodic boundaries"));
2243 Assert(pairs1.size() > 0,
2244 ExcMessage(
"No new periodic face pairs have been found. " 2245 "Are you sure that you've selected the correct boundary " 2246 "id's and that the coarsest level mesh is colorized?"));
2249 match_periodic_face_pairs(
2250 pairs1, pairs2, direction, matched_pairs, offset, matrix);
2264 template <
int spacedim>
2268 const int direction,
2272 Assert(0 <= direction && direction < spacedim,
2279 if (matrix.m() == spacedim)
2280 for (
int i = 0; i < spacedim; ++i)
2281 for (
int j = 0; j < spacedim; ++j)
2282 distance(i) += matrix(i, j) * point1(j);
2286 distance += offset - point2;
2288 for (
int i = 0; i < spacedim; ++i)
2294 if (std::abs(distance(i)) > 1.e-10)
2313 struct OrientationLookupTable
2317 struct OrientationLookupTable<1>
2320 std::array<unsigned int, GeometryInfo<1>::vertices_per_face>;
2321 static inline std::bitset<3>
2322 lookup(
const MATCH_T &)
2330 struct OrientationLookupTable<2>
2333 std::array<unsigned int, GeometryInfo<2>::vertices_per_face>;
2334 static inline std::bitset<3>
2335 lookup(
const MATCH_T &matching)
2342 static const MATCH_T m_tff = {{0, 1}};
2343 if (matching == m_tff)
2345 static const MATCH_T m_ttf = {{1, 0}};
2346 if (matching == m_ttf)
2356 struct OrientationLookupTable<3>
2359 std::array<unsigned int, GeometryInfo<3>::vertices_per_face>;
2360 static inline std::bitset<3>
2361 lookup(
const MATCH_T &matching)
2368 static const MATCH_T m_tff = {{0, 1, 2, 3}};
2369 if (matching == m_tff)
2371 static const MATCH_T m_tft = {{1, 3, 0, 2}};
2372 if (matching == m_tft)
2374 static const MATCH_T m_ttf = {{3, 2, 1, 0}};
2375 if (matching == m_ttf)
2377 static const MATCH_T m_ttt = {{2, 0, 3, 1}};
2378 if (matching == m_ttt)
2380 static const MATCH_T m_fff = {{0, 2, 1, 3}};
2381 if (matching == m_fff)
2383 static const MATCH_T m_fft = {{2, 3, 0, 1}};
2384 if (matching == m_fft)
2386 static const MATCH_T m_ftf = {{3, 1, 2, 0}};
2387 if (matching == m_ftf)
2389 static const MATCH_T m_ftt = {{1, 0, 3, 2}};
2390 if (matching == m_ftt)
2401 template <
typename FaceIterator>
2403 std::bitset<3> & orientation,
2404 const FaceIterator & face1,
2405 const FaceIterator & face2,
2406 const int direction,
2410 Assert(matrix.m() == matrix.n(),
2411 ExcMessage(
"The supplied matrix must be a square matrix"));
2413 static const int dim = FaceIterator::AccessorType::dimension;
2417 std::array<unsigned int, GeometryInfo<dim>::vertices_per_face> matching;
2419 std::set<unsigned int> face2_vertices;
2420 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_face; ++i)
2421 face2_vertices.insert(i);
2423 for (
unsigned int i = 0; i < GeometryInfo<dim>::vertices_per_face; ++i)
2425 for (std::set<unsigned int>::iterator it = face2_vertices.begin();
2426 it != face2_vertices.end();
2436 face2_vertices.erase(it);
2443 if (face2_vertices.empty())
2444 orientation = OrientationLookupTable<dim>::lookup(matching);
2446 return face2_vertices.empty();
2451 template <
typename FaceIterator>
2454 const FaceIterator & face1,
2455 const FaceIterator & face2,
2456 const int direction,
2461 std::bitset<3> dummy;
2470 #include "grid_tools_dof_handlers.inst" 2473 DEAL_II_NAMESPACE_CLOSE
unsigned int n_active_cells() const
static const unsigned int invalid_unsigned_int
#define AssertDimension(dim1, dim2)
Contents is actually a matrix.
unsigned int n_cells() const
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
active_cell_iterator begin_active(const unsigned int level=0) const
#define AssertThrow(cond, exc)
virtual Point< dim > transform_real_to_unit_cell(const typename Triangulation< dim, spacedim >::cell_iterator &cell, const Point< spacedim > &p) const =0
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
cell_iterator begin(const unsigned int level=0) const
static double distance_to_unit_cell(const Point< dim > &p)
typename ActiveSelector::active_cell_iterator active_cell_iterator
cell_iterator end() const
virtual void execute_coarsening_and_refinement()
static ::ExceptionBase & ExcMessage(std::string arg1)
virtual void create_triangulation(const std::vector< Point< spacedim >> &vertices, const std::vector< CellData< dim >> &cells, const SubCellData &subcelldata)
#define Assert(cond, exc)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
Abstract base class for mapping classes.
const std::vector< Point< spacedim > > & get_vertices() const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
unsigned int global_dof_index
__global__ void set(Number *val, const Number s, const size_type N)
const std::vector< bool > & get_used_vertices() const
const Triangulation< dim, spacedim > & get_triangulation() const
virtual bool preserves_vertex_locations() const =0
static ::ExceptionBase & ExcNotImplemented()
Iterator points to a valid object.
static ::ExceptionBase & ExcVertexNotUsed(unsigned int arg1)
unsigned int size() const
numbers::NumberTraits< Number >::real_type distance_square(const Point< dim, Number > &p) const
static ::ExceptionBase & ExcInternalError()
Triangulation< dim, spacedim > & get_triangulation()