503 template <
int dim,
int spacedim>
509 const unsigned int handle,
514 &unpack_callback)
const
527 Assert(sizes_fixed_cumulative.size() > 0,
531 Assert(dest_data_fixed.size() > 0,
560 sizes_fixed_cumulative[sizes_fixed_cumulative.size() - 2];
615 sizeof(
unsigned int));
619 sizeof(
unsigned int));
670 template <
int dim,
int spacedim>
678 Assert(sizes_fixed_cumulative.size() > 0,
681#ifdef DEAL_II_WITH_MPI
686 const unsigned int myrank =
693 const unsigned int bytes_per_cell = sizes_fixed_cumulative.back();
733 sizes_fixed_cumulative.data(),
734 sizes_fixed_cumulative.size(),
742 sizes_fixed_cumulative.size() *
sizeof(
unsigned int);
753 src_data_fixed.data(),
754 src_data_fixed.size(),
768 if (variable_size_data_stored)
798 sizeof(
unsigned int);
803 static_cast<std::size_t
>(
804 std::numeric_limits<int>::max()),
810 src_sizes_variable.data(),
811 src_sizes_variable.size(),
820 const std::uint64_t
size_on_proc = src_data_variable.size();
838 src_data_variable.data(),
839 src_data_variable.size(),
854 (
void)mpi_communicator;
863 std::ofstream file(
fname_fixed, std::ios::binary | std::ios::out);
867 file.write(
reinterpret_cast<const char *
>(
868 sizes_fixed_cumulative.data()),
869 sizes_fixed_cumulative.size() *
sizeof(
unsigned int));
872 file.write(
reinterpret_cast<const char *
>(src_data_fixed.data()),
873 src_data_fixed.size() *
sizeof(
char));
879 if (variable_size_data_stored)
885 std::ios::binary | std::ios::out);
889 file.write(
reinterpret_cast<const char *
>(
890 src_sizes_variable.data()),
891 src_sizes_variable.size() *
sizeof(
int));
894 file.write(
reinterpret_cast<const char *
>(src_data_variable.data()),
895 src_data_variable.size() *
sizeof(
char));
901 template <
int dim,
int spacedim>
912 Assert(dest_data_fixed.empty(),
913 ExcMessage(
"Previously loaded data has not been released yet!"));
917#ifdef DEAL_II_WITH_MPI
951 (variable_size_data_stored ? 1 : 0));
955 sizes_fixed_cumulative.data(),
956 sizes_fixed_cumulative.size(),
962 const unsigned int bytes_per_cell = sizes_fixed_cumulative.back();
968 sizes_fixed_cumulative.size() *
sizeof(
unsigned int);
979 dest_data_fixed.data(),
980 dest_data_fixed.size(),
993 if (variable_size_data_stored)
1022 dest_sizes_variable.data(),
1023 dest_sizes_variable.size(),
1032 std::accumulate(dest_sizes_variable.begin(),
1033 dest_sizes_variable.end(),
1054 dest_data_variable.data(),
1055 dest_data_variable.size(),
1067 (
void)mpi_communicator;
1078 std::ifstream file(
fname_fixed, std::ios::binary | std::ios::in);
1082 (variable_size_data_stored ? 1 : 0));
1084 file.read(
reinterpret_cast<char *
>(sizes_fixed_cumulative.data()),
1085 sizes_fixed_cumulative.size() *
sizeof(
unsigned int));
1087 const unsigned int bytes_per_cell = sizes_fixed_cumulative.back();
1092 file.read(
reinterpret_cast<char *
>(dest_data_fixed.data()),
1093 dest_data_fixed.size() *
sizeof(char));
1099 if (variable_size_data_stored)
1104 std::ifstream file(
fname_variable, std::ios::binary | std::ios::in);
1109 file.read(
reinterpret_cast<char *
>(dest_sizes_variable.data()),
1110 dest_sizes_variable.size() *
sizeof(
int));
1113 const std::uint64_t
size =
1114 std::accumulate(dest_sizes_variable.begin(),
1115 dest_sizes_variable.end(),
1117 dest_data_variable.resize(
size);
1118 file.read(
reinterpret_cast<char *
>(dest_data_variable.data()),
1119 dest_data_variable.size() *
sizeof(
char));
1125 template <
int dim,
int spacedim>
1129 variable_size_data_stored =
false;
1132 sizes_fixed_cumulative.
clear();
1133 sizes_fixed_cumulative.shrink_to_fit();
1136 src_data_fixed.
clear();
1137 src_data_fixed.shrink_to_fit();
1139 dest_data_fixed.
clear();
1140 dest_data_fixed.shrink_to_fit();
1143 src_sizes_variable.
clear();
1144 src_sizes_variable.shrink_to_fit();
1146 src_data_variable.
clear();
1147 src_data_variable.shrink_to_fit();
1149 dest_sizes_variable.
clear();
1150 dest_sizes_variable.shrink_to_fit();
1152 dest_data_variable.
clear();
1153 dest_data_variable.shrink_to_fit();
1167 template <
int dim,
int spacedim>
1175 for (
unsigned int i = 0; i < cell->n_children(); ++i)
1176 if (cell->child(i)->is_active())
1190 template <
int dim,
int spacedim>
1198 if (cell->has_children())
1201 const unsigned int n_children = cell->n_children();
1203 for (
unsigned int c = 0; c < n_children; ++c)
1204 if (cell->child(c)->is_active() && cell->child(c)->coarsen_flag_set())
1209 for (
unsigned int c = 0; c < n_children; ++c)
1210 if (cell->child(c)->is_active())
1211 cell->child(c)->clear_coarsen_flag();
1247 template <
int dim,
int spacedim>
1267 if (neighbor->has_children())
1338 for (
unsigned int c = 0; c <
neighbor_face->n_children(); ++c)
1396 template <
int dim,
int spacedim>
1410 template <
int dim,
int spacedim>
1424 template <
int dim,
int spacedim>
1434 for (
const auto &cell :
triangulation.active_cell_iterators())
1438 std::min<unsigned int>(
1441 std::max<unsigned int>(
1471 template <
int dim,
int spacedim>
1476 if (line->has_children())
1477 return line->child(0)->vertex_index(1);
1482 template <
int dim,
int spacedim>
1487 switch (
static_cast<unsigned char>(quad->refinement_case()))
1496 return quad->child(0)->vertex_index(3);
1505 template <
int dim,
int spacedim>
1510 switch (
static_cast<unsigned char>(hex->refinement_case()))
1531 return hex->child(0)->vertex_index(7);
1552 template <
class TRIANGULATION>
1553 inline typename TRIANGULATION::DistortedCellList
1556 return typename TRIANGULATION::DistortedCellList();
1574 for (
const auto &cell :
triangulation.cell_iterators_on_level(0))
1578 vertices[i] = cell->vertex(i);
1592 return distorted_cells;
1609 for (
unsigned int c = 0; c < cell->n_children(); ++c)
1613 vertices[i] = cell->child(c)->vertex(i);
1635 template <
int dim,
int spacedim>
1644 template <
int dim,
int spacedim>
1664 face_1->reference_cell().get_inverse_combined_orientation(orientation);
1667 const auto [face_orientation, face_rotation, face_flip] =
1670 Assert((dim != 1) || (face_orientation ==
true && face_flip ==
false &&
1671 face_rotation ==
false),
1673 "(face_orientation, face_flip, face_rotation) "
1674 "is invalid for 1d"));
1676 Assert((dim != 2) || (face_flip ==
false && face_rotation ==
false),
1678 "(face_orientation, face_flip, face_rotation) "
1679 "is invalid for 2d"));
1685 ExcMessage(
"Periodic faces must be on the boundary"));
1696 std::pair<typename Triangulation<dim, spacedim>::cell_iterator,
1700 const std::pair<CellFace, types::geometric_orientation>
1703 const std::pair<CellFace, std::pair<CellFace, types::geometric_orientation>>
1712 if (
cell_1->has_children())
1714 if (
cell_2->has_children())
1738 if (
cell_1->has_children())
1740 if (
cell_2->has_children())
1754 for (
unsigned int i = 0;
1759 const unsigned int j =
1766 cell_1->refinement_case(),
1772 face_1->refinement_case());
1775 cell_2->refinement_case(),
1781 face_2->refinement_case());
1803 for (
unsigned int i = 0;
1810 cell_1->refinement_case(),
1816 face_1->refinement_case());
1844 return line_orientation ==
D ? 0 : 1;
1846 return line_orientation ==
D ? 1 : 0;
1858 return ReferenceCells::max_n_faces<0>();
1860 return ReferenceCells::max_n_faces<1>();
1862 return ReferenceCells::max_n_faces<2>();
1864 return ReferenceCells::max_n_faces<3>();
1875 namespace TriangulationImplementation
1883 using ::Triangulation;
1891 <<
"Something went wrong upon construction of cell "
1905 <<
" has negative measure. This typically "
1906 <<
"indicates some distortion in the cell, or a mistakenly "
1907 <<
"swapped pair of vertices in the input to "
1908 <<
"Triangulation::create_triangulation().");
1920 <<
"Error while creating cell " <<
arg1
1921 <<
": the vertex index " <<
arg2 <<
" must be between 0 and "
1932 <<
"The input data for creating a triangulation contained "
1933 <<
"information about a line with indices " <<
arg1 <<
" and " <<
arg2
1934 <<
" that is described to have boundary indicator "
1935 <<
static_cast<int>(
arg3)
1936 <<
". However, this is an internal line not located on the "
1937 <<
"boundary. You cannot assign a boundary indicator to it." << std::endl
1939 <<
"If this happened at a place where you call "
1940 <<
"Triangulation::create_triangulation() yourself, you need "
1941 <<
"to check the SubCellData object you pass to this function."
1944 <<
"If this happened in a place where you are reading a mesh "
1945 <<
"from a file, then you need to investigate why such a line "
1946 <<
"ended up in the input file. A typical case is a geometry "
1947 <<
"that consisted of multiple parts and for which the mesh "
1948 <<
"generator program assumes that the interface between "
1949 <<
"two parts is a boundary when that isn't supposed to be "
1950 <<
"the case, or where the mesh generator simply assigns "
1951 <<
"'geometry indicators' to lines at the perimeter of "
1952 <<
"a part that are not supposed to be interpreted as "
1953 <<
"'boundary indicators'.");
1965 <<
"The input data for creating a triangulation contained "
1966 <<
"information about a quad with indices " <<
arg1 <<
", " <<
arg2
1967 <<
", " <<
arg3 <<
", and " <<
arg4
1968 <<
" that is described to have boundary indicator "
1969 <<
static_cast<int>(
arg5)
1970 <<
". However, this is an internal quad not located on the "
1971 <<
"boundary. You cannot assign a boundary indicator to it." << std::endl
1973 <<
"If this happened at a place where you call "
1974 <<
"Triangulation::create_triangulation() yourself, you need "
1975 <<
"to check the SubCellData object you pass to this function."
1978 <<
"If this happened in a place where you are reading a mesh "
1979 <<
"from a file, then you need to investigate why such a quad "
1980 <<
"ended up in the input file. A typical case is a geometry "
1981 <<
"that consisted of multiple parts and for which the mesh "
1982 <<
"generator program assumes that the interface between "
1983 <<
"two parts is a boundary when that isn't supposed to be "
1984 <<
"the case, or where the mesh generator simply assigns "
1985 <<
"'geometry indicators' to quads at the surface of "
1986 <<
"a part that are not supposed to be interpreted as "
1987 <<
"'boundary indicators'.");
1996 <<
"In SubCellData the line info of the line with vertex indices " <<
arg1
1997 <<
" and " <<
arg2 <<
" appears more than once. "
1998 <<
"This is not allowed.");
2008 <<
"In SubCellData the line info of the line with vertex indices " <<
arg1
2009 <<
" and " <<
arg2 <<
" appears multiple times with different (valid) "
2010 <<
arg3 <<
". This is not allowed.");
2022 <<
"In SubCellData the quad info of the quad with line indices " <<
arg1
2024 <<
" appears multiple times with different (valid) " <<
arg5
2025 <<
". This is not allowed.");
2043 unsigned int next_free_single = 0;
2044 unsigned int next_free_pair = 0;
2051 for (
unsigned int i = 0; i <
tria_faces.quads.used.size(); ++i)
2055 else if (i + 1 <
tria_faces.quads.used.size())
2060 if (next_free_single == 0)
2061 next_free_single = i;
2066 if (next_free_pair == 0)
2091 new_size * ReferenceCells::max_n_lines<2>(),
true);
2114 const unsigned int space_dimension,
2168 tria_level.global_active_cell_indices.insert(
2179 if (dim == space_dimension - 1)
2200 std::make_pair(-1, -1));
2202 if (dim == 2 || dim == 3)
2225 <<
"The containers have sizes " <<
arg1 <<
" and " <<
arg2
2226 <<
", which is not as expected.");
2279 for (
unsigned int i = 0; i <
tria_objects.used.size(); ++i)
2319 const unsigned int max_children_per_cell =
2340 const unsigned int factor = max_children_per_cell / 2;
2492 template <
int dim,
int spacedim>
2522 const bool check_for_distorted_cells) = 0;
2551 virtual std::unique_ptr<Policy<dim, spacedim>>
2562 template <
int dim,
int spacedim,
typename T>
2569 T::update_neighbors(tria);
2584 const bool check_for_distorted_cells)
override
2586 return T::execute_refinement(
triangulation, check_for_distorted_cells);
2611 std::unique_ptr<Policy<dim, spacedim>>
2614 return std::make_unique<PolicyWrapper<dim, spacedim, T>>();
2728 template <
int dim,
int spacedim>
2735 using line_iterator =
2738 number_cache.n_levels = 0;
2743 number_cache.n_levels =
level + 1;
2751 number_cache.n_lines = 0;
2752 number_cache.n_active_lines = 0;
2758 number_cache.n_lines_level.resize(number_cache.n_levels);
2759 number_cache.n_active_lines_level.resize(number_cache.n_levels);
2764 number_cache.n_lines_level[
level] = 0;
2765 number_cache.n_active_lines_level[
level] = 0;
2769 (
level == number_cache.n_levels - 1 ?
2772 for (; line !=
endc; ++line)
2774 ++number_cache.n_lines_level[
level];
2775 if (line->has_children() ==
false)
2776 ++number_cache.n_active_lines_level[
level];
2780 number_cache.n_lines += number_cache.n_lines_level[
level];
2781 number_cache.n_active_lines +=
2782 number_cache.n_active_lines_level[
level];
2788 number_cache.n_lines_level.clear();
2789 number_cache.n_active_lines_level.clear();
2793 for (; line !=
endc; ++line)
2795 ++number_cache.n_lines;
2796 if (line->has_children() ==
false)
2797 ++number_cache.n_active_lines;
2816 template <
int dim,
int spacedim>
2837 using quad_iterator =
2843 number_cache.n_quads = 0;
2844 number_cache.n_active_quads = 0;
2854 unsigned int n_levels = 0;
2859 n_levels =
level + 1;
2861 number_cache.n_quads_level.resize(n_levels);
2862 number_cache.n_active_quads_level.resize(n_levels);
2867 number_cache.n_quads_level[
level] = 0;
2868 number_cache.n_active_quads_level[
level] = 0;
2872 (
level == n_levels - 1 ?
2875 for (; quad !=
endc; ++quad)
2877 ++number_cache.n_quads_level[
level];
2878 if (quad->has_children() ==
false)
2879 ++number_cache.n_active_quads_level[
level];
2883 number_cache.n_quads += number_cache.n_quads_level[
level];
2884 number_cache.n_active_quads +=
2885 number_cache.n_active_quads_level[
level];
2891 number_cache.n_quads_level.clear();
2892 number_cache.n_active_quads_level.clear();
2896 for (; quad !=
endc; ++quad)
2898 ++number_cache.n_quads;
2899 if (quad->has_children() ==
false)
2900 ++number_cache.n_active_quads;
2923 template <
int dim,
int spacedim>
2944 using hex_iterator =
2950 number_cache.n_hexes = 0;
2951 number_cache.n_active_hexes = 0;
2962 unsigned int n_levels = 0;
2967 n_levels =
level + 1;
2969 number_cache.n_hexes_level.resize(n_levels);
2970 number_cache.n_active_hexes_level.resize(n_levels);
2975 number_cache.n_hexes_level[
level] = 0;
2976 number_cache.n_active_hexes_level[
level] = 0;
2982 for (; hex !=
endc; ++hex)
2984 ++number_cache.n_hexes_level[
level];
2985 if (hex->has_children() ==
false)
2986 ++number_cache.n_active_hexes_level[
level];
2990 number_cache.n_hexes += number_cache.n_hexes_level[
level];
2991 number_cache.n_active_hexes +=
2992 number_cache.n_active_hexes_level[
level];
2998 number_cache.n_hexes_level.clear();
2999 number_cache.n_active_hexes_level.clear();
3003 for (; hex !=
endc; ++hex)
3005 ++number_cache.n_hexes;
3006 if (hex->has_children() ==
false)
3007 ++number_cache.n_active_hexes;
3016 template <
int dim,
int spacedim>
3025 number_cache.active_cell_index_partitioner =
3026 std::make_shared<const Utilities::MPI::Partitioner>(
3029 number_cache.level_cell_index_partitioners.resize(
3032 number_cache.level_cell_index_partitioners[
level] =
3033 std::make_shared<const Utilities::MPI::Partitioner>(
3038 template <
int spacedim>
3044 template <
int dim,
int spacedim>
3108 {{0, 1}, {1, 0}, {0, 1}, {1, 0}, {0, 1}, {1, 0}}};
3119 std::vector<typename Triangulation<dim, spacedim>::cell_iterator>
3123 for (
auto f : cell->face_indices())
3128 const unsigned int offset =
3129 (cell->direction_flag() ?
3144 if (cell->is_active() && face->has_children())
3174 if (face->has_children() &&
3175 (cell->is_active() ||
3177 cell->refinement_case(), f) ==
3180 for (
unsigned int c = 0; c < face->n_children(); ++c)
3183 if (face->child(0)->has_children())
3190 if (face->child(1)->has_children())
3207 for (
auto f : cell->face_indices())
3209 const unsigned int offset =
3210 (cell->direction_flag() ?
3223 template <
int dim,
int spacedim>
3237 if (dim == spacedim)
3244 if (tria.check_for_distorted_cells)
3246 const double cell_measure = GridTools::cell_measure<spacedim>(
3255 tria.levels.
clear();
3256 tria.levels.push_back(
3261 tria.faces = std::make_unique<
3265 tria.vertices = vertices;
3266 tria.vertices_used.assign(vertices.size(),
true);
3270 const unsigned int n_cell = cells.size();
3275 auto &
lines_0 = tria.faces->lines;
3278 const auto &
crs = connectivity.entity_to_entities(1, 0);
3279 const unsigned int n_lines =
crs.ptr.size() - 1;
3285 for (
unsigned int line = 0; line < n_lines; ++line)
3286 for (
unsigned int i =
crs.ptr[line],
j = 0; i <
crs.ptr[line + 1];
3288 lines_0.cells[line * ReferenceCells::max_n_faces<1>() +
j] =
3295 auto &
quads_0 = tria.faces->quads;
3296 auto &faces = *tria.faces;
3299 const auto &
crs = connectivity.entity_to_entities(2, 1);
3300 const unsigned int n_quads =
crs.ptr.size() - 1;
3307 for (
unsigned int q = 0,
k = 0;
q < n_quads; ++
q)
3310 const auto reference_cell = connectivity.entity_types(2)[
q];
3311 faces.set_quad_type(
q, reference_cell);
3314 for (
unsigned int i =
crs.ptr[
q],
j = 0; i <
crs.ptr[
q + 1];
3319 quads_0.cells[
q * ReferenceCells::max_n_lines<2>() +
j] =
3324 connectivity.entity_orientations(1)
3325 .get_combined_orientation(
k);
3336 faces.quads_line_orientations
3337 [
q * ReferenceCells::max_n_lines<2>() +
j] =
3346 auto &
cells_0 = tria.levels[0]->cells;
3347 auto &
level = *tria.levels[0];
3350 const auto &
crs = connectivity.entity_to_entities(dim, dim - 1);
3351 const auto &
nei = connectivity.entity_to_entities(dim, dim);
3360 const auto &
orientations = connectivity.entity_orientations(1);
3361 for (
unsigned int i = 0; i <
orientations.n_objects(); ++i)
3375 for (
unsigned int cell = 0; cell <
n_cell; ++cell)
3378 cells_0.boundary_or_material_id[cell].material_id =
3379 cells[cell].material_id;
3382 cells_0.manifold_id[cell] = cells[cell].manifold_id;
3385 level.reference_cell[cell] = connectivity.entity_types(dim)[cell];
3388 for (
unsigned int i =
crs.ptr[cell],
j = 0; i <
crs.ptr[cell + 1];
3392 if (
nei.col[i] !=
static_cast<unsigned int>(-1))
3393 level.neighbors[cell * ReferenceCells::max_n_faces<dim>() +
3394 j] = {0,
nei.col[i]};
3397 cells_0.cells[cell * ReferenceCells::max_n_faces<dim>() +
j] =
3403 level.face_orientations.set_combined_orientation(
3404 cell * ReferenceCells::max_n_faces<dim>() +
j,
3405 connectivity.entity_orientations(dim - 1)
3406 .get_combined_orientation(i));
3416 tria.faces->quads.boundary_or_material_id :
3417 tria.faces->lines.boundary_or_material_id;
3423 const auto &
crs = connectivity.entity_to_entities(dim, dim - 1);
3426 for (
unsigned int cell = 0; cell < cells.size(); ++cell)
3427 for (
unsigned int i =
crs.ptr[cell]; i <
crs.ptr[cell + 1]; ++i)
3431 for (
unsigned int face = 0; face <
count.size(); ++face)
3433 if (
count[face] != 1)
3443 const auto &
crs = connectivity.entity_to_entities(2, 1);
3444 for (
unsigned int i =
crs.ptr[face]; i <
crs.ptr[face + 1]; ++i)
3445 tria.faces->lines.boundary_or_material_id[
crs.col[i]]
3451 static const unsigned int t_tba =
static_cast<unsigned int>(-1);
3452 static const unsigned int t_inner =
static_cast<unsigned int>(-2);
3454 std::vector<unsigned int> type(vertices.size(),
t_tba);
3456 const auto &
crs = connectivity.entity_to_entities(1, 0);
3458 for (
unsigned int cell = 0; cell < cells.size(); ++cell)
3459 for (
unsigned int i =
crs.ptr[cell],
j = 0; i <
crs.ptr[cell + 1];
3464 for (
unsigned int face = 0; face < type.size(); ++face)
3467 (*tria.vertex_to_manifold_id_map_1d)[face] =
3470 (*tria.vertex_to_boundary_id_map_1d)[face] = type[face];
3490 template <
int structdim,
int spacedim,
typename T>
3514 [](
const auto &a,
const auto &b) {
3515 return a.vertices < b.vertices;
3520 std::vector<unsigned int>
key;
3521 key.reserve(ReferenceCells::max_n_vertices<structdim>());
3523 for (
unsigned int o = 0;
o <
obj.n_objects(); ++
o)
3525 auto &boundary_id =
obj.boundary_or_material_id[
o].boundary_id;
3526 auto &manifold_id =
obj.manifold_id[
o];
3538 crs.col.data() +
crs.ptr[
o + 1]);
3539 std::sort(
key.begin(),
key.end());
3546 [&](
const auto &cell,
const auto &
key) {
3547 return cell.vertices < key;
3567 "The input arguments for creating a triangulation "
3568 "specified a boundary id for an internal face. This "
3571 "The object in question has vertex indices " +
3575 s += std::to_string(v) +
',';
3578 " which are located at coordinates " +
3580 std::ostringstream s;
3581 for (
unsigned int i = 0;
3604 const unsigned structdim,
3605 const unsigned int size)
3607 const unsigned int dim = faces.
dim;
3609 if (dim == 3 && structdim == 2)
3624 const unsigned int spacedim,
3625 const unsigned int size,
3628 const unsigned int dim =
level.dim;
3632 level.level_subdomain_ids.assign(
size, 0);
3636 level.coarsen_flags.assign(
size,
false);
3638 level.parents.assign((
size + 1) / 2, -1);
3640 if (dim == spacedim - 1)
3641 level.direction_flags.assign(
size,
true);
3643 level.neighbors.assign(
size * max_n_faces(dim), {-1, -1});
3648 level.face_orientations.reinit(
size * max_n_faces(dim));
3651 level.global_active_cell_indices.assign(
size,
3653 level.global_level_cell_indices.assign(
size,
3662 const unsigned int structdim =
obj.structdim;
3664 const unsigned int max_children_per_cell = 1 << structdim;
3667 obj.boundary_or_material_id.assign(
3670 BoundaryOrMaterialId());
3671 obj.manifold_id.assign(
size, -1);
3672 obj.user_flags.assign(
size,
false);
3676 obj.refinement_cases.assign(
size, 0);
3678 obj.children.assign(max_children_per_cell / 2 *
size, -1);
3680 obj.cells.assign(
size * max_n_faces(structdim), -1);
3684 obj.next_free_single =
size - 1;
3685 obj.next_free_pair = 0;
3686 obj.reverse_order_next_free_single =
true;
3690 obj.next_free_single =
obj.next_free_pair = 0;
3710 template <
int spacedim>
3714 std::vector<unsigned int> &,
3715 std::vector<unsigned int> &)
3717 const unsigned int dim = 1;
3729 Assert(!cell->child(0)->has_children() &&
3730 !cell->child(1)->has_children(),
3736 if (cell->neighbor(0)->has_children())
3743 neighbor = neighbor->child(1);
3746 Assert(neighbor->neighbor(1) == cell->child(0),
3748 neighbor->set_neighbor(1, cell);
3754 if (neighbor->has_children())
3755 neighbor = neighbor->child(1);
3764 if (cell->neighbor(1)->has_children())
3771 neighbor = neighbor->child(0);
3774 Assert(neighbor->neighbor(0) == cell->child(1),
3776 neighbor->set_neighbor(0, cell);
3782 if (neighbor->has_children())
3783 neighbor = neighbor->child(0);
3793 triangulation.vertices_used[cell->child(0)->vertex_index(1)] =
false;
3799 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3801 cell->child(child)->clear_user_data();
3802 cell->child(child)->clear_user_flag();
3803 cell->child(child)->clear_used_flag();
3808 cell->clear_children();
3809 cell->clear_user_flag();
3814 template <
int spacedim>
3819 std::vector<unsigned int> &)
3821 const unsigned int dim = 2;
3829 std::vector<typename Triangulation<dim, spacedim>::line_iterator>
3837 for (
unsigned int c = 0; c < cell->n_children(); ++c)
3857 .vertices_used[cell->child(0)->line(1)->vertex_index(1)] =
false;
3875 for (
unsigned int child = 0; child < cell->n_children(); ++child)
3877 cell->child(child)->clear_user_data();
3878 cell->child(child)->clear_user_flag();
3879 cell->child(child)->clear_used_flag();
3884 cell->clear_children();
3885 cell->clear_refinement_case();
3886 cell->clear_user_flag();
3892 for (
unsigned int line_no = 0;
3899 if (line->has_children())
3912 for (
unsigned int c = 0; c < 2; ++c)
3913 Assert(!line->child(c)->has_children(),
3921 .vertices_used[line->child(0)->vertex_index(1)] =
false;
3926 line->clear_children();
3938 typename std::vector<
3942 for (; line !=
endline; ++line)
3944 (*line)->clear_user_data();
3945 (*line)->clear_user_flag();
3946 (*line)->clear_used_flag();
3952 template <
int spacedim>
3959 const unsigned int dim = 3;
3971 std::vector<typename Triangulation<dim, spacedim>::line_iterator>
3973 std::vector<typename Triangulation<dim, spacedim>::quad_iterator>
3981 for (
unsigned int c = 0; c < cell->n_children(); ++c)
3985 const auto line_indices = TriaAccessorImplementation::
3986 Implementation::get_line_indices_of_cell(*child);
3987 for (
const unsigned int l : cell->line_indices())
4063 triangulation.vertices_used[cell->child(0)->vertex_index(7)] =
4075 for (
unsigned int child = 0; child < cell->n_children(); ++child)
4077 cell->child(child)->clear_user_data();
4078 cell->child(child)->clear_user_flag();
4083 cell->child(child)->set_combined_face_orientation(
4086 cell->child(child)->clear_used_flag();
4091 cell->clear_children();
4092 cell->clear_refinement_case();
4093 cell->clear_user_flag();
4106 cell->face(quad_no);
4110 quad->has_children()) ||
4115 switch (quad->refinement_case())
4139 for (
unsigned int c = 0; c < 2; ++c)
4140 if (quad->child(c)->has_children())
4163 Assert(quad->refinement_case() +
4164 quad->child(c)->refinement_case() ==
4173 quad->child(c)->child(0));
4175 quad->child(c)->child(1));
4176 if (quad->child(c)->refinement_case() ==
4179 quad->child(c)->child(0)->line(1));
4182 quad->child(c)->child(0)->line(3));
4183 quad->child(c)->clear_children();
4184 quad->child(c)->clear_refinement_case();
4244 if (quad->child(0)->has_children())
4245 if (quad->refinement_case() ==
4280 quad->child(0)->child(1),
4282 quad->child(1)->child(0);
4291 for (
unsigned int l = 0;
4294 for (
unsigned int h = 0;
4298 for (
const unsigned int q :
4303 ->cells.get_bounding_object_indices(
4307 ->cells.get_bounding_object_indices(
4311 ->cells.get_bounding_object_indices(
4318 static_cast<signed int>(
4320 static_cast<signed int>(
4322 static_cast<signed int>(
4324 static_cast<signed int>(
4339 switch_1->set_bounding_object_indices(
4352 switch_1->set_boundary_id_internal(
4362 switch_2->set_bounding_object_indices(
4375 switch_2->set_boundary_id_internal(
4386 quad->child(0)->child_index(0);
4388 quad->child(1)->child_index(0);
4389 quad->clear_children();
4390 quad->clear_refinement_case();
4391 quad->set_refinement_case(
4393 quad->set_children(0,
child_0);
4394 quad->set_children(2,
child_2);
4412 quad->child(0)->child_index(0);
4414 quad->child(1)->child_index(0);
4415 quad->clear_children();
4416 quad->clear_refinement_case();
4417 quad->set_refinement_case(
4419 quad->set_children(0,
child_0);
4420 quad->set_children(2,
child_2);
4424 quad->clear_children();
4425 quad->clear_refinement_case();
4457 for (
unsigned int child = 0; child < quad->n_children();
4462 .vertices_used[quad->child(0)->vertex_index(3)] =
4465 quad->clear_children();
4466 quad->clear_refinement_case();
4485 for (
unsigned int line_no = 0;
4494 line->has_children()) ||
4499 if (line->has_children())
4512 for (
unsigned int c = 0; c < 2; ++c)
4513 Assert(!line->child(c)->has_children(),
4521 .vertices_used[line->child(0)->vertex_index(1)] =
false;
4526 line->clear_children();
4538 typename std::vector<
4542 for (; line !=
endline; ++line)
4544 (*line)->clear_user_data();
4545 (*line)->clear_user_flag();
4546 (*line)->clear_used_flag();
4549 typename std::vector<
4553 for (; quad !=
endquad; ++quad)
4555 (*quad)->clear_user_data();
4556 (*quad)->clear_children();
4557 (*quad)->clear_refinement_case();
4558 (*quad)->clear_user_flag();
4559 (*quad)->clear_used_flag();
4581 template <
int spacedim>
4592 const unsigned int dim = 2;
4595 cell->clear_refine_flag();
4692 if (cell->line(
line_no)->has_children())
4694 cell->line(
line_no)->child(0)->vertex_index(1);
4707 "Internal error: During refinement, the triangulation "
4708 "wants to access an element of the 'vertices' array "
4709 "but it turns out that the array is not large enough."));
4718 cell->center(
true,
true);
4724 unsigned int lmin = 8;
4725 unsigned int lmax = 12;
4732 for (
unsigned int l =
lmin; l <
lmax; ++l)
4754 for (
unsigned int c = 0; c < 2; ++c, ++l)
4758 new_lines[8]->set_bounding_object_indices(
4760 new_lines[9]->set_bounding_object_indices(
4762 new_lines[10]->set_bounding_object_indices(
4764 new_lines[11]->set_bounding_object_indices(
4780 new_lines[6]->set_bounding_object_indices(
4797 new_lines[6]->set_bounding_object_indices(
4801 for (
unsigned int l =
lmin; l <
lmax; ++l)
4810 new_lines[l]->set_manifold_id(cell->manifold_id());
4821 for (
unsigned int i = 0; i < n_children; ++i)
4826 if (i % 2 == 1 && i < n_children - 1)
4912 for (
unsigned int i = 0; i < n_children; ++i)
4920 subcells[i]->set_material_id(cell->material_id());
4921 subcells[i]->set_manifold_id(cell->manifold_id());
4925 subcells[i]->set_parent(cell->index());
4931 for (
unsigned int i = 0; i < n_children / 2; ++i)
4932 cell->set_children(2 * i,
subcells[2 * i]->index());
4934 cell->set_refinement_case(
ref_case);
4941 if (dim == spacedim - 1)
4942 for (
unsigned int c = 0; c < n_children; ++c)
4943 cell->child(c)->set_direction_flag(cell->direction_flag());
4948 template <
int dim,
int spacedim>
4951 const bool check_for_distorted_cells)
4957 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
4959 if (cell->refine_flag_set())
4972 line->clear_user_flag();
4986 for (
const auto &cell :
4988 if (cell->refine_flag_set())
4996 else if (cell->reference_cell() ==
5008 for (
const auto line_no : cell->face_indices())
5010 auto line = cell->line(
line_no);
5011 if (line->has_children() ==
false)
5012 line->set_user_flag();
5035 if (line->user_flag_set())
5063 for (; line !=
endl; ++line)
5064 if (line->user_flag_set())
5072 "Internal error: During refinement, the triangulation "
5073 "wants to access an element of the 'vertices' array "
5074 "but it turns out that the array is not large "
5099 children[0]->set_bounding_object_indices(
5101 children[1]->set_bounding_object_indices(
5104 for (
auto &child : children)
5106 child->set_used_flag();
5107 child->clear_children();
5109 child->clear_user_flag();
5110 child->set_boundary_id_internal(line->boundary_id());
5111 child->set_manifold_id(line->manifold_id());
5116 line->clear_user_flag();
5133 const auto ref_case = cell->refine_flag_set();
5134 cell->clear_refine_flag();
5151 if (cell->line(
line_no)->has_children())
5153 cell->line(
line_no)->child(0)->vertex_index(1);
5162 "Internal error: During refinement, the triangulation wants "
5163 "to access an element of the 'vertices' array but it turns "
5164 "out that the array is not large enough."));
5170 cell->center(
true,
true);
5173 std::array<typename Triangulation<dim, spacedim>::raw_line_iterator,
5178 unsigned int lmin = 0;
5179 unsigned int lmax = 0;
5202 for (
unsigned int l =
lmin; l <
lmax; ++l)
5213 for (
const unsigned int face_no : cell->face_indices())
5221 cell->combined_face_orientation(
face_no);
5227 for (
unsigned int c = 0; c < 2; ++c)
5231 cell->combined_face_orientation(
face_no);
5240 new_lines[6]->set_bounding_object_indices(
5242 new_lines[7]->set_bounding_object_indices(
5244 new_lines[8]->set_bounding_object_indices(
5249 new_lines[8]->set_bounding_object_indices(
5251 new_lines[9]->set_bounding_object_indices(
5253 new_lines[10]->set_bounding_object_indices(
5255 new_lines[11]->set_bounding_object_indices(
5263 for (
unsigned int l =
lmin; l <
lmax; ++l)
5272 new_lines[l]->set_manifold_id(cell->manifold_id());
5280 unsigned int n_children = 0;
5288 for (
unsigned int i = 0; i < n_children; ++i)
5293 if (i % 2 == 1 && i < n_children - 1)
5301 {{{{0, 8, 5, X}}, {{1, 2, 6, X}}, {{7, 3, 4, X}}, {{6, 7, 8, X}}}};
5313 for (
unsigned int i = 0; i < n_children; ++i)
5316 subcells[i]->set_bounding_object_indices(
5321 subcells[i]->set_bounding_object_indices(
5333 subcells[i]->set_material_id(cell->material_id());
5334 subcells[i]->set_manifold_id(cell->manifold_id());
5335 subcells[i]->set_subdomain_id(cell->subdomain_id());
5338 ->reference_cell[
subcells[i]->index()] = cell->reference_cell();
5342 for (
unsigned int face_no : cell->face_indices())
5343 subcells[i]->set_combined_face_orientation(
5347 subcells[i]->set_parent(cell->index());
5353 for (
unsigned int face_no : cell->face_indices())
5354 subcells[3]->set_combined_face_orientation(
5357 for (
unsigned int i = 0; i < n_children / 2; ++i)
5358 cell->set_children(2 * i,
subcells[2 * i]->index());
5360 cell->set_refinement_case(
ref_case);
5362 if (dim == spacedim - 1)
5363 for (
unsigned int c = 0; c < n_children; ++c)
5364 cell->child(c)->set_direction_flag(cell->direction_flag());
5374 for (
const auto &cell :
5376 if (cell->refine_flag_set())
5385 check_for_distorted_cells &&
5403 template <
int spacedim>
5408 const unsigned int dim = 1;
5412 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
5414 if (cell->refine_flag_set())
5434 for (
const auto &
acell :
5436 if (
acell->refine_flag_set())
5489 for (
const auto &cell :
5491 if (cell->refine_flag_set())
5494 cell->clear_refine_flag();
5504 "Internal error: During refinement, the triangulation "
5505 "wants to access an element of the 'vertices' array "
5506 "but it turns out that the array is not large enough."));
5539 first_child->set_material_id(cell->material_id());
5540 first_child->set_manifold_id(cell->manifold_id());
5542 if (dim == spacedim - 1)
5543 first_child->set_direction_flag(cell->direction_flag());
5549 first_child->face(1)->set_manifold_id(cell->manifold_id());
5557 else if (cell->neighbor(0)->is_active())
5563 Assert(cell->neighbor(0)->level() <= cell->level(),
5571 const unsigned int nbnb = cell->neighbor_of_neighbor(0);
5573 cell->neighbor(0)->child(
nbnb));
5594 if (dim == spacedim - 1)
5595 second_child->set_direction_flag(cell->direction_flag());
5599 else if (cell->neighbor(1)->is_active())
5601 Assert(cell->neighbor(1)->level() <= cell->level(),
5608 const unsigned int nbnb = cell->neighbor_of_neighbor(1);
5610 1, cell->neighbor(1)->child(
nbnb));
5637 template <
int spacedim>
5640 const bool check_for_distorted_cells)
5642 const unsigned int dim = 2;
5648 for (
const auto &cell :
triangulation.active_cell_iterators())
5658 check_for_distorted_cells);
5665 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
5667 if (cell->refine_flag_set())
5682 line->clear_user_flag();
5705 for (
const auto &cell :
5707 if (cell->refine_flag_set())
5738 for (
const unsigned int line_no :
5742 cell->refine_flag_set(),
line_no) ==
5747 if (line->has_children() ==
false)
5748 line->set_user_flag();
5780 if (line->user_flag_set())
5825 for (; line !=
endl; ++line)
5826 if (line->user_flag_set())
5837 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
5871 children[0]->set_bounding_object_indices(
5873 children[1]->set_bounding_object_indices(
5876 children[0]->set_used_flag();
5877 children[1]->set_used_flag();
5878 children[0]->clear_children();
5879 children[1]->clear_children();
5882 children[0]->clear_user_flag();
5883 children[1]->clear_user_flag();
5886 children[0]->set_boundary_id_internal(line->boundary_id());
5887 children[1]->set_boundary_id_internal(line->boundary_id());
5889 children[0]->set_manifold_id(line->manifold_id());
5890 children[1]->set_manifold_id(line->manifold_id());
5894 line->clear_user_flag();
5920 for (
const auto &cell :
5922 if (cell->refine_flag_set())
5932 if (check_for_distorted_cells &&
5945 template <
int spacedim>
5948 const bool check_for_distorted_cells)
5950 static const int dim = 3;
5952 using raw_line_iterator =
5954 using raw_quad_iterator =
5965 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
5967 if (cell->refine_flag_set())
6002 for (
const auto &cell :
6004 if (cell->refine_flag_set())
6007 Assert(cell->refine_flag_set() ==
6013 new_cells += cell->reference_cell().n_isotropic_children();
6021 else if (cell->reference_cell() ==
6036 for (
const auto face : cell->face_indices())
6037 if (cell->face(face)->n_children() == 0)
6038 cell->face(face)->set_user_flag();
6040 Assert(cell->face(face)->n_children() ==
6041 cell->reference_cell()
6042 .face_reference_cell(face)
6043 .n_isotropic_children(),
6046 for (
const auto line : cell->line_indices())
6047 if (cell->line(line)->has_children() ==
false)
6048 cell->line(line)->set_user_flag();
6050 Assert(cell->line(line)->n_children() == 2,
6080 if (quad->user_flag_set() ==
false)
6105 if (line->user_flag_set() ==
false)
6145 for (
const auto &cell :
triangulation.active_cell_iterators())
6146 if (!cell->refine_flag_set())
6148 if (cell->line(
line_n)->has_children())
6149 for (
unsigned int c = 0; c < 2; ++c)
6150 Assert(cell->line(
line_n)->child(c)->user_flag_set() ==
false,
6159 std::vector<bool> &vertices_used) {
6177 for (; line !=
endl; ++line)
6179 if (line->user_flag_set() ==
false)
6193 const std::array<raw_line_iterator, 2> children{
6204 children[0]->set_bounding_object_indices(
6206 children[1]->set_bounding_object_indices(
6209 const auto manifold_id = line->manifold_id();
6210 const auto boundary_id = line->boundary_id();
6211 for (
const auto &child : children)
6213 child->set_used_flag();
6214 child->clear_children();
6216 child->clear_user_flag();
6217 child->set_boundary_id_internal(boundary_id);
6218 child->set_manifold_id(manifold_id);
6221 line->clear_user_flag();
6231 for (; quad !=
endq; ++quad)
6233 if (quad->user_flag_set() ==
false)
6240 std::array<raw_line_iterator, 4>
new_lines;
6243 for (
unsigned int l = 0; l < 2; ++l)
6254 for (
unsigned int l = 0; l < 3; ++l)
6265 for (
const unsigned int line : quad->line_indices())
6271 std::array<raw_quad_iterator, 4>
new_quads;
6272 for (
unsigned int q = 0;
q < 2; ++
q)
6296 for (
const auto i : quad->vertex_indices())
6299 for (
const auto i : quad->line_indices())
6310 quad->center(
true,
true);
6314 std::array<raw_line_iterator, 12> lines;
6315 unsigned int n_lines = 0;
6316 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6317 for (
unsigned int c = 0; c < 2; ++c)
6318 lines[n_lines++] = quad->line(l)->child(
6321 for (
unsigned int l = 0; l < quad->
n_lines(); ++l)
6324 std::array<int, 12> line_indices;
6325 for (
unsigned int i = 0; i < n_lines; ++i)
6326 line_indices[i] = lines[i]->
index();
6370 {{{{{0, 3}}, {{3, 5}}, {{5, 0}}, {{X, X}}}},
6371 {{{{3, 1}}, {{1, 4}}, {{4, 3}}, {{X, X}}}},
6372 {{{{5, 4}}, {{4, 2}}, {{2, 5}}, {{X, X}}}},
6373 {{{{3, 4}}, {{4, 5}}, {{5, 3}}, {{X, X}}}}}};
6375 const auto &line_vertices =
6379 const auto &quad_lines =
6384 for (
unsigned int i = 0,
j = 2 * quad->
n_lines();
6389 new_line->set_bounding_object_indices(
6396 new_line->set_boundary_id_internal(quad->boundary_id());
6397 new_line->set_manifold_id(quad->manifold_id());
6401 for (
unsigned int i = 0; i <
new_quads.size(); ++i)
6411 new_quad->set_bounding_object_indices(
6412 {line_indices[quad_lines[i][0]],
6413 line_indices[quad_lines[i][1]],
6414 line_indices[quad_lines[i][2]]});
6416 new_quad->set_bounding_object_indices(
6417 {line_indices[quad_lines[i][0]],
6418 line_indices[quad_lines[i][1]],
6419 line_indices[quad_lines[i][2]],
6420 line_indices[quad_lines[i][3]]});
6428 new_quad->set_boundary_id_internal(quad->boundary_id());
6429 new_quad->set_manifold_id(quad->manifold_id());
6432 std::set<unsigned int> s;
6440 for (
const auto f :
new_quad->line_indices())
6442 const std::array<unsigned int, 2> vertices_0 = {
6443 {lines[quad_lines[i][f]]->vertex_index(0),
6444 lines[quad_lines[i][f]]->vertex_index(1)}};
6446 const std::array<unsigned int, 2> vertices_1 = {
6450 const auto orientation =
6456 for (
const auto i : vertices_0)
6458 for (
const auto i : vertices_1)
6462 new_quad->set_line_orientation(f, orientation);
6476 {{{0, 2}}, {{1, 3}}, {{0, 1}}, {{2, 3}}}};
6478 for (
unsigned int i = 0; i < 4; ++i)
6479 for (
unsigned int j = 0;
j < 2; ++
j)
6481 ->set_line_orientation(i, quad->line_orientation(i));
6484 quad->clear_user_flag();
6499 hex->level() >=
static_cast<int>(
level),
6503 hex->level() ==
static_cast<int>(
level);
6506 if (hex->refine_flag_set() ==
6513 hex->clear_refine_flag();
6514 hex->set_refinement_case(
ref_case);
6535 std::array<raw_line_iterator, 6>
new_lines;
6549 new_lines[i]->set_manifold_id(hex->manifold_id());
6552 std::array<raw_quad_iterator, 12>
new_quads;
6572 new_quad->set_boundary_id_internal(
6574 new_quad->set_manifold_id(hex->manifold_id());
6575 for (
const auto j :
new_quads[i]->line_indices())
6601 ->reference_cell[
new_hex->index()] =
6609 new_hex->set_material_id(hex->material_id());
6610 new_hex->set_manifold_id(hex->manifold_id());
6611 new_hex->set_subdomain_id(hex->subdomain_id());
6614 new_hex->set_parent(hex->index());
6619 for (
const auto f :
new_hex->face_indices())
6620 new_hex->set_combined_face_orientation(
6623 for (
unsigned int i = 0; i <
n_new_hexes / 2; ++i)
6624 hex->set_children(2 * i,
new_hexes[2 * i]->index());
6636 const unsigned int n_vertices =
6638 for (
unsigned int i = 0; i < n_vertices; ++i)
6641 const std::array<unsigned int, 12> line_indices =
6642 TriaAccessorImplementation::Implementation::
6643 get_line_indices_of_cell(*hex);
6655 for (
unsigned int l = 0; l < n_lines; ++l)
6665 for (
const unsigned int i : hex->face_indices())
6667 hex->face(i)->child(0)->vertex_index(3);
6676 hex->center(
true,
true);
6692 new_lines[i]->set_bounding_object_indices(
6702 static constexpr ::ndarray<unsigned int, 3, 2>
6714 std::numeric_limits<double>::infinity();
6746 hex->set_refinement_case(
6749 new_lines[0]->set_bounding_object_indices(
6758 boost::container::small_vector<raw_line_iterator, 30>
6764 for (
unsigned int f = 0,
k = 0; f < 6; ++f)
6765 for (
unsigned int c = 0; c < 4; ++c, ++
k)
6770 {{{0, 1}}, {{3, 0}}, {{0, 3}}, {{3, 2}}}};
6776 standard_to_real_face_vertex(
6778 hex->face_orientation(f),
6780 hex->face_rotation(f)))
6782 standard_to_real_face_line(
6784 hex->face_orientation(f),
6786 hex->face_rotation(f)));
6789 for (
unsigned int i = 0,
k = 24; i < 6; ++i, ++
k)
6808 for (
unsigned int f = 0; f < 4; ++f)
6809 for (
unsigned int l = 0; l < 3; ++l, ++
k)
6813 array<std::array<unsigned int, 3>, 6>
6814 table = {{{{1, 0, 2}},
6822 hex->combined_face_orientation(f);
6835 boost::container::small_vector<unsigned int, 30>
6849 hex->reference_cell().new_isotropic_child_face_lines(
6863 hex->reference_cell()
6864 .new_isotropic_child_face_line_vertices(
6869 {{{0, 2}}, {{2, 0}}, {{3, 3}}, {{1, 1}}}};
6876 new_quad->set_bounding_object_indices(
6881 new_quad->set_bounding_object_indices(
6900 const unsigned int l =
6906 const std::array<unsigned int, 2> vertices_0 = {
6910 ->vertex_index(1)}};
6912 const std::array<unsigned int, 2> vertices_1 = {
6916 const auto orientation =
6921 new_quad->set_line_orientation(l, orientation);
6930 ->set_line_orientation(l, orientation);
6945 for (
unsigned int c = 0; c < 4; ++c, ++
k)
6947 hex->face(f)->isotropic_child_index(
6950 hex->face_orientation(f),
6952 hex->face_rotation(f)));
6966 for (
unsigned int c = 0; c < 4; ++c, ++
k)
6969 hex->combined_face_orientation(f);
6973 .standard_to_real_face_vertex(
6991 hex->reference_cell().new_isotropic_child_cell_faces(
6994 for (
unsigned int c = 0;
7002 new_hex->set_bounding_object_indices(
7011 for (
const auto f :
new_hex->face_indices())
7013 const auto &face =
new_hex->face(f);
7015 Assert(face->n_vertices() == 3,
7018 const std::array<unsigned int, 3> vertices_0 = {
7019 {face->vertex_index(0),
7020 face->vertex_index(1),
7021 face->vertex_index(2)}};
7031 hex->reference_cell()
7032 .new_isotropic_child_cell_vertices(
7037 const std::array<unsigned int, 3> vertices_1 = {
7042 .face_to_cell_vertices(f, 0, 1)]],
7046 .face_to_cell_vertices(f, 1, 1)]],
7050 .face_to_cell_vertices(f, 2, 1)]],
7053 new_hex->set_combined_face_orientation(
7055 face->reference_cell()
7056 .get_combined_orientation(
7061 else if (
new_hex->n_faces() == 6)
7062 new_hex->set_bounding_object_indices(
7085 for (
const auto f : hex->face_indices())
7088 hex->combined_face_orientation(f);
7089 for (
unsigned int c = 0; c < 4; ++c)
7091 ->set_combined_face_orientation(
7097 if (check_for_distorted_cells &&
7114 template <
int spacedim>
7117 const bool check_for_distorted_cells)
7119 const unsigned int dim = 3;
7126 for (; cell !=
endc; ++cell)
7142 check_for_distorted_cells);
7153 for (
const auto &cell :
triangulation.active_cell_iterators_on_level(
7155 if (cell->refine_flag_set())
7172 line->clear_user_flag();
7177 quad->clear_user_flag();
7211 for (
const auto &
acell :
7213 if (
acell->refine_flag_set())
7254 for (
const unsigned int face :
7265 acell->face_orientation(face),
7266 acell->face_flip(face),
7267 acell->face_rotation(face));
7275 if (
aface->n_active_descendants() < 4)
7278 aface->set_user_flag();
7294 aface->refinement_case() ==
7303 for (
unsigned int line = 0;
7308 !
acell->line(line)->has_children())
7309 acell->line(line)->set_user_flag();
7338 if (quad->user_flag_set())
7348 if (quad->user_index())
7366 if (quad->has_children())
7368 Assert(quad->refinement_case() ==
7373 (quad->child(0)->line_index(1) + 1 !=
7374 quad->child(2)->line_index(1))) ||
7377 (quad->child(0)->line_index(3) + 1 !=
7378 quad->child(1)->line_index(3))))
7388 if (line->user_flag_set())
7432 for (
const auto &cell :
triangulation.active_cell_iterators())
7433 if (!cell->refine_flag_set())
7434 for (
unsigned int line = 0;
7437 if (cell->line(line)->has_children())
7438 for (
unsigned int c = 0; c < 2; ++c)
7439 Assert(cell->line(line)->child(c)->user_flag_set() ==
false,
7462 for (; line !=
endl; ++line)
7463 if (line->user_flag_set())
7474 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
7502 children[0]->set_bounding_object_indices(
7504 children[1]->set_bounding_object_indices(
7507 children[0]->set_used_flag();
7508 children[1]->set_used_flag();
7509 children[0]->clear_children();
7510 children[1]->clear_children();
7513 children[0]->clear_user_flag();
7514 children[1]->clear_user_flag();
7516 children[0]->set_boundary_id_internal(line->boundary_id());
7517 children[1]->set_boundary_id_internal(line->boundary_id());
7519 children[0]->set_manifold_id(line->manifold_id());
7520 children[1]->set_manifold_id(line->manifold_id());
7525 line->clear_user_flag();
7555 for (
unsigned int loop = 0; loop < 2; ++loop)
7568 for (; quad !=
endq; ++quad)
7570 if (quad->user_index())
7585 Assert(quad->refinement_case() ==
7587 quad->refinement_case() ==
7592 Assert(quad->user_index() ==
7594 quad->user_index() ==
7624 quad->line(2)->child(0)->vertex_index(1);
7626 quad->line(3)->child(0)->vertex_index(1);
7631 quad->line(0)->child(0)->vertex_index(1);
7633 quad->line(1)->child(0)->vertex_index(1);
7636 new_line->set_bounding_object_indices(
7642 new_line->set_boundary_id_internal(quad->boundary_id());
7643 new_line->set_manifold_id(quad->manifold_id());
7662 new_quads[0]->set_bounding_object_indices(
7663 {
static_cast<int>(quad->line_index(0)),
7673 new_quads[1]->set_bounding_object_indices(
7675 static_cast<int>(quad->line_index(1)),
7687 new_quads[0]->set_bounding_object_indices(
7696 static_cast<int>(quad->line_index(2)),
7698 new_quads[1]->set_bounding_object_indices(
7708 static_cast<int>(quad->line_index(3))});
7717 new_quad->set_boundary_id_internal(quad->boundary_id());
7718 new_quad->set_manifold_id(quad->manifold_id());
7722 for (
unsigned int j = 0;
7733 0, quad->line_orientation(0));
7735 2, quad->line_orientation(2));
7737 1, quad->line_orientation(1));
7739 3, quad->line_orientation(3));
7743 3, quad->line_orientation(3));
7745 2, quad->line_orientation(2));
7750 1, quad->line_orientation(1));
7752 0, quad->line_orientation(0));
7758 if (quad->refinement_case() ==
7803 spacedim>::raw_line_iterator
7822 for (
unsigned int q = 0;
7825 for (
unsigned int l = 0;
7831 .get_bounding_object_indices(
q)[l];
7834 .get_bounding_object_indices(
q)[l] =
7838 .get_bounding_object_indices(
q)[l] =
7843 for (
unsigned int i = 0; i < 2; ++i)
7848 new_child[i]->set_bounding_object_indices(
7876 0, quad->child(0)->line_index(1));
7878 quad->child(2)->line(1),
7919 for (
unsigned int l = 0;
7922 for (
unsigned int h = 0;
7926 for (
const unsigned int q :
7929 const int face_index =
7931 ->cells.get_bounding_object_indices(
7935 ->cells.get_bounding_object_indices(
7939 ->cells.get_bounding_object_indices(
7974 switch_1->set_bounding_object_indices(
7987 switch_1->set_boundary_id_internal(
8007 switch_2->set_bounding_object_indices(
8020 switch_2->set_boundary_id_internal(
8039 new_quads[0]->set_children(0, quad->child_index(0));
8042 new_quads[1]->set_children(0, quad->child_index(2));
8048 new_quads[0]->set_children(0, quad->child_index(0));
8051 new_quads[1]->set_children(0, quad->child_index(2));
8053 0, quad->child(0)->line_index(3));
8055 quad->child(1)->line(3),
8058 quad->clear_children();
8071 if (quad->user_flag_set())
8087 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
8095 quad->refinement_case();
8101 quad->child(0)->set_user_index(
8103 quad->child(1)->set_user_index(
8153 children[0]->set_bounding_object_indices(
8156 children[1]->set_bounding_object_indices(
8160 children[0]->set_used_flag();
8161 children[1]->set_used_flag();
8162 children[0]->clear_children();
8163 children[1]->clear_children();
8166 children[0]->clear_user_flag();
8167 children[1]->clear_user_flag();
8169 children[0]->set_boundary_id_internal(
8171 children[1]->set_boundary_id_internal(
8174 children[0]->set_manifold_id(
8176 children[1]->set_manifold_id(
8183 quad->clear_user_flag();
8213 quad->center(
true,
true);
8222 for (
unsigned int i = 0; i < 4; ++i)
8259 quad->line(0)->child(0)->vertex_index(1),
8260 quad->line(1)->child(0)->vertex_index(1),
8261 quad->line(2)->child(0)->vertex_index(1),
8262 quad->line(3)->child(0)->vertex_index(1),
8265 new_lines[0]->set_bounding_object_indices(
8267 new_lines[1]->set_bounding_object_indices(
8269 new_lines[2]->set_bounding_object_indices(
8271 new_lines[3]->set_bounding_object_indices(
8280 new_line->set_boundary_id_internal(quad->boundary_id());
8281 new_line->set_manifold_id(quad->manifold_id());
8294 const int line_indices[12] = {
8356 new_quads[0]->set_bounding_object_indices(
8361 new_quads[1]->set_bounding_object_indices(
8366 new_quads[2]->set_bounding_object_indices(
8371 new_quads[3]->set_bounding_object_indices(
8382 new_quad->set_boundary_id_internal(quad->boundary_id());
8383 new_quad->set_manifold_id(quad->manifold_id());
8387 for (
unsigned int j = 0;
8398 0, quad->line_orientation(0));
8400 2, quad->line_orientation(2));
8402 1, quad->line_orientation(1));
8404 2, quad->line_orientation(2));
8406 0, quad->line_orientation(0));
8408 3, quad->line_orientation(3));
8410 1, quad->line_orientation(1));
8412 3, quad->line_orientation(3));
8416 quad->clear_user_flag();
8441 for (; hex !=
endh; ++hex)
8442 if (hex->refine_flag_set())
8450 hex->clear_refine_flag();
8451 hex->set_refinement_case(
ref_case);
8512 new_lines[i]->set_manifold_id(hex->manifold_id());
8536 new_quads[i]->set_manifold_id(hex->manifold_id());
8539 for (
unsigned int j = 0;
8571 new_hexes[i]->set_material_id(hex->material_id());
8572 new_hexes[i]->set_manifold_id(hex->manifold_id());
8588 for (
const unsigned int f :
8590 new_hexes[i]->set_combined_face_orientation(
8594 for (
unsigned int i = 0; i <
n_new_hexes / 2; ++i)
8595 hex->set_children(2 * i,
new_hexes[2 * i]->index());
8602 const bool f_or[6] = {hex->face_orientation(0),
8603 hex->face_orientation(1),
8604 hex->face_orientation(2),
8605 hex->face_orientation(3),
8606 hex->face_orientation(4),
8607 hex->face_orientation(5)};
8610 const bool f_fl[6] = {hex->face_flip(0),
8618 const bool f_ro[6] = {hex->face_rotation(0),
8619 hex->face_rotation(1),
8620 hex->face_rotation(2),
8621 hex->face_rotation(3),
8622 hex->face_rotation(4),
8623 hex->face_rotation(5)};
8627 hex->combined_face_orientation(0),
8628 hex->combined_face_orientation(1),
8629 hex->combined_face_orientation(2),
8630 hex->combined_face_orientation(3),
8631 hex->combined_face_orientation(4),
8632 hex->combined_face_orientation(5)};
8730 hex->face(2)->child(0)->line(
8731 (hex->face(2)->refinement_case() ==
8735 hex->face(3)->child(0)->line(
8736 (hex->face(3)->refinement_case() ==
8740 hex->face(4)->child(0)->line(
8741 (hex->face(4)->refinement_case() ==
8745 hex->face(5)->child(0)->line(
8746 (hex->face(5)->refinement_case() ==
8752 unsigned int line_indices[4];
8753 for (
unsigned int i = 0; i < 4; ++i)
8754 line_indices[i] = lines[i]->
index();
8768 hex->line(2)->child(0)->vertex_index(1),
8769 hex->line(7)->child(0)->vertex_index(1)};
8771 for (
unsigned int i = 0; i < 4; ++i)
8772 if (lines[i]->vertex_index(i % 2) ==
8774 line_orientation[i] =
8779 Assert(lines[i]->vertex_index((i + 1) % 2) ==
8782 line_orientation[i] =
8788 new_quads[0]->set_bounding_object_indices(
8795 0, line_orientation[0]);
8797 1, line_orientation[1]);
8799 2, line_orientation[2]);
8801 3, line_orientation[3]);
8837 hex->face(0)->index(),
8839 hex->face(1)->index(),
8841 hex->face(2)->child_index(
8844 hex->face(2)->child_index(
8849 hex->face(3)->child_index(
8852 hex->face(3)->child_index(
8857 hex->face(4)->child_index(
8860 hex->face(4)->child_index(
8865 hex->face(5)->child_index(
8868 hex->face(5)->child_index(
8875 new_hexes[0]->set_bounding_object_indices(
8882 new_hexes[1]->set_bounding_object_indices(
8958 hex->face(0)->child(0)->line(
8959 (hex->face(0)->refinement_case() ==
8963 hex->face(1)->child(0)->line(
8964 (hex->face(1)->refinement_case() ==
8968 hex->face(4)->child(0)->line(
8969 (hex->face(4)->refinement_case() ==
8973 hex->face(5)->child(0)->line(
8974 (hex->face(5)->refinement_case() ==
8980 unsigned int line_indices[4];
8981 for (
unsigned int i = 0; i < 4; ++i)
8982 line_indices[i] = lines[i]->
index();
8996 hex->line(0)->child(0)->vertex_index(1),
8997 hex->line(5)->child(0)->vertex_index(1)};
8999 for (
unsigned int i = 0; i < 4; ++i)
9000 if (lines[i]->vertex_index(i % 2) ==
9002 line_orientation[i] =
9007 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9010 line_orientation[i] =
9016 new_quads[0]->set_bounding_object_indices(
9023 0, line_orientation[2]);
9025 1, line_orientation[3]);
9027 2, line_orientation[0]);
9029 3, line_orientation[1]);
9065 hex->face(0)->child_index(
9068 hex->face(0)->child_index(
9073 hex->face(1)->child_index(
9076 hex->face(1)->child_index(
9081 hex->face(2)->index(),
9083 hex->face(3)->index(),
9085 hex->face(4)->child_index(
9088 hex->face(4)->child_index(
9093 hex->face(5)->child_index(
9096 hex->face(5)->child_index(
9103 new_hexes[0]->set_bounding_object_indices(
9110 new_hexes[1]->set_bounding_object_indices(
9188 hex->face(0)->child(0)->line(
9189 (hex->face(0)->refinement_case() ==
9193 hex->face(1)->child(0)->line(
9194 (hex->face(1)->refinement_case() ==
9198 hex->face(2)->child(0)->line(
9199 (hex->face(2)->refinement_case() ==
9203 hex->face(3)->child(0)->line(
9204 (hex->face(3)->refinement_case() ==
9210 unsigned int line_indices[4];
9211 for (
unsigned int i = 0; i < 4; ++i)
9212 line_indices[i] = lines[i]->
index();
9229 for (
unsigned int i = 0; i < 4; ++i)
9230 if (lines[i]->vertex_index(i % 2) ==
9232 line_orientation[i] =
9237 Assert(lines[i]->vertex_index((i + 1) % 2) ==
9240 line_orientation[i] =
9246 new_quads[0]->set_bounding_object_indices(
9253 0, line_orientation[0]);
9255 1, line_orientation[1]);
9257 2, line_orientation[2]);
9259 3, line_orientation[3]);
9296 hex->face(0)->child_index(
9299 hex->face(0)->child_index(
9304 hex->face(1)->child_index(
9307 hex->face(1)->child_index(
9312 hex->face(2)->child_index(
9315 hex->face(2)->child_index(
9320 hex->face(3)->child_index(
9323 hex->face(3)->child_index(
9328 hex->face(4)->index(),
9330 hex->face(5)->index()
9333 new_hexes[0]->set_bounding_object_indices(
9340 new_hexes[1]->set_bounding_object_indices(
9372 new_lines[0]->set_bounding_object_indices(
9442 spacedim>::raw_line_iterator lines[13] = {
9443 hex->face(0)->child(0)->line(
9444 (hex->face(0)->refinement_case() ==
9448 hex->face(1)->child(0)->line(
9449 (hex->face(1)->refinement_case() ==
9453 hex->face(2)->child(0)->line(
9454 (hex->face(2)->refinement_case() ==
9458 hex->face(3)->child(0)->line(
9459 (hex->face(3)->refinement_case() ==
9525 unsigned int line_indices[13];
9526 for (
unsigned int i = 0; i < 13; ++i)
9527 line_indices[i] = lines[i]->
index();
9539 hex->line(0)->child(0)->vertex_index(1),
9540 hex->line(1)->child(0)->vertex_index(1),
9541 hex->line(2)->child(0)->vertex_index(1),
9542 hex->line(3)->child(0)->vertex_index(1),
9548 for (
unsigned int i = 0; i < 4; ++i)
9550 line_orientation[i] =
9555 Assert(lines[i]->vertex_index(1) ==
9558 line_orientation[i] =
9568 for (
unsigned int i = 4; i < 12; ++i)
9569 if (lines[i]->vertex_index((i + 1) % 2) ==
9571 hex->face(3 + i / 4)))
9572 line_orientation[i] =
9577 Assert(lines[i]->vertex_index(i % 2) ==
9579 hex->face(3 + i / 4))),
9581 line_orientation[i] =
9587 line_orientation[12] =
9613 new_quads[0]->set_bounding_object_indices(
9618 new_quads[1]->set_bounding_object_indices(
9623 new_quads[2]->set_bounding_object_indices(
9628 new_quads[3]->set_bounding_object_indices(
9635 0, line_orientation[2]);
9637 2, line_orientation[4]);
9639 3, line_orientation[8]);
9642 1, line_orientation[3]);
9644 2, line_orientation[5]);
9646 3, line_orientation[9]);
9649 0, line_orientation[6]);
9651 1, line_orientation[10]);
9653 2, line_orientation[0]);
9656 0, line_orientation[7]);
9658 1, line_orientation[11]);
9660 3, line_orientation[1]);
9699 hex->face(0)->child_index(
9702 hex->face(0)->child_index(
9707 hex->face(1)->child_index(
9710 hex->face(1)->child_index(
9715 hex->face(2)->child_index(
9718 hex->face(2)->child_index(
9723 hex->face(3)->child_index(
9726 hex->face(3)->child_index(
9731 hex->face(4)->isotropic_child_index(
9734 hex->face(4)->isotropic_child_index(
9737 hex->face(4)->isotropic_child_index(
9740 hex->face(4)->isotropic_child_index(
9744 hex->face(5)->isotropic_child_index(
9747 hex->face(5)->isotropic_child_index(
9750 hex->face(5)->isotropic_child_index(
9753 hex->face(5)->isotropic_child_index(
9757 new_hexes[0]->set_bounding_object_indices(
9764 new_hexes[1]->set_bounding_object_indices(
9771 new_hexes[2]->set_bounding_object_indices(
9778 new_hexes[3]->set_bounding_object_indices(
9810 new_lines[0]->set_bounding_object_indices(
9880 spacedim>::raw_line_iterator lines[13] = {
9881 hex->face(0)->child(0)->line(
9882 (hex->face(0)->refinement_case() ==
9886 hex->face(1)->child(0)->line(
9887 (hex->face(1)->refinement_case() ==
9891 hex->face(4)->child(0)->line(
9892 (hex->face(4)->refinement_case() ==
9896 hex->face(5)->child(0)->line(
9897 (hex->face(5)->refinement_case() ==
9963 unsigned int line_indices[13];
9964 for (
unsigned int i = 0; i < 13; ++i)
9965 line_indices[i] = lines[i]->
index();
9977 hex->line(8)->child(0)->vertex_index(1),
9978 hex->line(9)->child(0)->vertex_index(1),
9979 hex->line(2)->child(0)->vertex_index(1),
9980 hex->line(6)->child(0)->vertex_index(1),
9985 for (
unsigned int i = 0; i < 4; ++i)
9987 line_orientation[i] =
9992 Assert(lines[i]->vertex_index(1) ==
9995 line_orientation[i] =
10005 for (
unsigned int i = 4; i < 12; ++i)
10006 if (lines[i]->vertex_index((i + 1) % 2) ==
10008 hex->face(1 + i / 4)))
10009 line_orientation[i] =
10015 Assert(lines[i]->vertex_index(i % 2) ==
10017 hex->face(1 + i / 4))),
10019 line_orientation[i] =
10025 line_orientation[12] =
10052 new_quads[0]->set_bounding_object_indices(
10056 line_indices[10]});
10057 new_quads[1]->set_bounding_object_indices(
10061 line_indices[11]});
10062 new_quads[2]->set_bounding_object_indices(
10066 line_indices[12]});
10067 new_quads[3]->set_bounding_object_indices(
10074 0, line_orientation[0]);
10076 2, line_orientation[6]);
10078 3, line_orientation[10]);
10081 1, line_orientation[1]);
10083 2, line_orientation[7]);
10085 3, line_orientation[11]);
10088 0, line_orientation[4]);
10090 1, line_orientation[8]);
10092 2, line_orientation[2]);
10095 0, line_orientation[5]);
10097 1, line_orientation[9]);
10099 3, line_orientation[3]);
10139 hex->face(0)->child_index(
10142 hex->face(0)->child_index(
10147 hex->face(1)->child_index(
10150 hex->face(1)->child_index(
10155 hex->face(2)->isotropic_child_index(
10158 hex->face(2)->isotropic_child_index(
10161 hex->face(2)->isotropic_child_index(
10164 hex->face(2)->isotropic_child_index(
10168 hex->face(3)->isotropic_child_index(
10171 hex->face(3)->isotropic_child_index(
10174 hex->face(3)->isotropic_child_index(
10177 hex->face(3)->isotropic_child_index(
10181 hex->face(4)->child_index(
10184 hex->face(4)->child_index(
10189 hex->face(5)->child_index(
10192 hex->face(5)->child_index(
10206 new_hexes[0]->set_bounding_object_indices(
10213 new_hexes[1]->set_bounding_object_indices(
10220 new_hexes[2]->set_bounding_object_indices(
10227 new_hexes[3]->set_bounding_object_indices(
10260 new_lines[0]->set_bounding_object_indices(
10332 spacedim>::raw_line_iterator lines[13] = {
10333 hex->face(2)->child(0)->line(
10334 (hex->face(2)->refinement_case() ==
10338 hex->face(3)->child(0)->line(
10339 (hex->face(3)->refinement_case() ==
10343 hex->face(4)->child(0)->line(
10344 (hex->face(4)->refinement_case() ==
10348 hex->face(5)->child(0)->line(
10349 (hex->face(5)->refinement_case() ==
10415 unsigned int line_indices[13];
10417 for (
unsigned int i = 0; i < 13; ++i)
10418 line_indices[i] = lines[i]->
index();
10430 hex->line(8)->child(0)->vertex_index(1),
10431 hex->line(10)->child(0)->vertex_index(1),
10432 hex->line(0)->child(0)->vertex_index(1),
10433 hex->line(4)->child(0)->vertex_index(1),
10438 for (
unsigned int i = 0; i < 4; ++i)
10440 line_orientation[i] =
10445 Assert(lines[i]->vertex_index(1) ==
10448 line_orientation[i] =
10458 for (
unsigned int i = 4; i < 12; ++i)
10459 if (lines[i]->vertex_index((i + 1) % 2) ==
10461 hex->face(i / 4 - 1)))
10462 line_orientation[i] =
10467 Assert(lines[i]->vertex_index(i % 2) ==
10469 hex->face(i / 4 - 1))),
10471 line_orientation[i] =
10476 line_orientation[12] =
10497 new_quads[0]->set_bounding_object_indices(
10501 line_indices[12]});
10502 new_quads[1]->set_bounding_object_indices(
10507 new_quads[2]->set_bounding_object_indices(
10512 new_quads[3]->set_bounding_object_indices(
10519 0, line_orientation[6]);
10521 1, line_orientation[10]);
10523 2, line_orientation[0]);
10526 0, line_orientation[7]);
10528 1, line_orientation[11]);
10530 3, line_orientation[1]);
10533 0, line_orientation[2]);
10535 2, line_orientation[4]);
10537 3, line_orientation[8]);
10540 1, line_orientation[3]);
10542 2, line_orientation[5]);
10544 3, line_orientation[9]);
10584 hex->face(0)->isotropic_child_index(
10587 hex->face(0)->isotropic_child_index(
10590 hex->face(0)->isotropic_child_index(
10593 hex->face(0)->isotropic_child_index(
10597 hex->face(1)->isotropic_child_index(
10600 hex->face(1)->isotropic_child_index(
10603 hex->face(1)->isotropic_child_index(
10606 hex->face(1)->isotropic_child_index(
10610 hex->face(2)->child_index(
10613 hex->face(2)->child_index(
10618 hex->face(3)->child_index(
10621 hex->face(3)->child_index(
10626 hex->face(4)->child_index(
10629 hex->face(4)->child_index(
10634 hex->face(5)->child_index(
10637 hex->face(5)->child_index(
10642 new_hexes[0]->set_bounding_object_indices(
10649 new_hexes[1]->set_bounding_object_indices(
10656 new_hexes[2]->set_bounding_object_indices(
10663 new_hexes[3]->set_bounding_object_indices(
10705 "Internal error: During refinement, the triangulation wants to access an element of the 'vertices' array but it turns out that the array is not large enough."));
10716 hex->center(
true,
true);
10746 new_lines[0]->set_bounding_object_indices(
10748 new_lines[1]->set_bounding_object_indices(
10750 new_lines[2]->set_bounding_object_indices(
10752 new_lines[3]->set_bounding_object_indices(
10754 new_lines[4]->set_bounding_object_indices(
10756 new_lines[5]->set_bounding_object_indices(
10826 spacedim>::raw_line_iterator lines[30] = {
11009 unsigned int line_indices[30];
11010 for (
unsigned int i = 0; i < 30; ++i)
11011 line_indices[i] = lines[i]->
index();
11026 for (
unsigned int i = 0; i < 24; ++i)
11027 if (lines[i]->vertex_index((i + 1) % 2) ==
11029 line_orientation[i] =
11035 Assert(lines[i]->vertex_index(i % 2) ==
11038 line_orientation[i] =
11044 for (
unsigned int i = 24; i < 30; ++i)
11045 line_orientation[i] =
11078 new_quads[0]->set_bounding_object_indices(
11082 line_indices[24]});
11083 new_quads[1]->set_bounding_object_indices(
11087 line_indices[25]});
11088 new_quads[2]->set_bounding_object_indices(
11092 line_indices[20]});
11093 new_quads[3]->set_bounding_object_indices(
11097 line_indices[21]});
11098 new_quads[4]->set_bounding_object_indices(
11102 line_indices[28]});
11103 new_quads[5]->set_bounding_object_indices(
11107 line_indices[29]});
11108 new_quads[6]->set_bounding_object_indices(
11113 new_quads[7]->set_bounding_object_indices(
11118 new_quads[8]->set_bounding_object_indices(
11122 line_indices[26]});
11123 new_quads[9]->set_bounding_object_indices(
11127 line_indices[27]});
11128 new_quads[10]->set_bounding_object_indices(
11132 line_indices[12]});
11133 new_quads[11]->set_bounding_object_indices(
11137 line_indices[13]});
11143 0, line_orientation[10]);
11145 2, line_orientation[16]);
11148 1, line_orientation[14]);
11150 2, line_orientation[17]);
11153 0, line_orientation[11]);
11155 3, line_orientation[20]);
11158 1, line_orientation[15]);
11160 3, line_orientation[21]);
11163 0, line_orientation[18]);
11165 2, line_orientation[0]);
11168 1, line_orientation[22]);
11170 2, line_orientation[1]);
11173 0, line_orientation[19]);
11175 3, line_orientation[4]);
11178 1, line_orientation[23]);
11180 3, line_orientation[5]);
11183 0, line_orientation[2]);
11185 2, line_orientation[8]);
11188 1, line_orientation[6]);
11190 2, line_orientation[9]);
11193 0, line_orientation[3]);
11195 3, line_orientation[12]);
11198 1, line_orientation[7]);
11200 3, line_orientation[13]);
11255 hex->face(0)->isotropic_child_index(
11258 hex->face(0)->isotropic_child_index(
11261 hex->face(0)->isotropic_child_index(
11264 hex->face(0)->isotropic_child_index(
11268 hex->face(1)->isotropic_child_index(
11271 hex->face(1)->isotropic_child_index(
11274 hex->face(1)->isotropic_child_index(
11277 hex->face(1)->isotropic_child_index(
11281 hex->face(2)->isotropic_child_index(
11284 hex->face(2)->isotropic_child_index(
11287 hex->face(2)->isotropic_child_index(
11290 hex->face(2)->isotropic_child_index(
11294 hex->face(3)->isotropic_child_index(
11297 hex->face(3)->isotropic_child_index(
11300 hex->face(3)->isotropic_child_index(
11303 hex->face(3)->isotropic_child_index(
11307 hex->face(4)->isotropic_child_index(
11310 hex->face(4)->isotropic_child_index(
11313 hex->face(4)->isotropic_child_index(
11316 hex->face(4)->isotropic_child_index(
11320 hex->face(5)->isotropic_child_index(
11323 hex->face(5)->isotropic_child_index(
11326 hex->face(5)->isotropic_child_index(
11329 hex->face(5)->isotropic_child_index(
11334 new_hexes[0]->set_bounding_object_indices(
11341 new_hexes[1]->set_bounding_object_indices(
11348 new_hexes[2]->set_bounding_object_indices(
11355 new_hexes[3]->set_bounding_object_indices(
11364 new_hexes[4]->set_bounding_object_indices(
11371 new_hexes[5]->set_bounding_object_indices(
11378 new_hexes[6]->set_bounding_object_indices(
11385 new_hexes[7]->set_bounding_object_indices(
11425 for (
unsigned int s = 0;
11448 if (check_for_distorted_cells &&
11485 template <
int spacedim>
11492 template <
int dim,
int spacedim>
11499 if (spacedim > dim)
11503 if (cell->at_boundary() && cell->refine_flag_set() &&
11504 cell->refine_flag_set() !=
11511 for (
const unsigned int face_no :
11513 if (cell->face(
face_no)->at_boundary())
11524 spacedim>::face_iterator
11532 cell->reference_cell()
11535 .transform_real_to_unit_cell(cell,
new_bound);
11545 const double dist =
11554 cell->flag_for_face_refinement(
face_no);
11573 template <
int dim,
int spacedim>
11578 ExcMessage(
"Wrong function called -- there should "
11579 "be a specialization."));
11583 template <
int spacedim>
11588 const unsigned int dim = 3;
11589 using raw_line_iterator =
11612 if (cell->refine_flag_set())
11614 const std::array<unsigned int, 12> line_indices =
11615 TriaAccessorImplementation::Implementation::
11616 get_line_indices_of_cell(*cell);
11617 for (
unsigned int l = 0; l < cell->n_lines(); ++l)
11619 cell->refine_flag_set(), l) ==
11626 line->set_user_flag();
11629 else if (cell->has_children() &&
11630 !cell->child(0)->coarsen_flag_set())
11632 const std::array<unsigned int, 12> line_indices =
11633 TriaAccessorImplementation::Implementation::
11634 get_line_indices_of_cell(*cell);
11635 for (
unsigned int l = 0; l < cell->n_lines(); ++l)
11637 cell->refinement_case(), l) ==
11644 line->set_user_flag();
11647 else if (cell->has_children() &&
11648 cell->child(0)->coarsen_flag_set())
11649 cell->set_user_flag();
11661 const std::array<unsigned int, 12> line_indices =
11662 TriaAccessorImplementation::Implementation::
11663 get_line_indices_of_cell(*cell);
11664 for (
unsigned int l = 0; l < cell->n_lines(); ++l)
11666 raw_line_iterator line(&
triangulation, 0, line_indices[l]);
11667 if (line->has_children())
11678 for (
unsigned int c = 0; c < 2; ++c)
11680 Assert(line->child(c)->has_children() ==
false,
11683 if (line->child(c)->user_flag_set() &&
11685 cell->refine_flag_set(), l) ==
11689 cell->clear_coarsen_flag();
11696 allow_anisotropic_smoothing)
11697 cell->flag_for_line_refinement(l);
11699 cell->set_refine_flag();
11701 for (
unsigned int k = 0;
k < cell->n_lines();
11704 cell->refine_flag_set(), l) ==
11719 for (
unsigned int k = 0;
k < cell->n_lines();
11726 if (!line->has_children() &&
11728 line_refinement_case(
11729 cell->refine_flag_set(),
k) !=
11731 line->set_user_flag();
11762 if (cell->user_flag_set())
11764 const std::array<unsigned int, 12> line_indices =
11765 TriaAccessorImplementation::Implementation::
11766 get_line_indices_of_cell(*cell);
11767 for (
unsigned int l = 0; l < cell->n_lines(); ++l)
11772 if (line->has_children() &&
11773 (line->child(0)->user_flag_set() ||
11774 line->child(1)->user_flag_set()))
11776 for (
unsigned int c = 0; c < cell->n_children(); ++c)
11777 cell->child(c)->clear_coarsen_flag();
11778 cell->clear_user_flag();
11779 for (
unsigned int k = 0;
k < cell->n_lines(); ++
k)
11781 cell->refinement_case(),
k) ==
11806 template <
int dim,
int spacedim>
11826 const unsigned int n_subfaces =
11829 if (n_subfaces == 0 || cell->at_boundary(n))
11831 for (
unsigned int c = 0; c < n_subfaces; ++c)
11834 child = cell->child(
11839 if (!child->neighbor_is_coarser(n))
11878 template <
int spacedim>
11883 template <
int dim,
int spacedim>
11886 std::vector<std::pair<unsigned int, unsigned int>>
adjacent_cells(
11888 {numbers::invalid_unsigned_int, numbers::invalid_unsigned_int});
11890 const auto set_entry = [&](
const auto &face_index,
const auto &cell) {
11891 const std::pair<unsigned int, unsigned int>
cell_pair = {
11892 cell->level(), cell->index()};
11893 unsigned int index;
11900 index = 2 * face_index + 0;
11909 index = 2 * face_index + 1;
11916 [&](
const auto &face_index,
11920 if (test == std::pair<unsigned int, unsigned int>(cell->level(),
11934 for (
const auto &face : cell->face_iterators())
11938 if (cell->is_active() && face->has_children())
11939 for (
unsigned int c = 0; c < face->n_children(); ++c)
11940 set_entry(face->child(c)->index(), cell);
11944 for (
auto f : cell->face_indices())
11945 cell->set_neighbor(f,
get_entry(cell->face(f)->index(), cell));
11948 template <
int dim,
int spacedim>
11953 std::vector<unsigned int> & ,
11954 std::vector<unsigned int> & )
11959 template <
int dim,
int spacedim>
11962 const bool check_for_distorted_cells)
11968 template <
int dim,
int spacedim>
11976 template <
int dim,
int spacedim>
11984 template <
int dim,
int spacedim>
11996 template <
int dim,
int spacedim>
12008template <
int dim,
int spacedim>
12014template <
int dim,
int spacedim>
12017 const MeshSmoothing smooth_grid,
12018 const bool check_for_distorted_cells)
12019 : cell_attached_data({0, 0, {}, {}})
12020 , smooth_grid(smooth_grid)
12021 , anisotropic_refinement(
false)
12022 , check_for_distorted_cells(check_for_distorted_cells)
12026 vertex_to_boundary_id_map_1d =
12027 std::make_unique<std::map<unsigned int, types::boundary_id>>();
12028 vertex_to_manifold_id_map_1d =
12029 std::make_unique<std::map<unsigned int, types::manifold_id>>();
12033 signals.create.connect(signals.any_change);
12034 signals.post_refinement.connect(signals.any_change);
12035 signals.clear.connect(signals.any_change);
12036 signals.mesh_movement.connect(signals.any_change);
12041template <
int dim,
int spacedim>
12046 , smooth_grid(tria.smooth_grid)
12047 , reference_cells(std::move(tria.reference_cells))
12048 , periodic_face_pairs_level_0(std::move(tria.periodic_face_pairs_level_0))
12049 , periodic_face_map(std::move(tria.periodic_face_map))
12050 , levels(std::move(tria.levels))
12051 , faces(std::move(tria.faces))
12052 , vertices(std::move(tria.vertices))
12053 , vertices_used(std::move(tria.vertices_used))
12054 , manifolds(std::move(tria.manifolds))
12055 , anisotropic_refinement(tria.anisotropic_refinement)
12056 , check_for_distorted_cells(tria.check_for_distorted_cells)
12057 , number_cache(std::move(tria.number_cache))
12058 , vertex_to_boundary_id_map_1d(std::move(tria.vertex_to_boundary_id_map_1d))
12059 , vertex_to_manifold_id_map_1d(std::move(tria.vertex_to_manifold_id_map_1d))
12064 this->policy = tria.policy->clone();
12068template <
int dim,
int spacedim>
12075 smooth_grid = tria.smooth_grid;
12076 reference_cells = std::move(tria.reference_cells);
12077 periodic_face_pairs_level_0 = std::move(tria.periodic_face_pairs_level_0);
12078 periodic_face_map = std::move(tria.periodic_face_map);
12079 levels = std::move(tria.levels);
12080 faces = std::move(tria.faces);
12081 vertices = std::move(tria.vertices);
12082 vertices_used = std::move(tria.vertices_used);
12083 manifolds = std::move(tria.manifolds);
12084 anisotropic_refinement = tria.anisotropic_refinement;
12085 number_cache = tria.number_cache;
12086 vertex_to_boundary_id_map_1d = std::move(tria.vertex_to_boundary_id_map_1d);
12087 vertex_to_manifold_id_map_1d = std::move(tria.vertex_to_manifold_id_map_1d);
12092 this->policy = tria.policy->clone();
12099template <
int dim,
int spacedim>
12117 AssertNothrow((dim == 1) || (vertex_to_boundary_id_map_1d ==
nullptr),
12122 AssertNothrow((dim == 1) || (vertex_to_manifold_id_map_1d ==
nullptr),
12128template <
int dim,
int spacedim>
12136 clear_despite_subscriptions();
12137 periodic_face_pairs_level_0.clear();
12138 periodic_face_map.clear();
12139 reference_cells.clear();
12141 cell_attached_data = {0, 0, {}, {}};
12142 data_serializer.clear();
12145template <
int dim,
int spacedim>
12154template <
int dim,
int spacedim>
12158 return get_mpi_communicator();
12163template <
int dim,
int spacedim>
12168 return number_cache.active_cell_index_partitioner;
12173template <
int dim,
int spacedim>
12180 return number_cache.level_cell_index_partitioners[
level];
12185template <
int dim,
int spacedim>
12195template <
int dim,
int spacedim>
12200 return smooth_grid;
12205template <
int dim,
int spacedim>
12218template <
int dim,
int spacedim>
12233template <
int dim,
int spacedim>
12237 for (
auto &m : manifolds)
12244template <
int dim,
int spacedim>
12252 "Error: set_all_manifold_ids() can not be called on an empty Triangulation."));
12254 for (
const auto &cell :
this->active_cell_iterators())
12255 cell->set_all_manifold_ids(
m_number);
12259template <
int dim,
int spacedim>
12267 "Error: set_all_manifold_ids_on_boundary() can not be called on an empty Triangulation."));
12269 for (
const auto &cell :
this->active_cell_iterators())
12271 if (cell->face(f)->at_boundary())
12272 cell->face(f)->set_all_manifold_ids(
m_number);
12276template <
int dim,
int spacedim>
12285 "Error: set_all_manifold_ids_on_boundary() can not be called on an empty Triangulation."));
12289 for (
const auto &cell :
this->active_cell_iterators())
12293 if (cell->face(f)->at_boundary() &&
12297 cell->face(f)->set_manifold_id(
m_number);
12303 if (cell->line(e)->at_boundary() &&
12304 cell->line(e)->boundary_id() ==
b_id)
12307 cell->line(e)->set_manifold_id(
m_number);
12316template <
int dim,
int spacedim>
12323 return internal::TriangulationImplementation::
12324 get_default_flat_manifold<dim, spacedim>();
12330 if (
it != manifolds.end())
12333 return *(
it->second);
12339 "No manifold of the manifold id " + std::to_string(
m_number) +
12340 " has been attached to the triangulation. "
12341 "Please attach the right manifold with Triangulation::set_manifold()."));
12343 return internal::TriangulationImplementation::
12344 get_default_flat_manifold<dim, spacedim>();
12349template <
int dim,
int spacedim>
12354 std::set<types::boundary_id> boundary_ids;
12355 for (
const auto &cell : active_cell_iterators())
12356 if (cell->is_locally_owned())
12358 if (cell->at_boundary(face))
12361 return {boundary_ids.begin(), boundary_ids.end()};
12366template <
int dim,
int spacedim>
12371 std::set<types::manifold_id>
m_ids;
12372 for (
const auto &cell : active_cell_iterators())
12373 if (cell->is_locally_owned())
12375 m_ids.insert(cell->manifold_id());
12376 for (
const auto &face : cell->face_iterators())
12380 const auto line_indices = internal::TriaAccessorImplementation::
12381 Implementation::get_line_indices_of_cell(*cell);
12382 for (
unsigned int l = 0;
l < cell->n_lines(); ++
l)
12384 raw_line_iterator line(
this, 0, line_indices[l]);
12385 m_ids.insert(line->manifold_id());
12397template <
int dim,
int spacedim>
12402 Assert((vertices.empty()) && (levels.empty()) && (faces ==
nullptr),
12403 ExcTriangulationNotEmpty(vertices.size(), levels.size()));
12407 "When calling Triangulation::copy_triangulation(), "
12408 "the target triangulation must be empty but the source "
12409 "triangulation (the argument to this function) must contain "
12410 "something. Here, it seems like the source does not "
12411 "contain anything at all."));
12417 anisotropic_refinement =
other_tria.anisotropic_refinement;
12419 reference_cells =
other_tria.reference_cells;
12422 faces = std::make_unique<internal::TriangulationImplementation::TriaFaces>(
12432 std::make_unique<internal::TriangulationImplementation::TriaLevel>(
12439 vertex_to_boundary_id_map_1d =
12440 std::make_unique<std::map<unsigned int, types::boundary_id>>(
12443 vertex_to_manifold_id_map_1d =
12444 std::make_unique<std::map<unsigned int, types::manifold_id>>(
12452 this->periodic_face_pairs_level_0.reserve(
12453 other_tria.periodic_face_pairs_level_0.size());
12459 cell_iterator(
this, entry.cell[0]->level(), entry.cell[0]->index());
12461 cell_iterator(
this, entry.cell[1]->level(), entry.cell[1]->index());
12462 periodic_face_pairs_level_0.emplace_back(entry);
12469 first_cell.first = cell_iterator(
this,
12470 first_cell.first->level(),
12471 first_cell.first->index());
12473 cell_iterator(
this,
12492template <
int dim,
int spacedim>
12496 this->update_reference_cells();
12498 if (this->all_reference_cells_are_hyper_cube())
12518template <
int dim,
int spacedim>
12525 Assert((vertices.empty()) && (levels.empty()) && (faces ==
nullptr),
12526 ExcTriangulationNotEmpty(vertices.size(), levels.size()));
12541 clear_despite_subscriptions();
12549 reset_cell_vertex_indices_cache();
12551 *
this, levels.size(), number_cache);
12552 reset_active_cell_indices();
12553 reset_global_cell_indices();
12558 if (check_for_distorted_cells)
12564 AssertThrow(distorted_cells.distorted_cells.empty(), distorted_cells);
12597 if ((dim == spacedim - 1) && all_reference_cells_are_hyper_cube())
12605 const bool values[][2] = {{
false,
true}, {
true,
false}};
12606 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
12613 const bool values[][4] = {{
false,
true,
true,
false},
12614 {
true,
false,
false,
true},
12615 {
true,
false,
false,
true},
12616 {
false,
true,
true,
false}};
12617 for (
const unsigned int i :
GeometryInfo<dim>::face_indices())
12628 active_cell_iterator neighbor;
12633 begin_active()->set_direction_flag(
true);
12634 begin_active()->set_user_flag();
12640 for (
const unsigned int i : cell->face_indices())
12642 if (cell->face(i)->at_boundary() ==
false)
12646 neighbor = cell->neighbor(i);
12649 cell->neighbor_of_neighbor(i);
12653 if (neighbor->user_flag_set())
12657 (neighbor->direction_flag() ==
12658 cell->direction_flag())),
12660 "The triangulation you are trying to create is not orientable."));
12670 (neighbor->direction_flag() ==
12671 cell->direction_flag()))
12672 neighbor->set_direction_flag(
12673 !neighbor->direction_flag());
12674 neighbor->set_user_flag();
12687 for (
const auto &cell :
this->active_cell_iterators())
12688 if (cell->user_flag_set() ==
false)
12691 cell->set_direction_flag(
true);
12692 cell->set_user_flag();
12700 clear_user_flags();
12703 this->update_cell_relations();
12711template <
int dim,
int spacedim>
12735 this->coarse_cell_id_to_coarse_cell_index(
a_id.get_coarse_cell_id());
12737 this->coarse_cell_id_to_coarse_cell_index(
b_id.get_coarse_cell_id());
12753 for (
unsigned int level = 0;
12767 for (
const auto face : cell->face_indices())
12768 cell->face(face)->set_manifold_id(
12772 for (
const auto face : cell->face_indices())
12773 cell->face(face)->set_manifold_id(
12776 const auto line_indices = internal::TriaAccessorImplementation::
12777 Implementation::get_line_indices_of_cell(*cell);
12778 for (
unsigned int l = 0;
l < cell->n_lines(); ++
l)
12780 raw_line_iterator line(
this, 0, line_indices[l]);
12781 line->set_manifold_id(
cell_info->manifold_line_ids[l]);
12785 cell->set_manifold_id(
cell_info->manifold_id);
12812 spacedim>::execute_coarsening_and_refinement();
12817 for (
unsigned int level = 0;
12841template <
int dim,
int spacedim>
12847 "This function can only be called if dim == spacedim-1."));
12848 for (
const auto &cell :
this->active_cell_iterators())
12849 cell->set_direction_flag(!cell->direction_flag());
12854template <
int dim,
int spacedim>
12859 ExcMessage(
"Error: An empty Triangulation can not be refined."));
12861 for (
const auto &cell :
this->active_cell_iterators())
12863 cell->clear_coarsen_flag();
12864 cell->set_refine_flag();
12865 cell->set_refine_choice();
12871template <
int dim,
int spacedim>
12876 ExcMessage(
"Error: An empty Triangulation can not be refined."));
12878 for (
unsigned int i = 0; i <
times; ++i)
12880 set_all_refine_flags();
12881 execute_coarsening_and_refinement();
12887template <
int dim,
int spacedim>
12891 for (
unsigned int i = 0; i <
times; ++i)
12893 for (
const auto &cell :
this->active_cell_iterators())
12895 cell->clear_refine_flag();
12896 cell->set_coarsen_flag();
12898 execute_coarsening_and_refinement();
12908template <
int dim,
int spacedim>
12913 std::vector<bool>::iterator i = v.begin();
12915 for (
const auto &cell :
this->active_cell_iterators())
12916 for (unsigned
int j = 0;
j < dim; ++
j, ++i)
12917 if (cell->refine_flag_set() & (1 <<
j))
12925template <
int dim,
int spacedim>
12929 std::vector<bool> v;
12930 save_refine_flags(v);
12939template <
int dim,
int spacedim>
12943 std::vector<bool> v;
12945 load_refine_flags(v);
12950template <
int dim,
int spacedim>
12956 std::vector<bool>::const_iterator i = v.begin();
12957 for (
const auto &cell :
this->active_cell_iterators())
12961 for (
unsigned int j = 0;
j < dim; ++
j, ++i)
12965 ExcGridReadError());
12969 cell->clear_refine_flag();
12977template <
int dim,
int spacedim>
12980 std::vector<bool> &v)
const
12983 std::vector<bool>::iterator i = v.begin();
12984 for (
const auto &cell :
this->active_cell_iterators())
12986 *i = cell->coarsen_flag_set();
12995template <
int dim,
int spacedim>
12999 std::vector<bool> v;
13000 save_coarsen_flags(v);
13009template <
int dim,
int spacedim>
13013 std::vector<bool> v;
13018 load_coarsen_flags(v);
13023template <
int dim,
int spacedim>
13026 const std::vector<bool> &v)
13030 std::vector<bool>::const_iterator i = v.begin();
13031 for (
const auto &cell :
this->active_cell_iterators())
13034 cell->set_coarsen_flag();
13036 cell->clear_coarsen_flag();
13044template <
int dim,
int spacedim>
13048 return anisotropic_refinement;
13058 std::vector<std::vector<bool>>
13060 const std::vector<std::unique_ptr<
13063 std::vector<std::vector<bool>> coarsen_flags(levels.size());
13065 coarsen_flags[
level] = levels[
level]->coarsen_flags;
13066 return coarsen_flags;
13069 std::vector<std::vector<std::uint8_t>>
13071 const std::vector<std::unique_ptr<
13074 std::vector<std::vector<std::uint8_t>> refine_flags(levels.size());
13076 refine_flags[
level] = levels[
level]->refine_flags;
13077 return refine_flags;
13090 clear_user_data(std::vector<std::unique_ptr<
13093 for (
auto &
level : levels)
13094 level->cells.clear_user_data();
13102 if (faces->
dim == 2)
13108 if (faces->
dim == 3)
13118template <
int dim,
int spacedim>
13123 ::clear_user_data(levels);
13125 ::clear_user_data(faces.get());
13133 clear_user_flags_line(
13136 std::unique_ptr<internal::TriangulationImplementation::TriaLevel>>
13142 for (
const auto &
level : levels)
13143 level->cells.clear_user_flags();
13145 else if (dim == 2 || dim == 3)
13157template <
int dim,
int spacedim>
13161 ::clear_user_flags_line(dim, levels, faces.get());
13169 clear_user_flags_quad(
13172 std::unique_ptr<internal::TriangulationImplementation::TriaLevel>>
13182 for (
const auto &
level : levels)
13183 level->cells.clear_user_flags();
13197template <
int dim,
int spacedim>
13201 ::clear_user_flags_quad(dim, levels, faces.get());
13209 clear_user_flags_hex(
13212 std::unique_ptr<internal::TriangulationImplementation::TriaLevel>>
13226 for (
const auto &
level : levels)
13227 level->cells.clear_user_flags();
13237template <
int dim,
int spacedim>
13241 ::clear_user_flags_hex(dim, levels, faces.get());
13246template <
int dim,
int spacedim>
13250 clear_user_flags_line();
13251 clear_user_flags_quad();
13252 clear_user_flags_hex();
13257template <
int dim,
int spacedim>
13261 save_user_flags_line(out);
13264 save_user_flags_quad(out);
13267 save_user_flags_hex(out);
13275template <
int dim,
int spacedim>
13283 std::vector<bool> tmp;
13285 save_user_flags_line(tmp);
13286 v.insert(v.end(), tmp.begin(), tmp.end());
13290 save_user_flags_quad(tmp);
13291 v.insert(v.end(), tmp.begin(), tmp.end());
13296 save_user_flags_hex(tmp);
13297 v.insert(v.end(), tmp.begin(), tmp.end());
13306template <
int dim,
int spacedim>
13310 load_user_flags_line(in);
13313 load_user_flags_quad(in);
13316 load_user_flags_hex(in);
13324template <
int dim,
int spacedim>
13329 std::vector<bool> tmp;
13333 tmp.insert(tmp.end(), v.begin(), v.begin() + n_lines());
13335 load_user_flags_line(tmp);
13340 tmp.insert(tmp.end(),
13341 v.begin() + n_lines(),
13342 v.begin() + n_lines() + n_quads());
13343 load_user_flags_quad(tmp);
13349 tmp.insert(tmp.end(),
13350 v.begin() + n_lines() + n_quads(),
13351 v.begin() + n_lines() + n_quads() + n_hexs());
13352 load_user_flags_hex(tmp);
13361template <
int dim,
int spacedim>
13364 std::vector<bool> &v)
const
13366 v.resize(n_lines(),
false);
13367 std::vector<bool>::iterator i = v.begin();
13368 line_iterator line = begin_line(),
endl = end_line();
13369 for (; line !=
endl; ++line, ++i)
13370 *i = line->user_flag_set();
13377template <
int dim,
int spacedim>
13381 std::vector<bool> v;
13382 save_user_flags_line(v);
13391template <
int dim,
int spacedim>
13395 std::vector<bool> v;
13400 load_user_flags_line(v);
13405template <
int dim,
int spacedim>
13408 const std::vector<bool> &v)
13410 Assert(v.size() == n_lines(), ExcGridReadError());
13412 line_iterator line = begin_line(),
endl = end_line();
13413 std::vector<bool>::const_iterator i = v.begin();
13414 for (; line !=
endl; ++line, ++i)
13416 line->set_user_flag();
13418 line->clear_user_flag();
13427 template <
typename Iterator>
13431 return i->user_flag_set();
13436 template <
int structdim,
int dim,
int spacedim>
13446 template <
typename Iterator>
13448 set_user_flag(
const Iterator &i)
13450 i->set_user_flag();
13455 template <
int structdim,
int dim,
int spacedim>
13464 template <
typename Iterator>
13466 clear_user_flag(
const Iterator &i)
13468 i->clear_user_flag();
13473 template <
int structdim,
int dim,
int spacedim>
13484template <
int dim,
int spacedim>
13487 std::vector<bool> &v)
const
13489 v.resize(n_quads(),
false);
13493 std::vector<bool>::iterator i = v.begin();
13494 quad_iterator quad = begin_quad(),
endq = end_quad();
13495 for (; quad !=
endq; ++quad, ++i)
13504template <
int dim,
int spacedim>
13508 std::vector<bool> v;
13509 save_user_flags_quad(v);
13518template <
int dim,
int spacedim>
13522 std::vector<bool> v;
13527 load_user_flags_quad(v);
13532template <
int dim,
int spacedim>
13535 const std::vector<bool> &v)
13537 Assert(v.size() == n_quads(), ExcGridReadError());
13541 quad_iterator quad = begin_quad(),
endq = end_quad();
13542 std::vector<bool>::const_iterator i = v.begin();
13543 for (; quad !=
endq; ++quad, ++i)
13545 set_user_flag(quad);
13547 clear_user_flag(quad);
13555template <
int dim,
int spacedim>
13558 std::vector<bool> &v)
const
13560 v.resize(n_hexs(),
false);
13564 std::vector<bool>::iterator i = v.begin();
13565 hex_iterator hex = begin_hex(),
endh = end_hex();
13566 for (; hex !=
endh; ++hex, ++i)
13575template <
int dim,
int spacedim>
13579 std::vector<bool> v;
13580 save_user_flags_hex(v);
13589template <
int dim,
int spacedim>
13593 std::vector<bool> v;
13598 load_user_flags_hex(v);
13603template <
int dim,
int spacedim>
13606 const std::vector<bool> &v)
13608 Assert(v.size() == n_hexs(), ExcGridReadError());
13612 hex_iterator hex = begin_hex(),
endh = end_hex();
13613 std::vector<bool>::const_iterator i = v.begin();
13614 for (; hex !=
endh; ++hex, ++i)
13616 set_user_flag(hex);
13618 clear_user_flag(hex);
13626template <
int dim,
int spacedim>
13629 std::vector<unsigned int> &v)
const
13635 std::vector<unsigned int> tmp;
13637 save_user_indices_line(tmp);
13638 v.insert(v.end(), tmp.begin(), tmp.end());
13642 save_user_indices_quad(tmp);
13643 v.insert(v.end(), tmp.begin(), tmp.end());
13648 save_user_indices_hex(tmp);
13649 v.insert(v.end(), tmp.begin(), tmp.end());
13658template <
int dim,
int spacedim>
13661 const std::vector<unsigned int> &v)
13664 std::vector<unsigned int> tmp;
13668 tmp.insert(tmp.end(), v.begin(), v.begin() + n_lines());
13670 load_user_indices_line(tmp);
13675 tmp.insert(tmp.end(),
13676 v.begin() + n_lines(),
13677 v.begin() + n_lines() + n_quads());
13678 load_user_indices_quad(tmp);
13684 tmp.insert(tmp.end(),
13685 v.begin() + n_lines() + n_quads(),
13686 v.begin() + n_lines() + n_quads() + n_hexs());
13687 load_user_indices_hex(tmp);
13696template <
int dim,
int spacedim>
13705 boost::archive::text_oarchive
oa(
ofs_tria, boost::archive::no_header);
13714 <<
"version nproc n_attached_fixed_size_objs n_attached_variable_size_objs n_active_cells"
13717 <<
" " << 1 <<
" " << this->cell_attached_data.pack_callbacks_fixed.size()
13718 <<
" " << this->cell_attached_data.pack_callbacks_variable.size() <<
" "
13719 << this->n_global_active_cells() << std::endl;
13722 this->save_attached_data(0, this->n_global_active_cells(),
file_basename);
13727template <
int dim,
int spacedim>
13736 boost::archive::text_iarchive
ia(
ifs_tria, boost::archive::no_header);
13743 n_global_active_cells;
13754 ExcMessage(
"Incompatible number of CPUs found in .info file."));
13758 spacedim>::version_number;
13761 "The information saved in the file you are trying "
13762 "to read the triangulation from was written with an "
13763 "incompatible file format version and cannot be read."));
13764 Assert(this->n_global_active_cells() == n_global_active_cells,
13765 ExcMessage(
"The number of cells of the triangulation differs "
13766 "from the number of cells written into the .info file."));
13770 this->cell_attached_data.n_attached_data_sets = 0;
13771 this->cell_attached_data.n_attached_deserialize =
13774 this->load_attached_data(0,
13775 this->n_global_active_cells(),
13781 this->update_cell_relations();
13787 template <
typename Iterator>
13791 return i->user_index();
13796 template <
int structdim,
int dim,
int spacedim>
13807 template <
typename Iterator>
13809 set_user_index(
const Iterator &i,
const unsigned int x)
13811 i->set_user_index(
x);
13816 template <
int structdim,
int dim,
int spacedim>
13820 const unsigned int)
13828template <
int dim,
int spacedim>
13831 std::vector<unsigned int> &v)
const
13833 v.resize(n_lines(), 0);
13834 std::vector<unsigned int>::iterator i = v.begin();
13835 line_iterator line = begin_line(),
endl = end_line();
13836 for (; line !=
endl; ++line, ++i)
13837 *i = line->user_index();
13842template <
int dim,
int spacedim>
13845 const std::vector<unsigned int> &v)
13847 Assert(v.size() == n_lines(), ExcGridReadError());
13849 line_iterator line = begin_line(),
endl = end_line();
13850 std::vector<unsigned int>::const_iterator i = v.begin();
13851 for (; line !=
endl; ++line, ++i)
13852 line->set_user_index(*i);
13856template <
int dim,
int spacedim>
13859 std::vector<unsigned int> &v)
const
13861 v.resize(n_quads(), 0);
13865 std::vector<unsigned int>::iterator i = v.begin();
13866 quad_iterator quad = begin_quad(),
endq = end_quad();
13867 for (; quad !=
endq; ++quad, ++i)
13874template <
int dim,
int spacedim>
13877 const std::vector<unsigned int> &v)
13879 Assert(v.size() == n_quads(), ExcGridReadError());
13883 quad_iterator quad = begin_quad(),
endq = end_quad();
13884 std::vector<unsigned int>::const_iterator i = v.begin();
13885 for (; quad !=
endq; ++quad, ++i)
13886 set_user_index(quad, *i);
13891template <
int dim,
int spacedim>
13894 std::vector<unsigned int> &v)
const
13896 v.resize(n_hexs(), 0);
13900 std::vector<unsigned int>::iterator i = v.begin();
13901 hex_iterator hex = begin_hex(),
endh = end_hex();
13902 for (; hex !=
endh; ++hex, ++i)
13909template <
int dim,
int spacedim>
13912 const std::vector<unsigned int> &v)
13914 Assert(v.size() == n_hexs(), ExcGridReadError());
13918 hex_iterator hex = begin_hex(),
endh = end_hex();
13919 std::vector<unsigned int>::const_iterator i = v.begin();
13920 for (; hex !=
endh; ++hex, ++i)
13921 set_user_index(hex, *i);
13933 template <
typename Iterator>
13937 return i->user_pointer();
13942 template <
int structdim,
int dim,
int spacedim>
13953 template <
typename Iterator>
13955 set_user_pointer(
const Iterator &i,
void *
x)
13957 i->set_user_pointer(
x);
13962 template <
int structdim,
int dim,
int spacedim>
13974template <
int dim,
int spacedim>
13977 std::vector<void *> &v)
const
13983 std::vector<void *> tmp;
13985 save_user_pointers_line(tmp);
13986 v.insert(v.end(), tmp.begin(), tmp.end());
13990 save_user_pointers_quad(tmp);
13991 v.insert(v.end(), tmp.begin(), tmp.end());
13996 save_user_pointers_hex(tmp);
13997 v.insert(v.end(), tmp.begin(), tmp.end());
14006template <
int dim,
int spacedim>
14009 const std::vector<void *> &v)
14012 std::vector<void *> tmp;
14016 tmp.insert(tmp.end(), v.begin(), v.begin() + n_lines());
14018 load_user_pointers_line(tmp);
14023 tmp.insert(tmp.end(),
14024 v.begin() + n_lines(),
14025 v.begin() + n_lines() + n_quads());
14026 load_user_pointers_quad(tmp);
14032 tmp.insert(tmp.end(),
14033 v.begin() + n_lines() + n_quads(),
14034 v.begin() + n_lines() + n_quads() + n_hexs());
14035 load_user_pointers_hex(tmp);
14044template <
int dim,
int spacedim>
14047 std::vector<void *> &v)
const
14049 v.resize(n_lines(),
nullptr);
14050 std::vector<void *>::iterator i = v.begin();
14051 line_iterator line = begin_line(),
endl = end_line();
14052 for (; line !=
endl; ++line, ++i)
14053 *i = line->user_pointer();
14058template <
int dim,
int spacedim>
14061 const std::vector<void *> &v)
14063 Assert(v.size() == n_lines(), ExcGridReadError());
14065 line_iterator line = begin_line(),
endl = end_line();
14066 std::vector<void *>::const_iterator i = v.begin();
14067 for (; line !=
endl; ++line, ++i)
14068 line->set_user_pointer(*i);
14073template <
int dim,
int spacedim>
14076 std::vector<void *> &v)
const
14078 v.resize(n_quads(),
nullptr);
14082 std::vector<void *>::iterator i = v.begin();
14083 quad_iterator quad = begin_quad(),
endq = end_quad();
14084 for (; quad !=
endq; ++quad, ++i)
14091template <
int dim,
int spacedim>
14094 const std::vector<void *> &v)
14096 Assert(v.size() == n_quads(), ExcGridReadError());
14100 quad_iterator quad = begin_quad(),
endq = end_quad();
14101 std::vector<void *>::const_iterator i = v.begin();
14102 for (; quad !=
endq; ++quad, ++i)
14103 set_user_pointer(quad, *i);
14108template <
int dim,
int spacedim>
14111 std::vector<void *> &v)
const
14113 v.resize(n_hexs(),
nullptr);
14117 std::vector<void *>::iterator i = v.begin();
14118 hex_iterator hex = begin_hex(),
endh = end_hex();
14119 for (; hex !=
endh; ++hex, ++i)
14126template <
int dim,
int spacedim>
14129 const std::vector<void *> &v)
14131 Assert(v.size() == n_hexs(), ExcGridReadError());
14135 hex_iterator hex = begin_hex(),
endh = end_hex();
14136 std::vector<void *>::const_iterator i = v.begin();
14137 for (; hex !=
endh; ++hex, ++i)
14138 set_user_pointer(hex, *i);
14148template <
int dim,
int spacedim>
14156 return begin_raw_line(
level);
14158 return begin_raw_quad(
level);
14160 return begin_raw_hex(
level);
14163 return raw_cell_iterator();
14169template <
int dim,
int spacedim>
14177 return begin_line(
level);
14179 return begin_quad(
level);
14181 return begin_hex(
level);
14184 return cell_iterator();
14190template <
int dim,
int spacedim>
14198 return begin_active_line(
level);
14200 return begin_active_quad(
level);
14202 return begin_active_hex(
level);
14205 return active_cell_iterator();
14211template <
int dim,
int spacedim>
14216 const unsigned int level = levels.size() - 1;
14217 if (levels[
level]->cells.n_objects() == 0)
14224 levels[
level]->cells.n_objects() - 1);
14227 if (
ri->used() ==
true)
14230 if (
ri->used() ==
true)
14237template <
int dim,
int spacedim>
14243 cell_iterator cell = last();
14248 if (cell->is_active() ==
true)
14251 if (cell->is_active() ==
true)
14259template <
int dim,
int spacedim>
14263 const CellId &cell_id)
const
14266 this->contains_cell(cell_id),
14268 "CellId is invalid for this triangulation.\n"
14269 "Either the provided CellId does not correspond to a cell in this "
14270 "triangulation object, or, in case you are using a parallel "
14271 "triangulation, may correspond to an artificial cell that is less "
14272 "refined on this processor. In the case of "
14273 "parallel::fullydistributed::Triangulation, the corresponding coarse "
14274 "cell might not be accessible by the current process."));
14276 cell_iterator cell(
14279 for (
const auto &child_index : cell_id.get_child_indices())
14287template <
int dim,
int spacedim>
14299 for (
const auto &child_index : cell_id.get_child_indices())
14301 if (cell->has_children() ==
false)
14303 cell = cell->child(
static_cast<unsigned int>(child_index));
14311template <
int dim,
int spacedim>
14323template <
int dim,
int spacedim>
14336 if (
level >= levels.size())
14339 ExcInvalidLevel(
level, n_global_levels()));
14346 if (
level < levels.size() - 1)
14347 return begin_raw(
level + 1);
14353template <
int dim,
int spacedim>
14366 if (
level >= levels.size())
14369 ExcInvalidLevel(
level, n_global_levels()));
14376 if (
level < levels.size() - 1)
14383template <
int dim,
int spacedim>
14396 if (
level >= levels.size())
14399 ExcInvalidLevel(
level, n_global_levels()));
14406 return (
level >= levels.size() - 1 ? active_cell_iterator(
end()) :
14407 begin_active(
level + 1));
14412template <
int dim,
int spacedim>
14423template <
int dim,
int spacedim>
14436template <
int dim,
int spacedim>
14448template <
int dim,
int spacedim>
14464template <
int dim,
int spacedim>
14473 return raw_face_iterator();
14475 return begin_line();
14477 return begin_quad();
14480 return face_iterator();
14486template <
int dim,
int spacedim>
14495 return raw_face_iterator();
14497 return begin_active_line();
14499 return begin_active_quad();
14502 return active_face_iterator();
14508template <
int dim,
int spacedim>
14517 return raw_face_iterator();
14524 return raw_face_iterator();
14530template <
int dim,
int spacedim>
14538 begin_active_face(), end_face());
14544template <
int dim,
int spacedim>
14549 vertex_iterator i =
14554 while (i->used() ==
false)
14562template <
int dim,
int spacedim>
14568 return begin_vertex();
14573template <
int dim,
int spacedim>
14590template <
int dim,
int spacedim>
14603 if (
level >= levels.size())
14606 ExcInvalidLevel(
level, n_global_levels()));
14617 if (
level >= levels.size() || levels[
level]->cells.n_objects() == 0)
14620 return raw_line_iterator(
14625 return raw_line_iterator(
14631template <
int dim,
int spacedim>
14637 raw_line_iterator
ri = begin_raw_line(
level);
14640 while (
ri->used() ==
false)
14648template <
int dim,
int spacedim>
14652 const unsigned int level)
const
14655 line_iterator i = begin_line(
level);
14658 while (i->has_children())
14666template <
int dim,
int spacedim>
14682template <
int dim,
int spacedim>
14695 if (
level >= levels.size())
14698 ExcInvalidLevel(
level, n_global_levels()));
14706 return raw_hex_iterator();
14713 if (
level >= levels.size() || levels[
level]->cells.n_objects() == 0)
14716 return raw_quad_iterator(
14724 return raw_quad_iterator(
14731 return raw_hex_iterator();
14737template <
int dim,
int spacedim>
14743 raw_quad_iterator
ri = begin_raw_quad(
level);
14746 while (
ri->used() ==
false)
14754template <
int dim,
int spacedim>
14758 const unsigned int level)
const
14761 quad_iterator i = begin_quad(
level);
14764 while (i->has_children())
14772template <
int dim,
int spacedim>
14788template <
int dim,
int spacedim>
14801 if (
level >= levels.size())
14804 ExcInvalidLevel(
level, n_global_levels()));
14813 return raw_hex_iterator();
14820 if (
level >= levels.size() || levels[
level]->cells.n_objects() == 0)
14823 return raw_hex_iterator(
14829 return raw_hex_iterator();
14835template <
int dim,
int spacedim>
14841 raw_hex_iterator
ri = begin_raw_hex(
level);
14844 while (
ri->used() ==
false)
14852template <
int dim,
int spacedim>
14858 hex_iterator i = begin_hex(
level);
14861 while (i->has_children())
14869template <
int dim,
int spacedim>
14886 namespace TriangulationImplementation
14888 inline unsigned int
14895 inline unsigned int
14899 return c.n_active_lines;
14903 inline unsigned int
14910 inline unsigned int
14914 return c.n_active_quads;
14918 inline unsigned int
14925 inline unsigned int
14929 return c.n_active_hexes;
14936template <
int dim,
int spacedim>
14944template <
int dim,
int spacedim>
14951template <
int dim,
int spacedim>
14959template <
int dim,
int spacedim>
14967template <
int dim,
int spacedim>
14974 return n_used_vertices();
14986template <
int dim,
int spacedim>
14993 return n_vertices();
14995 return n_raw_lines();
14997 return n_raw_quads();
15005template <
int dim,
int spacedim>
15012 return n_used_vertices();
15014 return n_active_lines();
15016 return n_active_quads();
15024template <
int dim,
int spacedim>
15027 const unsigned int level)
const
15032 return n_raw_lines(
level);
15034 return n_raw_quads(
level);
15036 return n_raw_hexs(
level);
15045template <
int dim,
int spacedim>
15048 const unsigned int level)
const
15053 return n_lines(
level);
15055 return n_quads(
level);
15057 return n_hexs(
level);
15066template <
int dim,
int spacedim>
15069 const unsigned int level)
const
15074 return n_active_lines(
level);
15076 return n_active_quads(
level);
15078 return n_active_hexs(
level);
15086template <
int dim,
int spacedim>
15090 if (anisotropic_refinement ==
false)
15092 for (
unsigned int lvl = 0;
lvl < n_global_levels() - 1; ++
lvl)
15098 for (
const auto &cell : active_cell_iterators())
15100 if (cell->face(i)->has_children())
15107template <
int dim,
int spacedim>
15111 return number_cache.n_lines;
15116template <
int dim,
int spacedim>
15119 const unsigned int level)
const
15124 return levels[
level]->cells.n_objects();
15127 Assert(
false, ExcFacesHaveNoLevel());
15132template <
int dim,
int spacedim>
15146template <
int dim,
int spacedim>
15149 const unsigned int level)
const
15152 Assert(dim == 1, ExcFacesHaveNoLevel());
15153 return number_cache.n_lines_level[
level];
15157template <
int dim,
int spacedim>
15161 return number_cache.n_active_lines;
15165template <
int dim,
int spacedim>
15168 const unsigned int level)
const
15171 Assert(dim == 1, ExcFacesHaveNoLevel());
15173 return number_cache.n_active_lines_level[
level];
15323template <
int dim,
int spacedim>
15327 return number_cache.n_quads;
15331template <
int dim,
int spacedim>
15334 const unsigned int level)
const
15336 Assert(dim == 2, ExcFacesHaveNoLevel());
15338 return number_cache.n_quads_level[
level];
15348 return levels[
level]->cells.n_objects();
15358 return levels[
level]->cells.n_objects();
15366 Assert(
false, ExcFacesHaveNoLevel());
15372template <
int dim,
int spacedim>
15391template <
int dim,
int spacedim>
15395 return number_cache.n_active_quads;
15399template <
int dim,
int spacedim>
15402 const unsigned int level)
const
15405 Assert(dim == 2, ExcFacesHaveNoLevel());
15407 return number_cache.n_active_quads_level[
level];
15411template <
int dim,
int spacedim>
15420template <
int dim,
int spacedim>
15429template <
int dim,
int spacedim>
15437template <
int dim,
int spacedim>
15446template <
int dim,
int spacedim>
15449 const unsigned int)
const
15460 return number_cache.n_hexes;
15471 return number_cache.n_hexes_level[
level];
15481 return levels[
level]->cells.n_objects();
15489 return number_cache.n_active_hexes;
15500 return number_cache.n_active_hexes_level[
level];
15505template <
int dim,
int spacedim>
15509 return std::count(vertices_used.begin(), vertices_used.end(),
true);
15514template <
int dim,
int spacedim>
15518 return vertices_used;
15549template <
int dim,
int spacedim>
15553 cell_iterator cell = begin(0),
15554 endc = (n_levels() > 1 ? begin(1) : cell_iterator(end()));
15558 for (; cell !=
endc; ++cell)
15571 for (cell = begin(); cell !=
endc; ++cell)
15576 static_cast<unsigned int>(
15582template <
int dim,
int spacedim>
15592template <
int dim,
int spacedim>
15601template <
int dim,
int spacedim>
15611template <
int dim,
int spacedim>
15617 periodic_face_pairs_level_0.insert(periodic_face_pairs_level_0.end(),
15622 update_periodic_face_map();
15627template <
int dim,
int spacedim>
15629const typename std::map<
15630 std::pair<typename Triangulation<dim, spacedim>::cell_iterator,
unsigned int>,
15631 std::pair<std::pair<typename Triangulation<dim, spacedim>::cell_iterator,
15636 return periodic_face_map;
15640template <
int dim,
int spacedim>
15651 this->local_cell_relations.
clear();
15654 for (
const auto &cell :
this->active_cell_iterators())
15661template <
int dim,
int spacedim>
15672 if (this->cell_attached_data.n_attached_data_sets > 0)
15678 for (
const auto &cell :
this->active_cell_iterators())
15681 (cell->level() > 0) && (cell->coarsen_flag_set());
15687 if (cell->parent()->child(0) == cell)
15693 this->local_cell_relations.
clear();
15694 this->local_cell_relations.reserve(this->n_global_active_cells());
15697 std::pair<
unsigned int,
15702 for (
const auto &cell :
this->active_cell_iterators())
15708 const unsigned int index =
15715 cell->refine_flag_set() ?
15722 cell_relation_t{cell, status});
15724 else if (cell->level() > 0 &&
15729 const unsigned int index =
15733 cell->parent()->id()));
15737 if (cell->parent()->child_iterator_to_index(cell) == 0)
15745 cell_relation_t{cell->parent(), status});
15755 [](
const auto &a,
const auto &b) {
15756 return a.first < b.first;
15763 this->data_serializer.pack_data(
15764 this->local_cell_relations,
15765 this->cell_attached_data.pack_callbacks_fixed,
15766 this->cell_attached_data.pack_callbacks_variable,
15767 this->get_mpi_communicator());
15770 this->data_serializer.dest_data_fixed =
15771 this->data_serializer.src_data_fixed;
15772 this->data_serializer.dest_data_variable =
15773 this->data_serializer.src_data_variable;
15774 this->data_serializer.dest_sizes_variable =
15775 this->data_serializer.src_sizes_variable;
15781template <
int dim,
int spacedim>
15790 if (this->cell_attached_data.n_attached_data_sets > 0)
15792 std::vector<typename internal::CellAttachedDataSerializer<dim, spacedim>
::
15796 for (
const auto &cell : local_cell_relations)
15798 if (cell.first->has_children())
15803 temp.emplace_back(cell.first->child(0),
15807 temp.push_back(cell);
15810 this->local_cell_relations =
temp;
15816template <
int dim,
int spacedim>
15830 if (smooth_grid & limit_level_difference_at_vertices)
15834 signals.pre_refinement();
15836 this->pack_data_serial();
15838 execute_coarsening();
15845 this->unpack_data_serial();
15847 reset_cell_vertex_indices_cache();
15852 if (smooth_grid & limit_level_difference_at_vertices)
15857 this->policy->update_neighbors(*
this);
15858 reset_active_cell_indices();
15860 reset_global_cell_indices();
15863 signals.post_refinement();
15868 update_periodic_face_map();
15870 if (this->cell_attached_data.n_attached_data_sets == 0)
15871 this->update_cell_relations();
15897 for (
const auto &cell : cell_iterators())
15899 if (cell->has_children() && cell->reference_cell().is_hyper_cube())
15900 for (
const unsigned int f : cell->face_indices())
15901 if (cell->at_boundary(f) ==
false)
15903 for (
const auto &child : cell->child_iterators())
15906 child->at_boundary(f) ==
false,
15908 "We ended up with a triangulation whose child cells "
15909 "are not connected to their neighbors as expected. "
15910 "When you created the triangulation, did you forget "
15911 "to call GridTools::consistently_order_cells() "
15912 "before calling Triangulation::create_triangulation()?"));
15921template <
int dim,
int spacedim>
15925 unsigned int active_cell_index = 0;
15926 for (raw_cell_iterator cell = begin_raw(); cell !=
end(); ++cell)
15927 if ((cell->used() ==
false) || cell->has_children())
15931 cell->set_active_cell_index(active_cell_index);
15932 ++active_cell_index;
15940template <
int dim,
int spacedim>
15946 for (
const auto &cell : active_cell_iterators())
15947 cell->set_global_active_cell_index(
cell_index++);
15950 for (
unsigned int l = 0;
l < levels.size(); ++
l)
15953 for (
const auto &cell : cell_iterators_on_level(
l))
15954 cell->set_global_level_cell_index(
cell_index++);
15960template <
int dim,
int spacedim>
15964 for (
unsigned int l = 0;
l < levels.size(); ++
l)
15966 std::vector<unsigned int> &cache = levels[
l]->cell_vertex_indices_cache;
15968 cache.resize(levels[l]->refine_flags.size() *
15969 ReferenceCells::max_n_vertices<dim>(),
15971 for (
const auto &cell : cell_iterators_on_level(
l))
15974 cell->index() * ReferenceCells::max_n_vertices<dim>();
15981 for (
unsigned int face = 4; face < 6; ++face)
15983 const auto face_iter = cell->face(face);
15984 const std::array<types::geometric_orientation, 2>
15986 face_iter->line_orientation(1)}};
15994 levels[
l]->face_orientations.get_combined_orientation(
15995 cell->index() * ReferenceCells::max_n_faces<dim>() + face);
15997 {
ref_cell.standard_to_real_face_vertex(0,
16000 ref_cell.standard_to_real_face_vertex(1,
16003 ref_cell.standard_to_real_face_vertex(2,
16006 ref_cell.standard_to_real_face_vertex(
16010 for (
unsigned int i = 0; i < 4; ++i)
16015 const std::array<types::geometric_orientation, 2>
16017 {cell->line_orientation(0), cell->line_orientation(1)}};
16023 for (
unsigned int i = 0; i < 4; ++i)
16028 cache[
my_index + 0] = cell->vertex_index(0);
16029 cache[
my_index + 1] = cell->vertex_index(1);
16036 const auto [face_index, vertex_index] =
16037 ref_cell.standard_vertex_to_face_and_vertex_index(i);
16039 ref_cell.standard_to_real_face_vertex(
16042 cell->combined_face_orientation(face_index));
16044 cell->face(face_index)
16054template <
int dim,
int spacedim>
16059 periodic_face_map.
clear();
16061 typename std::vector<
16063 for (
it = periodic_face_pairs_level_0.begin();
16064 it != periodic_face_pairs_level_0.end();
16072 periodic_face_map);
16074 const auto face_reference_cell =
16075 it->cell[0]->reference_cell().face_reference_cell(
it->face_idx[0]);
16082 face_reference_cell.get_inverse_combined_orientation(
it->orientation),
16083 periodic_face_map);
16087 typename std::map<std::pair<cell_iterator, unsigned int>,
16088 std::pair<std::pair<cell_iterator, unsigned int>,
16091 for (
it_test = periodic_face_map.begin();
it_test != periodic_face_map.end();
16111template <
int dim,
int spacedim>
16116 for (
auto cell : active_cell_iterators())
16117 if (cell->is_locally_owned())
16120 this->reference_cells =
16127template <
int dim,
int spacedim>
16129const std::vector<ReferenceCell>
16132 return this->reference_cells;
16137template <
int dim,
int spacedim>
16141 Assert(this->reference_cells.size() > 0,
16142 ExcMessage(
"You can't ask about the kinds of reference "
16143 "cells used by this triangulation if the "
16144 "triangulation doesn't yet have any cells in it."));
16145 return (this->reference_cells.size() == 1 &&
16146 this->reference_cells[0].is_hyper_cube());
16151template <
int dim,
int spacedim>
16155 Assert(this->reference_cells.size() > 0,
16156 ExcMessage(
"You can't ask about the kinds of reference "
16157 "cells used by this triangulation if the "
16158 "triangulation doesn't yet have any cells in it."));
16159 return (this->reference_cells.size() == 1 &&
16160 this->reference_cells[0].is_simplex());
16165template <
int dim,
int spacedim>
16169 Assert(this->reference_cells.size() > 0,
16170 ExcMessage(
"You can't ask about the kinds of reference "
16171 "cells used by this triangulation if the "
16172 "triangulation doesn't yet have any cells in it."));
16173 return reference_cells.size() > 1 ||
16174 ((reference_cells[0].is_hyper_cube() ==
false) &&
16175 (reference_cells[0].is_simplex() ==
false));
16180template <
int dim,
int spacedim>
16183 const std::function<std::vector<char>(
const cell_iterator &,
16184 const ::CellStatus)>
16194 handle = 2 * this->cell_attached_data.pack_callbacks_variable.size();
16195 this->cell_attached_data.pack_callbacks_variable.push_back(pack_callback);
16199 handle = 2 * this->cell_attached_data.pack_callbacks_fixed.size() + 1;
16200 this->cell_attached_data.pack_callbacks_fixed.push_back(pack_callback);
16204 ++this->cell_attached_data.n_attached_data_sets;
16211template <
int dim,
int spacedim>
16214 const unsigned int handle,
16215 const std::function<
16216 void(
const cell_iterator &,
16217 const ::CellStatus,
16218 const boost::iterator_range<std::vector<char>::const_iterator> &)>
16222 this->data_serializer.unpack_data(this->local_cell_relations,
16227 --this->cell_attached_data.n_attached_data_sets;
16228 if (this->cell_attached_data.n_attached_deserialize > 0)
16229 --this->cell_attached_data.n_attached_deserialize;
16238 if (this->cell_attached_data.n_attached_data_sets == 0 &&
16239 this->cell_attached_data.n_attached_deserialize == 0)
16242 this->cell_attached_data.pack_callbacks_fixed.
clear();
16243 this->cell_attached_data.pack_callbacks_variable.
clear();
16244 this->data_serializer.
clear();
16254template <
int dim,
int spacedim>
16265 for (
const auto &
cell_rel :
this->local_cell_relations)
16273 if (this->cell_attached_data.n_attached_data_sets > 0)
16276 tria->data_serializer.pack_data(
16277 tria->local_cell_relations,
16278 tria->cell_attached_data.pack_callbacks_fixed,
16279 tria->cell_attached_data.pack_callbacks_variable,
16280 this->get_mpi_communicator());
16286 this->get_mpi_communicator());
16289 tria->data_serializer.clear();
16295 tria->cell_attached_data.n_attached_data_sets = 0;
16296 tria->cell_attached_data.pack_callbacks_fixed.clear();
16297 tria->cell_attached_data.pack_callbacks_variable.clear();
16302template <
int dim,
int spacedim>
16313 if (this->cell_attached_data.n_attached_deserialize > 0)
16321 this->get_mpi_communicator());
16323 this->data_serializer.unpack_cell_status(this->local_cell_relations);
16328 for (
const auto &
cell_rel :
this->local_cell_relations)
16339template <
int dim,
int spacedim>
16347 vertices_used.
clear();
16355 vertex_to_boundary_id_map_1d->clear();
16358 vertex_to_manifold_id_map_1d->clear();
16373template <
int dim,
int spacedim>
16379 this->policy->execute_refinement(*
this, check_for_distorted_cells);
16385 *
this, levels.size(), number_cache);
16388 for (
const auto &
level : levels)
16395 for (
const auto &cell :
this->cell_iterators())
16404template <
int dim,
int spacedim>
16410 const cell_iterator
endc =
end();
16412 if (levels.size() >= 2)
16413 for (cell_iterator cell =
begin(n_levels() - 1); cell !=
endc; --cell)
16414 if (!cell->is_active() && cell->child(0)->coarsen_flag_set())
16426 std::vector<unsigned int>
line_cell_count(dim > 1 ? this->n_raw_lines() : 0);
16427 std::vector<unsigned int>
quad_cell_count(dim > 2 ? this->n_raw_quads() : 0);
16429 for (
const auto &cell :
this->cell_iterators())
16433 const auto line_indices = internal::TriaAccessorImplementation::
16434 Implementation::get_line_indices_of_cell(*cell);
16437 const unsigned int n_lines =
std::min(cell->n_lines(), 12u);
16438 for (
unsigned int l = 0;
l < n_lines; ++
l)
16440 for (
const unsigned int q : cell->face_indices())
16444 for (
unsigned int l = 0;
l < cell->n_lines(); ++
l)
16462 if (levels.size() >= 2)
16463 for (cell_iterator cell =
begin(n_levels() - 1); cell !=
endc; --cell)
16464 if (!cell->is_active() && cell->child(0)->coarsen_flag_set())
16466 for (
unsigned int child = 0; child < cell->n_children(); ++child)
16468 Assert(cell->child(child)->coarsen_flag_set(),
16470 cell->child(child)->clear_coarsen_flag();
16473 signals.pre_coarsening_on_cell(cell);
16475 this->policy->delete_children(*
this,
16483 *
this, levels.size(), number_cache);
16488template <
int dim,
int spacedim>
16511 if (smooth_grid & limit_level_difference_at_vertices)
16513 Assert(!anisotropic_refinement,
16514 ExcMessage(
"In case of anisotropic refinement the "
16515 "limit_level_difference_at_vertices flag for "
16516 "mesh smoothing must not be set!"));
16521 for (
const auto &cell :
this->active_cell_iterators())
16523 if (cell->refine_flag_set())
16527 cell->
level() + 1);
16528 else if (!cell->coarsen_flag_set())
16545 cell->
level() - 1);
16559 active_cell_iterator
endc =
end();
16560 for (active_cell_iterator cell = last_active(); cell !=
endc; --cell)
16561 if (cell->refine_flag_set() ==
false)
16568 cell->clear_coarsen_flag();
16576 cell->set_refine_flag();
16581 cell->
level() + 1);
16597 for (
const auto &
acell :
this->active_cell_iterators_on_level(0))
16598 acell->clear_coarsen_flag();
16600 const cell_iterator
endc =
end();
16601 for (cell_iterator cell =
begin(n_levels() - 1); cell !=
endc; --cell)
16604 if (cell->is_active())
16607 const unsigned int n_children = cell->n_children();
16609 for (
unsigned int child = 0; child < n_children; ++child)
16623 this->policy->coarsening_allowed(cell))
16624 for (
unsigned int c = 0; c < n_children; ++c)
16626 Assert(cell->child(c)->refine_flag_set() ==
false,
16629 cell->child(c)->set_coarsen_flag();
16652 const auto flags_before = internal::extract_raw_coarsen_flags(levels);
16655 fix_coarsen_flags();
16657 const auto flags_after = internal::extract_raw_coarsen_flags(levels);
16670 const auto flags_before = internal::extract_raw_coarsen_flags(levels);
16673 fix_coarsen_flags();
16675 const auto flags_after = internal::extract_raw_coarsen_flags(levels);
16688 const auto flags_before = internal::extract_raw_coarsen_flags(levels);
16691 fix_coarsen_flags();
16693 const auto flags_after = internal::extract_raw_coarsen_flags(levels);
16706 template <
int dim,
int spacedim>
16716 unsigned int count = 0;
16717 for (
const unsigned int n :
GeometryInfo<dim>::face_indices())
16735 for (
unsigned int c = 0; c < cell->n_children(); ++c)
16736 cell->child(c)->clear_coarsen_flag();
16738 for (
const unsigned int face :
GeometryInfo<dim>::face_indices())
16739 if (!cell->at_boundary(face) &&
16740 (!cell->neighbor(face)->is_active()) &&
16743 cell->neighbor(face));
16758 template <
int dim,
int spacedim>
16762 const bool allow_anisotropic_smoothing)
16770 *
>(&cell->get_triangulation()) ==
nullptr)
16778 Assert(cell->refine_flag_set() ==
false,
16780 "The triangulation is trying to avoid unrefined islands "
16781 "during mesh refinement/coarsening, as you had requested "
16782 " by passing the appropriate 'smoothing flags' to the "
16783 "constructor of the triangulation. However, for objects "
16784 "of type parallel::distributed::Triangulation, control "
16785 "over which cells get refined rests with p4est, not the "
16786 "deal.II triangulation, and consequently it is not "
16787 "always possible to avoid unrefined islands in the mesh. "
16788 "Please remove the constructor argument to the triangulation "
16789 "object that requests mesh smoothing."));
16801 if (allow_anisotropic_smoothing ==
false)
16805 for (
const unsigned int face :
GeometryInfo<dim>::face_indices())
16806 if (!cell->at_boundary(face))
16816 cell->clear_coarsen_flag();
16817 cell->set_refine_flag();
16823 for (
const unsigned int face :
GeometryInfo<dim>::face_indices())
16824 if (!cell->at_boundary(face) &&
16826 (cell->neighbor(face)->has_children() ==
false) &&
16827 (cell->neighbor(face)->refine_flag_set() ==
false))
16829 cell->neighbor(face), allow_anisotropic_smoothing);
16851 for (
unsigned int face_index = 0; face_index < 2; ++face_index)
16853 unsigned int face = 2 *
face_pair + face_index;
16881 cell->face_orientation(face),
16882 cell->face_flip(face),
16883 cell->face_rotation(face)));
16900 cell->clear_coarsen_flag();
16901 cell->set_refine_flag(cell->refine_flag_set() |
16909template <
int dim,
int spacedim>
17012 if (((smooth_grid & coarsest_level_1) || (smooth_grid & patch_level_1)) &&
17015 for (
const auto &cell : active_cell_iterators_on_level(1))
17016 cell->clear_coarsen_flag();
17028 if (smooth_grid & do_not_produce_unrefined_islands &&
17029 !(smooth_grid & patch_level_1))
17031 for (
const auto &cell : cell_iterators())
17060 if (smooth_grid & (eliminate_refined_inner_islands |
17061 eliminate_refined_boundary_islands) &&
17062 !(smooth_grid & patch_level_1))
17064 for (
const auto &cell : cell_iterators())
17065 if (!cell->is_active() ||
17066 (cell->is_active() && cell->refine_flag_set() &&
17067 cell->is_locally_owned()))
17075 if (!cell->is_active())
17076 for (
unsigned int c = 0; c < cell->n_children(); ++c)
17077 if (!cell->child(c)->is_active() ||
17078 cell->child(c)->is_ghost() ||
17079 cell->child(c)->is_artificial())
17105 for (
const unsigned int n : cell->face_indices())
17107 const cell_iterator neighbor = cell->neighbor(n);
17115 else if (cell->has_periodic_neighbor(n))
17134 ((!cell->at_boundary() &&
17135 (smooth_grid & eliminate_refined_inner_islands)) ||
17138 eliminate_refined_boundary_islands))) &&
17141 if (!cell->is_active())
17142 for (
unsigned int c = 0; c < cell->n_children(); ++c)
17144 cell->child(c)->clear_refine_flag();
17145 cell->child(c)->set_coarsen_flag();
17148 cell->clear_refine_flag();
17163 if (smooth_grid & limit_level_difference_at_vertices)
17165 Assert(!anisotropic_refinement,
17166 ExcMessage(
"In case of anisotropic refinement the "
17167 "limit_level_difference_at_vertices flag for "
17168 "mesh smoothing must not be set!"));
17173 for (
const auto &cell : active_cell_iterators())
17175 if (cell->refine_flag_set())
17179 cell->
level() + 1);
17180 else if (!cell->coarsen_flag_set())
17195 cell->
level() - 1);
17209 for (active_cell_iterator cell = last_active(); cell !=
end(); --cell)
17210 if (cell->refine_flag_set() ==
false)
17217 cell->clear_coarsen_flag();
17225 cell->set_refine_flag();
17230 cell->
level() + 1);
17251 if (smooth_grid & eliminate_unrefined_islands)
17253 for (active_cell_iterator cell = last_active(); cell !=
end(); --cell)
17256 if (cell->refine_flag_set() !=
17259 cell, (smooth_grid & allow_anisotropic_smoothing) != 0);
17287 if (smooth_grid & patch_level_1)
17297 for (
const auto &cell : cell_iterators())
17298 if (!cell->is_active())
17304 if (cell->child(0)->has_children() ==
true)
17311 for (
unsigned int i = 0; i < cell->n_children(); ++i)
17315 for (
unsigned int i = 0; i < cell->n_children(); ++i)
17317 cell_iterator child = cell->child(i);
17319 child->clear_coarsen_flag();
17333 for (
const auto &cell : cell_iterators())
17339 if (cell->is_active() || cell->child(0)->is_active())
17346 const unsigned int n_children = cell->n_children();
17349 for (
unsigned int i = 0; i < n_children; ++i)
17350 if (cell->child(i)->child(0)->is_active())
17370 for (
unsigned int c = 0; c < n_children; ++c)
17375 cell_iterator child = cell->child(c);
17377 const unsigned int nn_children = child->n_children();
17383 if (child->child(0)->is_active())
17385 if (child->child(
cc)->coarsen_flag_set())
17401 for (
unsigned int c = 0; c < n_children; ++c)
17403 const cell_iterator child = cell->child(c);
17404 if (child->child(0)->is_active())
17405 for (
unsigned int cc = 0;
cc < child->n_children(); ++
cc)
17406 child->child(
cc)->clear_coarsen_flag();
17417 this->policy->prevent_distorted_boundary_cells(*
this);
17437 active_cell_iterator cell = last_active(),
endc =
end();
17439 for (; cell !=
endc; --cell)
17440 if (cell->refine_flag_set())
17443 for (
const auto i : cell->face_indices())
17448 const bool has_periodic_neighbor =
17449 cell->has_periodic_neighbor(i);
17451 !cell->at_boundary(i) || has_periodic_neighbor;
17454 cell->refine_flag_set(), i) !=
17467 if (cell->neighbor_or_periodic_neighbor(i)->is_active())
17469 if ((!has_periodic_neighbor &&
17470 cell->neighbor_is_coarser(i)) ||
17471 (has_periodic_neighbor &&
17472 cell->periodic_neighbor_is_coarser(i)))
17474 if (cell->neighbor_or_periodic_neighbor(i)
17475 ->coarsen_flag_set())
17476 cell->neighbor_or_periodic_neighbor(i)
17477 ->clear_coarsen_flag();
17494 allow_anisotropic_smoothing)
17496 has_periodic_neighbor ?
17497 cell->periodic_neighbor(i)
17498 ->flag_for_face_refinement(
17500 ->periodic_neighbor_of_coarser_periodic_neighbor(
17505 ->flag_for_face_refinement(
17507 ->neighbor_of_coarser_neighbor(
17514 ->neighbor_or_periodic_neighbor(
17516 ->refine_flag_set())
17518 cell->neighbor_or_periodic_neighbor(i)
17519 ->set_refine_flag();
17651 std::pair<unsigned int, unsigned int>
17653 has_periodic_neighbor ?
17655 ->periodic_neighbor_of_coarser_periodic_neighbor(
17657 cell->neighbor_of_coarser_neighbor(i);
17664 cell->face_index(i);
17674 if (has_periodic_neighbor)
17676 const auto neighbor =
17677 cell->periodic_neighbor(i);
17680 ->periodic_neighbor_of_periodic_neighbor(
17683 neighbor->periodic_neighbor(
17688 return cell->neighbor(i)->face(
17722 cell->refine_flag_set(),
17724 cell->face_orientation(i),
17725 cell->face_flip(i),
17726 cell->face_rotation(i));
17737 allow_anisotropic_smoothing) ||
17738 cell->neighbor_or_periodic_neighbor(i)
17739 ->refine_flag_set())
17746 ->neighbor_or_periodic_neighbor(i)
17747 ->flag_for_face_refinement(
17756 ->neighbor_or_periodic_neighbor(i)
17757 ->flag_for_face_refinement(
17765 ->neighbor_or_periodic_neighbor(i)
17766 ->refine_flag_set() !=
17770 cell->neighbor_or_periodic_neighbor(i)
17771 ->set_refine_flag();
17777 cell->neighbor_or_periodic_neighbor(i);
17780 nb->refine_flag_set(),
17788 changed |= cell->flag_for_face_refinement(
17794 changed |= cell->flag_for_face_refinement(
17801 cell->neighbor_or_periodic_neighbor(i)
17802 ->clear_coarsen_flag();
17803 const unsigned int nb_nb =
17804 has_periodic_neighbor ?
17806 ->periodic_neighbor_of_periodic_neighbor(
17808 cell->neighbor_of_neighbor(i);
17809 const cell_iterator neighbor =
17810 cell->neighbor_or_periodic_neighbor(i);
17813 neighbor->refine_flag_set(),
17815 neighbor->face_orientation(
nb_nb),
17816 neighbor->face_flip(
nb_nb),
17817 neighbor->face_rotation(
nb_nb));
17820 cell->refine_flag_set(),
17822 cell->face_orientation(i),
17823 cell->face_flip(i),
17824 cell->face_rotation(i));
17838 changed = cell->flag_for_face_refinement(
17840 neighbor->flag_for_face_refinement(
17851 cell->refine_flag_set(),
17853 cell->face_orientation(i),
17854 cell->face_flip(i),
17855 cell->face_rotation(i));
17866 cell->flag_for_face_refinement(i,
17878 this->policy->prepare_refinement_dim_dependent(*
this);
17884 fix_coarsen_flags();
17888 internal::extract_raw_coarsen_flags(levels);
17912template <
int dim,
int spacedim>
17916 const std::vector<bool> &v,
17920 const unsigned int N = v.size();
17921 unsigned char *flags =
new unsigned char[
N / 8 + 1];
17922 for (
unsigned int i = 0; i <
N / 8 + 1; ++i)
17925 for (
unsigned int position = 0; position <
N; ++position)
17926 flags[position / 8] |= (v[position] ? (1 << (position % 8)) : 0);
17936 for (
unsigned int i = 0; i <
N / 8 + 1; ++i)
17937 out <<
static_cast<unsigned int>(flags[i]) <<
' ';
17947template <
int dim,
int spacedim>
17951 std::vector<bool> &v,
17965 unsigned char *flags =
new unsigned char[
N / 8 + 1];
17966 unsigned short int tmp;
17967 for (
unsigned int i = 0; i <
N / 8 + 1; ++i)
17973 for (
unsigned int position = 0; position !=
N; ++position)
17974 v[position] = ((flags[position / 8] & (1 << (position % 8))) != 0);
17986template <
int dim,
int spacedim>
17990 std::size_t mem = 0;
17991 mem +=
sizeof(MeshSmoothing);
17995 for (
const auto &
level : levels)
17999 mem +=
sizeof(manifolds);
18000 mem +=
sizeof(smooth_grid);
18002 mem +=
sizeof(faces);
18011template <
int dim,
int spacedim>
18019#include "grid/tria.inst"