49 namespace DoFHandlerImplementation
66 std::vector<std::pair<unsigned int, unsigned int>>;
79 template <
int structdim,
int dim,
int spacedim>
80 const std::unique_ptr<DoFIdentities> &
82 const ::hp::FECollection<dim, spacedim> &
fes,
97 std::vector<std::map<unsigned int, unsigned int>>
203 template <
int dim,
int spacedim>
204 static std::map<types::global_dof_index, types::global_dof_index>
209 dof_handler.hp_capability_enabled ==
true,
212 std::map<types::global_dof_index, types::global_dof_index>
223 dof_handler.get_fe_collection().
size());
226 for (
unsigned int vertex_index = 0;
227 vertex_index < dof_handler.get_triangulation().n_vertices();
229 if (dof_handler.get_triangulation()
230 .get_used_vertices()[vertex_index] ==
true)
232 const unsigned int n_active_fe_indices =
233 ::internal::DoFAccessorImplementation::Implementation::
234 n_active_fe_indices(dof_handler,
237 std::integral_constant<int, 0>());
239 if (n_active_fe_indices > 1)
242 ::internal::DoFAccessorImplementation::
243 Implementation::get_active_fe_indices(
247 std::integral_constant<int, 0>());
253 dof_handler.get_fe_collection().find_dominating_fe(
262 ::internal::DoFAccessorImplementation::
263 Implementation::nth_active_fe_index(
268 std::integral_constant<int, 0>());
281 dof_handler.get_fe_collection(),
298 ::internal::DoFAccessorImplementation::
299 Implementation::get_dof_index(
305 std::integral_constant<int, 0>());
308 ::internal::DoFAccessorImplementation::
309 Implementation::get_dof_index(
315 std::integral_constant<int, 0>());
365 template <
int spacedim>
366 static std::map<types::global_dof_index, types::global_dof_index>
370 Assert(dof_handler.hp_capability_enabled ==
true,
373 return std::map<types::global_dof_index, types::global_dof_index>();
377 template <
int dim,
int spacedim>
378 static std::map<types::global_dof_index, types::global_dof_index>
383 dof_handler.hp_capability_enabled ==
true,
386 std::map<types::global_dof_index, types::global_dof_index>
409 dof_handler.fe_collection.
size(), dof_handler.fe_collection.
size());
412 dof_handler.get_triangulation().n_raw_lines());
413 for (
const auto &cell : dof_handler.active_cell_iterators())
414 for (
const auto l : cell->line_indices())
417 const auto line = cell->line(l);
421 line->n_active_fe_indices();
425 const unsigned int n_active_fe_indices =
426 line->n_active_fe_indices();
427 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
428 for (
unsigned int g = f + 1;
g < n_active_fe_indices; ++
g)
431 line->nth_active_fe_index(f),
433 line->nth_active_fe_index(
g);
451 if ((dof_handler.get_fe(
fe_index_1).n_dofs_per_line() ==
453 .n_dofs_per_line()) &&
454 (dof_handler.get_fe(
fe_index_1).n_dofs_per_line() >
458 const unsigned int dofs_per_line =
459 dof_handler.get_fe(
fe_index_1).n_dofs_per_line();
463 dof_handler.get_fe_collection(),
473 for (; i < dofs_per_line; ++i)
479 if (i == dofs_per_line)
497 dof_handler.get_fe_collection()
519 for (
unsigned int j = 0;
j < dofs_per_line;
628 line->get_active_fe_indices();
634 dof_handler.get_fe_collection().find_dominating_fe(
653 1>(dof_handler.get_fe_collection(),
722 template <
int dim,
int spacedim>
723 static std::map<types::global_dof_index, types::global_dof_index>
729 dof_handler.hp_capability_enabled ==
true,
737 return std::map<types::global_dof_index, types::global_dof_index>();
741 template <
int spacedim>
742 static std::map<types::global_dof_index, types::global_dof_index>
745 Assert(dof_handler.hp_capability_enabled ==
true,
750 std::map<types::global_dof_index, types::global_dof_index>
765 dof_handler.fe_collection.
size(),
766 dof_handler.fe_collection.
size(),
770 dof_handler.get_triangulation().n_raw_quads());
771 for (
const auto &cell : dof_handler.active_cell_iterators())
772 for (
const auto q : cell->face_indices())
774 (cell->quad(
q)->n_active_fe_indices() == 2))
776 const auto quad = cell->quad(
q);
780 quad->get_active_fe_indices();
786 dof_handler.get_fe_collection().find_dominating_fe(
793 cell->neighbor_face_no(
q);
812 dof_handler.get_fe_collection(),
817 [cell->quad(
q)->reference_cell() ==
874 template <
int dim,
int spacedim>
881 if (dof_handler.hp_capability_enabled ==
false)
940 std::map<types::global_dof_index, types::global_dof_index>>
997 template <
int dim,
int spacedim>
1003 if (dof_handler.hp_capability_enabled ==
false)
1007 std::map<types::global_dof_index, types::global_dof_index>>
1011 std::vector<::types::global_dof_index>
renumbering(
1029 template <
int dim,
int spacedim>
1035 dof_handler.hp_capability_enabled ==
true,
1046 dof_handler.get_fe_collection().
size());
1051 dof_handler.get_triangulation().n_vertices(),
false);
1052 if (
dynamic_cast<const ::parallel::
1053 DistributedTriangulationBase<dim, spacedim> *
>(
1054 &dof_handler.get_triangulation()) !=
nullptr)
1055 for (
const auto &cell : dof_handler.active_cell_iterators())
1056 if (cell->is_ghost())
1057 for (
const unsigned int v : cell->vertex_indices())
1061 for (
unsigned int vertex_index = 0;
1062 vertex_index < dof_handler.get_triangulation().n_vertices();
1064 if ((dof_handler.get_triangulation()
1065 .get_used_vertices()[vertex_index] ==
true) &&
1068 const unsigned int n_active_fe_indices =
1069 ::internal::DoFAccessorImplementation::Implementation::
1070 n_active_fe_indices(dof_handler,
1073 std::integral_constant<int, 0>());
1075 if (n_active_fe_indices > 1)
1078 ::internal::DoFAccessorImplementation::
1079 Implementation::get_active_fe_indices(
1083 std::integral_constant<int, 0>());
1089 dof_handler.get_fe_collection().find_dominating_fe(
1098 ::internal::DoFAccessorImplementation::
1099 Implementation::nth_active_fe_index(
1104 std::integral_constant<int, 0>());
1117 dof_handler.get_fe_collection(),
1134 ::internal::DoFAccessorImplementation::
1135 Implementation::get_dof_index(
1141 std::integral_constant<int, 0>());
1144 ::internal::DoFAccessorImplementation::
1145 Implementation::get_dof_index(
1151 std::integral_constant<int, 0>());
1169 ::internal::DoFAccessorImplementation::
1170 Implementation::set_dof_index(
1176 std::integral_constant<int, 0>(),
1190 template <
int spacedim>
1196 Assert(dof_handler.hp_capability_enabled ==
true,
1201 template <
int dim,
int spacedim>
1207 dof_handler.hp_capability_enabled ==
true,
1212 dof_handler.get_triangulation().n_raw_lines());
1213 for (
const auto &cell : dof_handler.active_cell_iterators())
1214 if (cell->is_ghost())
1215 for (
const auto l : cell->line_indices())
1238 dof_handler.fe_collection.
size(), dof_handler.fe_collection.
size());
1240 for (
const auto &cell : dof_handler.active_cell_iterators())
1241 for (
const auto l : cell->line_indices())
1242 if ((cell->is_locally_owned()) &&
1245 const auto line = cell->line(l);
1249 line->n_active_fe_indices();
1253 const unsigned int n_active_fe_indices =
1254 line->n_active_fe_indices();
1255 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
1256 for (
unsigned int g = f + 1;
g < n_active_fe_indices; ++
g)
1259 line->nth_active_fe_index(f),
1261 line->nth_active_fe_index(
g);
1263 if ((dof_handler.get_fe(
fe_index_1).n_dofs_per_line() ==
1265 .n_dofs_per_line()) &&
1266 (dof_handler.get_fe(
fe_index_1).n_dofs_per_line() >
1270 const unsigned int dofs_per_line =
1271 dof_handler.get_fe(
fe_index_1).n_dofs_per_line();
1275 dof_handler.get_fe_collection(),
1285 for (; i < dofs_per_line; ++i)
1291 if (i == dofs_per_line)
1309 dof_handler.get_fe_collection()
1331 for (
unsigned int j = 0;
j < dofs_per_line;
1358 line->set_dof_index(
j,
1380 line->get_active_fe_indices();
1386 dof_handler.get_fe_collection().find_dominating_fe(
1405 1>(dof_handler.get_fe_collection(),
1439 line->set_dof_index(
identity.second,
1455 template <
int dim,
int spacedim>
1462 dof_handler.hp_capability_enabled ==
true,
1472 template <
int spacedim>
1477 Assert(dof_handler.hp_capability_enabled ==
true,
1484 dof_handler.get_triangulation().n_raw_quads());
1485 for (
const auto &cell : dof_handler.active_cell_iterators())
1486 if (cell->is_ghost())
1487 for (
const auto q : cell->face_indices())
1502 dof_handler.fe_collection.
size(),
1503 dof_handler.fe_collection.
size(),
1506 for (
const auto &cell : dof_handler.active_cell_iterators())
1507 for (
const auto q : cell->face_indices())
1508 if ((cell->is_locally_owned()) &&
1510 (cell->quad(
q)->n_active_fe_indices() == 2))
1512 const auto quad = cell->quad(
q);
1516 quad->get_active_fe_indices();
1522 dof_handler.get_fe_collection().find_dominating_fe(
1529 cell->neighbor_face_no(
q);
1548 dof_handler.get_fe_collection(),
1553 [cell->quad(
q)->reference_cell() ==
1583 quad->set_dof_index(
identity.second,
1606 template <
int dim,
int spacedim>
1611 if (dof_handler.hp_capability_enabled ==
false)
1647 template <
int dim,
int spacedim>
1652 Assert(dof_handler.get_triangulation().n_levels() > 0,
1658 for (
auto cell : dof_handler.active_cell_iterators())
1659 if (!cell->is_artificial() &&
1661 (cell->subdomain_id() == subdomain_id)))
1666 DoFAccessorImplementation::Implementation::process_dof_indices(
1669 cell->active_fe_index(),
1670 DoFAccessorImplementation::Implementation::
1678 std::numeric_limits<types::global_dof_index>::max(),
1680 "You have reached the maximal number of degrees of "
1681 "freedom that can be stored in the chosen data "
1682 "type. In practice, this can only happen if you "
1683 "are using 32-bit data types. You will have to "
1684 "re-compile deal.II with the "
1685 "`DEAL_II_WITH_64BIT_INDICES' flag set to `ON'."));
1710 template <
int dim,
int spacedim>
1713 std::vector<types::global_dof_index> &
renumbering,
1717 std::vector<types::global_dof_index> local_dof_indices;
1719 for (
const auto &cell : dof_handler.active_cell_iterators())
1720 if (cell->is_ghost() && (cell->subdomain_id() < subdomain_id))
1728 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1729 internal::DoFAccessorImplementation::Implementation::
1730 get_dof_indices(*cell,
1732 cell->active_fe_index());
1745 template <
int dim,
int spacedim>
1749 const unsigned int level)
1751 Assert(dof_handler.hp_capability_enabled ==
false,
1754 const ::Triangulation<dim, spacedim> &
tria =
1755 dof_handler.get_triangulation();
1762 for (
auto cell : dof_handler.cell_iterators_on_level(
level))
1764 (cell->level_subdomain_id() == level_subdomain_id))
1766 DoFAccessorImplementation::Implementation::process_dof_indices(
1770 DoFAccessorImplementation::Implementation::
1778 std::numeric_limits<types::global_dof_index>::max(),
1780 "You have reached the maximal number of degrees of "
1781 "freedom that can be stored in the chosen data "
1782 "type. In practice, this can only happen if you "
1783 "are using 32-bit data types. You will have to "
1784 "re-compile deal.II with the "
1785 "`DEAL_II_WITH_64BIT_INDICES' flag set to `ON'."));
1807 template <
int dim,
int spacedim>
1810 const std::vector<types::global_dof_index> &
new_numbers,
1814 for (
unsigned int d = 1; d < dim; ++d)
1815 for (
auto &i : dof_handler.object_dof_indices[0][d])
1824 template <
int dim,
int spacedim>
1827 const std::vector<types::global_dof_index> &
new_numbers,
1832 if (dof_handler.hp_capability_enabled ==
false)
1840 for (std::vector<types::global_dof_index>::iterator i =
1841 dof_handler.object_dof_indices[0][0].
begin();
1842 i != dof_handler.object_dof_indices[0][0].
end();
1852 Assert(dof_handler.get_triangulation().vertex_used(
1853 (i - dof_handler.object_dof_indices[0][0].
begin()) /
1854 dof_handler.get_fe().n_dofs_per_vertex()) ==
false,
1860 for (
unsigned int vertex_index = 0;
1861 vertex_index < dof_handler.get_triangulation().n_vertices();
1864 const unsigned int n_active_fe_indices =
1865 ::internal::DoFAccessorImplementation::Implementation::
1866 n_active_fe_indices(dof_handler,
1869 std::integral_constant<int, 0>());
1875 if (dof_handler.get_triangulation().vertex_used(vertex_index) ==
1883 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
1886 ::internal::DoFAccessorImplementation::
1887 Implementation::nth_active_fe_index(
1892 std::integral_constant<int, 0>());
1894 for (
unsigned int d = 0;
1895 d < dof_handler.get_fe(fe_index).n_dofs_per_vertex();
1899 ::internal::DoFAccessorImplementation::
1900 Implementation::get_dof_index(
1906 std::integral_constant<int, 0>());
1938 ::internal::DoFAccessorImplementation::
1939 Implementation::set_dof_index(
1945 std::integral_constant<int, 0>(),
1951 ::internal::DoFAccessorImplementation::
1952 Implementation::set_dof_index(
1958 std::integral_constant<int, 0>(),
1963 ::internal::DoFAccessorImplementation::
1964 Implementation::set_dof_index(
1970 std::integral_constant<int, 0>(),
1981 template <
int dim,
int spacedim>
1984 const std::vector<types::global_dof_index> &
new_numbers,
1988 if (dof_handler.hp_capability_enabled ==
false)
1990 for (
unsigned int level = 0;
1991 level < dof_handler.object_dof_indices.
size();
1993 for (
auto &i : dof_handler.object_dof_indices[
level][dim])
2002 for (
const auto &cell : dof_handler.active_cell_iterators())
2003 if (!cell->is_artificial())
2007 for (
unsigned int d = 0;
2008 d < dof_handler.get_fe(fe_index)
2013 cell->dof_index(d, fe_index);
2031 cell->set_dof_index(d,
2037 cell->set_dof_index(
2043 cell->set_dof_index(d,
2054 template <
int spacedim>
2057 const std::vector<types::global_dof_index> & ,
2067 template <
int spacedim>
2070 const std::vector<types::global_dof_index> &
new_numbers,
2074 const unsigned int dim = 2;
2076 if (dof_handler.hp_capability_enabled ==
false)
2078 for (
unsigned int d = 1; d < dim; ++d)
2079 for (
auto &i : dof_handler.object_dof_indices[0][d])
2091 dof_handler.get_triangulation().n_raw_lines());
2092 for (
const auto &cell : dof_handler.active_cell_iterators())
2093 if (!cell->is_artificial())
2094 for (
const auto l : cell->line_indices())
2097 const auto line = cell->line(l);
2100 const unsigned int n_active_fe_indices =
2101 line->n_active_fe_indices();
2103 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
2106 line->nth_active_fe_index(f);
2108 for (
unsigned int d = 0;
2110 dof_handler.get_fe(fe_index).n_dofs_per_line();
2114 line->dof_index(d, fe_index);
2135 line->set_dof_index(
2141 line->set_dof_index(
2148 line->set_dof_index(
2162 template <
int spacedim>
2165 const std::vector<types::global_dof_index> &
new_numbers,
2169 const unsigned int dim = 3;
2171 if (dof_handler.hp_capability_enabled ==
false)
2173 for (
unsigned int d = 1; d < dim; ++d)
2174 for (
auto &i : dof_handler.object_dof_indices[0][d])
2186 dof_handler.get_triangulation().n_raw_lines());
2187 for (
const auto &cell : dof_handler.active_cell_iterators())
2188 if (!cell->is_artificial())
2189 for (
const auto l : cell->line_indices())
2192 const auto line = cell->line(l);
2195 const unsigned int n_active_fe_indices =
2196 line->n_active_fe_indices();
2198 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
2201 line->nth_active_fe_index(f);
2203 for (
unsigned int d = 0;
2205 dof_handler.get_fe(fe_index).n_dofs_per_line();
2209 line->dof_index(d, fe_index);
2230 line->set_dof_index(
2234 line->set_dof_index(
2241 line->set_dof_index(
2252 dof_handler.get_triangulation().n_raw_quads());
2253 for (
const auto &cell : dof_handler.active_cell_iterators())
2254 if (!cell->is_artificial())
2255 for (
const auto q : cell->face_indices())
2258 const auto quad = cell->quad(
q);
2261 const unsigned int n_active_fe_indices =
2262 quad->n_active_fe_indices();
2264 for (
unsigned int f = 0; f < n_active_fe_indices; ++f)
2267 quad->nth_active_fe_index(f);
2269 for (
unsigned int d = 0;
2271 dof_handler.get_fe(fe_index).n_dofs_per_quad(
q);
2275 quad->dof_index(d, fe_index);
2296 quad->set_dof_index(
2302 quad->set_dof_index(
2309 quad->set_dof_index(
2334 template <
int dim,
int space_dim>
2382 template <
int dim,
int spacedim>
2385 const std::vector<::types::global_dof_index> &
new_numbers,
2388 const unsigned int level)
2390 Assert(
level < dof_handler.get_triangulation().n_levels(),
2393 for (
auto i = dof_handler.mg_vertex_dofs.
begin();
2394 i != dof_handler.mg_vertex_dofs.
end();
2397 if ((i->get_coarsest_level() <=
level) &&
2398 (i->get_finest_level() >=
level))
2399 for (
unsigned int d = 0;
2400 d < dof_handler.get_fe().n_dofs_per_vertex();
2403 const ::types::global_dof_index idx =
2404 i->access_index(
level,
2406 dof_handler.get_fe().n_dofs_per_vertex());
2415 level, d, dof_handler.get_fe().n_dofs_per_vertex()) =
2433 template <
int dim,
int spacedim>
2436 const std::vector<::types::global_dof_index> &
new_numbers,
2439 const unsigned int level)
2441 for (std::vector<types::global_dof_index>::iterator i =
2442 dof_handler.mg_levels[
level]->dof_object.dofs.
begin();
2443 i != dof_handler.mg_levels[
level]->dof_object.dofs.
end();
2469 template <
int spacedim>
2472 const std::vector<types::global_dof_index> & ,
2475 const unsigned int ,
2483 template <
int dim,
int spacedim>
2486 const std::vector<::types::global_dof_index> &
new_numbers,
2489 const unsigned int level,
2492 const unsigned int dofs_per_line =
2493 dof_handler.get_fe().n_dofs_per_line();
2494 if (dofs_per_line > 0 ||
2495 (dim > 2 && dof_handler.get_fe().max_dofs_per_quad() > 0))
2501 dof_handler.get_triangulation().n_raw_lines());
2503 dim > 2 ? dof_handler.get_triangulation().n_raw_quads() : 0);
2504 for (
const auto &cell :
2505 dof_handler.cell_iterators_on_level(
level))
2506 if (cell->level_subdomain_id() !=
2510 if (dofs_per_line > 0)
2512 const auto line_indices =
2513 internal::TriaAccessorImplementation::Implementation::
2514 get_line_indices_of_cell(*cell);
2515 for (
const auto line : cell->line_indices())
2521 &internal::DoFAccessorImplementation::
2522 Implementation::get_mg_dof_index(
2524 dof_handler.mg_levels[
level],
2525 dof_handler.mg_faces,
2529 std::integral_constant<int, 1>());
2530 for (
unsigned int d = 0; d < dofs_per_line; ++d)
2552 for (
const auto quad : cell->face_indices())
2556 const unsigned int dofs_per_quad =
2557 dof_handler.get_fe().n_dofs_per_quad(quad);
2558 if (dofs_per_quad > 0)
2561 &internal::DoFAccessorImplementation::
2562 Implementation::get_mg_dof_index(
2564 dof_handler.mg_levels[
level],
2565 dof_handler.mg_faces,
2566 cell->quad(quad)->index(),
2569 std::integral_constant<int, 2>());
2570 for (
unsigned int d = 0; d < dofs_per_quad; ++d)
2594 template <
int dim,
int spacedim>
2597 const std::vector<::types::global_dof_index> &
new_numbers,
2600 const unsigned int level,
2604 dof_handler.hp_capability_enabled ==
false,
2607 Assert(
level < dof_handler.get_triangulation().n_global_levels(),
2643 template <
int dim,
int spacedim>
2646 : dof_handler(&dof_handler)
2651 template <
int dim,
int spacedim>
2670 template <
int dim,
int spacedim>
2671 std::vector<NumberCache>
2675 number_caches.reserve(dof_handler->get_triangulation().n_levels());
2676 for (
unsigned int level = 0;
2677 level < dof_handler->get_triangulation().n_levels();
2694 template <
int dim,
int spacedim>
2697 const std::vector<types::global_dof_index> &
new_numbers)
const
2721 template <
int dim,
int spacedim>
2724 const unsigned int level,
2725 const std::vector<types::global_dof_index> &
new_numbers)
const
2738 template <
int dim,
int spacedim>
2741 : dof_handler(&dof_handler)
2756 template <
int dim,
int spacedim>
2757 std::vector<types::subdomain_id>
2761 const unsigned int n_procs)
2766 std::vector<types::global_dof_index> local_dof_indices;
2767 local_dof_indices.reserve(
2768 dof_handler.get_fe_collection().max_dofs_per_cell());
2772 for (
const auto &cell : dof_handler.active_cell_iterators())
2779 const unsigned int dofs_per_cell =
2780 cell->get_fe().n_dofs_per_cell();
2781 local_dof_indices.resize(dofs_per_cell);
2782 internal::DoFAccessorImplementation::Implementation::
2783 get_dof_indices(*cell,
2785 cell->active_fe_index());
2790 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
2821 template <
int dim,
int spacedim>
2822 std::vector<types::subdomain_id>
2826 const unsigned int n_procs,
2827 const unsigned int level)
2832 std::vector<types::global_dof_index> local_dof_indices;
2833 local_dof_indices.reserve(
2834 dof_handler.get_fe_collection().max_dofs_per_cell());
2838 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2844 cell->level_subdomain_id();
2845 const unsigned int dofs_per_cell =
2846 cell->get_fe().n_dofs_per_cell();
2847 local_dof_indices.resize(dofs_per_cell);
2848 cell->get_mg_dof_indices(local_dof_indices);
2853 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
2882 template <
int dim,
int spacedim>
2886 const ::parallel::shared::Triangulation<dim, spacedim> *
tr =
2888 const ::parallel::shared::Triangulation<dim, spacedim> *
>(
2889 &this->dof_handler->get_triangulation()));
2892 const unsigned int n_procs =
2902 const internal::parallel::shared::
2903 TemporarilyRestoreSubdomainIds<dim, spacedim>
2910 *this->dof_handler);
2979 for (
unsigned int i = 1; i < n_dofs; ++i)
2983 std::vector<IndexSet> locally_owned_dofs_per_processor(
3021 locally_owned_dofs_per_processor,
3022 this->dof_handler->get_triangulation().locally_owned_subdomain());
3027 template <
int dim,
int spacedim>
3028 std::vector<NumberCache>
3031 const ::parallel::shared::Triangulation<dim, spacedim> *
tr =
3033 const ::parallel::shared::Triangulation<dim, spacedim> *
>(
3034 &this->dof_handler->get_triangulation()));
3039 "Multigrid DoFs can only be distributed on a parallel "
3040 "Triangulation if the flag construct_multigrid_hierarchy "
3041 "is set in the constructor."));
3043 const unsigned int n_procs =
3045 const unsigned int n_levels =
tr->n_global_levels();
3051 for (
unsigned int lvl = 0;
lvl < n_levels; ++
lvl)
3062 typename ::parallel::shared::Triangulation<dim, spacedim>
::
3064 this->dof_handler->get_triangulation().
begin(
3067 this->dof_handler->get_triangulation().
end(
lvl);
3070 tr->get_true_level_subdomain_ids_of_cells(
lvl);
3099 const std::vector<types::subdomain_id>
3161 std::vector<IndexSet> locally_owned_dofs_per_processor(
3198 typename ::parallel::shared::Triangulation<dim, spacedim>
::
3200 this->dof_handler->get_triangulation().
begin(
3203 this->dof_handler->get_triangulation().
end(
lvl);
3211 this->dof_handler->get_triangulation()
3212 .locally_owned_subdomain()));
3221 template <
int dim,
int spacedim>
3224 const std::vector<types::global_dof_index> &
new_numbers)
const
3226#ifndef DEAL_II_WITH_MPI
3233 const ::parallel::shared::Triangulation<dim, spacedim> *
tr =
3235 const ::parallel::shared::Triangulation<dim, spacedim> *
>(
3236 &this->dof_handler->get_triangulation()));
3240 const internal::parallel::shared::
3241 TemporarilyRestoreSubdomainIds<dim, spacedim>
3245 this->dof_handler->n_dofs(), 0);
3253 Utilities::MPI::internal::all_reduce<bool>(
3256 tr->get_communicator(),
3267 const unsigned int n_cpu =
3270 this->dof_handler->n_dofs(), 0);
3272 this->dof_handler->get_triangulation()
3273 .locally_owned_subdomain(),
3294 tr->get_communicator());
3300 for (
unsigned int i = 0; i <
n_cpu; ++i)
3306 static_cast<unsigned int>(
3308 tr->get_communicator())]),
3317 tr->get_communicator());
3327 std::vector<unsigned int>
flag_1(this->dof_handler->n_dofs(), 0);
3328 std::vector<unsigned int>
flag_2(this->dof_handler->n_dofs(), 0);
3329 std::vector<IndexSet> locally_owned_dofs_per_processor =
3331 tr->get_communicator(),
3332 this->dof_handler->locally_owned_dofs());
3333 for (
unsigned int i = 0; i <
n_cpu; ++i)
3335 const IndexSet iset = locally_owned_dofs_per_processor[i];
3374 this->dof_handler->get_triangulation().locally_owned_subdomain());
3376 return number_cache;
3382 template <
int dim,
int spacedim>
3385 const unsigned int ,
3386 const std::vector<types::global_dof_index> & )
const
3398#ifdef DEAL_II_WITH_MPI
3402 template <
int dim,
int spacedim>
3407 const auto pack = [](
const auto &cell) {
3411 std::vector<::types::global_dof_index> data(
3412 cell->get_fe().n_dofs_per_cell());
3413 cell->get_mg_dof_indices(data);
3418 const auto unpack = [&
cell_marked](
const auto &cell,
3420 Assert(cell->get_fe().n_dofs_per_cell() == dofs.size(),
3423 Assert(cell->level_subdomain_id() !=
3428 DoFAccessorImplementation::Implementation::process_dof_indices(
3432 DoFAccessorImplementation::Implementation::
3447# if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
3466 cell_marked[cell->level()][cell->index()] =
false;
3469 const auto filter = [&
cell_marked](
const auto &cell) {
3474 std::vector<types::global_dof_index>,
3498 template <
int dim,
int spacedim>
3504# ifndef DEAL_II_WITH_MPI
3512 const auto pack = [](
const auto &cell) {
3515 std::vector<::types::global_dof_index> data(
3516 cell->get_fe().n_dofs_per_cell());
3519 internal::DoFAccessorImplementation::Implementation::
3520 get_dof_indices(*cell, data, cell->active_fe_index());
3527 Assert(cell->get_fe().n_dofs_per_cell() == dofs.size(),
3536 DoFAccessorImplementation::Implementation::process_dof_indices(
3539 cell->active_fe_index(),
3540 DoFAccessorImplementation::Implementation::
3555# if !defined(__INTEL_COMPILER) || __INTEL_COMPILER >= 1900
3577 const auto filter = [&
cell_marked](
const auto &cell) {
3582 std::vector<types::global_dof_index>,
3595 template <
int dim,
int spacedim>
3598 : dof_handler(&dof_handler)
3603 template <
int dim,
int spacedim>
3607#ifndef DEAL_II_WITH_MPI
3617 &dof_handler->get_triangulation())));
3656 std::vector<::types::global_dof_index>
renumbering(
3668 std::vector<std::map<types::global_dof_index, types::global_dof_index>>
3719 const ::types::global_dof_index n_global_dofs =
3729 n_locally_owned_dofs);
3744 for (
const auto &cell : dof_handler->active_cell_iterators())
3745 if (cell->is_ghost())
3772 for (
const auto &cell : dof_handler->active_cell_iterators())
3781 std::vector<::types::global_dof_index> local_dof_indices;
3783 for (
const auto &cell : dof_handler->active_cell_iterators())
3784 if (!cell->is_artificial())
3786 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
3787 cell->get_dof_indices(local_dof_indices);
3788 if (local_dof_indices.end() !=
3789 std::find(local_dof_indices.begin(),
3790 local_dof_indices.end(),
3793 if (cell->is_ghost())
3797 "A ghost cell ended up with incomplete "
3798 "DoF index information. This should not "
3806 "A locally owned cell ended up with incomplete "
3807 "DoF index information. This should not "
3814 return number_cache;
3820 template <
int dim,
int spacedim>
3821 std::vector<NumberCache>
3824#ifndef DEAL_II_WITH_MPI
3826 return std::vector<NumberCache>();
3834 &dof_handler->get_triangulation())));
3839 "Multigrid DoFs can only be distributed on a parallel "
3840 "Triangulation if the flag construct_multigrid_hierarchy "
3841 "is set in the constructor."));
3848 const unsigned int n_levels =
triangulation->n_global_levels();
3862 std::vector<::types::global_dof_index>
renumbering(
3867 std::vector<::types::global_dof_index> local_dof_indices;
3869 for (
const auto &cell :
3870 dof_handler->cell_iterators_on_level(
level))
3871 if (cell->level_subdomain_id() !=
3873 (cell->level_subdomain_id() <
3883 local_dof_indices.resize(
3884 cell->get_fe().n_dofs_per_cell());
3885 cell->get_mg_dof_indices(local_dof_indices);
3886 for (
unsigned int i = 0;
3887 i < cell->get_fe().n_dofs_per_cell();
3959 for (
unsigned int l = 0; l <
triangulation->n_levels(); ++l)
3961 for (
const auto &cell : dof_handler->cell_iterators())
3962 if (cell->is_ghost_on_level())
3976 for (
const auto &cell : dof_handler->cell_iterators())
3987 std::vector<::types::global_dof_index> local_dof_indices;
3988 for (
const auto &cell : dof_handler->cell_iterators())
3989 if (cell->level_subdomain_id() !=
3992 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
3993 cell->get_mg_dof_indices(local_dof_indices);
3994 if (local_dof_indices.end() !=
3995 std::find(local_dof_indices.begin(),
3996 local_dof_indices.end(),
4011 template <
int dim,
int spacedim>
4014 const std::vector<::types::global_dof_index> &
new_numbers)
const
4021#ifndef DEAL_II_WITH_MPI
4031 &dof_handler->get_triangulation())));
4043 return owned_dofs.is_element(i) == false;
4074 for (
auto cell : dof_handler->active_cell_iterators())
4075 if (cell->is_ghost())
4077 DoFAccessorImplementation::Implementation::process_dof_indices(
4080 cell->active_fe_index(),
4081 DoFAccessorImplementation::Implementation::
4111 for (
const auto &cell : dof_handler->active_cell_iterators())
4112 if (cell->is_ghost())
4139 return number_cache;
4145 template <
int dim,
int spacedim>
4148 const unsigned int level,
4149 const std::vector<types::global_dof_index> &
new_numbers)
const
4151#ifndef DEAL_II_WITH_MPI
4165 &dof_handler->get_triangulation())));
4178 return owned_dofs.is_element(i) == false;
4201 for (
auto cell : dof_handler->cell_iterators_on_level(
level))
4202 if (cell->is_ghost_on_level())
4204 DoFAccessorImplementation::Implementation::process_dof_indices(
4208 DoFAccessorImplementation::Implementation::
4226 for (
unsigned int l = 0; l <
triangulation->n_levels(); ++l)
4228 for (
const auto &cell : dof_handler->cell_iterators_on_level(
level))
4229 if (cell->is_ghost_on_level())
4242 return number_cache;
4252#include "dof_handler_policy.inst"
const_iterator cend() const
const_iterator cbegin() const
value_type * data() const noexcept
size_type n_elements() const
void add_range(const size_type begin, const size_type end)
virtual NumberCache renumber_dofs(const std::vector< types::global_dof_index > &new_numbers) const override
ParallelDistributed(DoFHandler< dim, spacedim > &dof_handler)
virtual std::vector< NumberCache > distribute_mg_dofs() const override
virtual NumberCache renumber_mg_dofs(const unsigned int level, const std::vector< types::global_dof_index > &new_numbers) const override
virtual NumberCache distribute_dofs() const override
virtual NumberCache distribute_dofs() const override
virtual std::vector< NumberCache > distribute_mg_dofs() const override
virtual NumberCache renumber_mg_dofs(const unsigned int level, const std::vector< types::global_dof_index > &new_numbers) const override
ParallelShared(DoFHandler< dim, spacedim > &dof_handler)
virtual NumberCache renumber_dofs(const std::vector< types::global_dof_index > &new_numbers) const override
virtual std::vector< NumberCache > distribute_mg_dofs() const override
virtual NumberCache distribute_dofs() const override
Sequential(DoFHandler< dim, spacedim > &dof_handler)
virtual NumberCache renumber_dofs(const std::vector< types::global_dof_index > &new_numbers) const override
virtual NumberCache renumber_mg_dofs(const unsigned int level, const std::vector< types::global_dof_index > &new_numbers) const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
Task< RT > new_task(const std::function< RT()> &function)
constexpr const ReferenceCell Quadrilateral
T sum(const T &t, const MPI_Comm mpi_communicator)
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
std::vector< T > all_gather(const MPI_Comm comm, const T &object_to_send)
unsigned int this_mpi_process(const MPI_Comm mpi_communicator)
size_t pack(const T &object, std::vector< char > &dest_buffer, const bool allow_compression=true)
T unpack(const std::vector< char > &buffer, const bool allow_compression=true)
const types::fe_index invalid_fe_index
const types::subdomain_id artificial_subdomain_id
const types::subdomain_id invalid_subdomain_id
static const unsigned int invalid_unsigned_int
const types::global_dof_index invalid_dof_index
const ::parallel::distributed::Triangulation< dim, spacedim > * triangulation
types::global_dof_index n_global_dofs
IndexSet locally_owned_dofs
types::global_dof_index n_locally_owned_dofs
static void renumber_face_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< 3, spacedim > &dof_handler)
static std::map< types::global_dof_index, types::global_dof_index > compute_quad_dof_identities(const DoFHandler< dim, spacedim > &dof_handler)
static void merge_invalid_quad_dofs_on_ghost_interfaces(DoFHandler< 3, spacedim > &dof_handler)
static void renumber_face_mg_dofs(const std::vector<::types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler, const unsigned int level, const bool check_validity)
static void renumber_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, const DoFHandler< dim, space_dim > &dof_handler, const bool check_validity)
static std::map< types::global_dof_index, types::global_dof_index > compute_line_dof_identities(const DoFHandler< 1, spacedim > &dof_handler)
static void merge_invalid_line_dofs_on_ghost_interfaces(DoFHandler< dim, spacedim > &dof_handler)
static types::global_dof_index unify_dof_indices(const DoFHandler< dim, spacedim > &dof_handler, const unsigned int n_dofs_before_identification, const bool check_validity)
static void merge_invalid_dof_indices_on_ghost_interfaces(DoFHandler< dim, spacedim > &dof_handler)
static void renumber_vertex_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler, const bool check_validity)
static void merge_invalid_vertex_dofs_on_ghost_interfaces(DoFHandler< dim, spacedim > &dof_handler)
static void renumber_cell_mg_dofs(const std::vector<::types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler, const unsigned int level)
static std::map< types::global_dof_index, types::global_dof_index > compute_quad_dof_identities(const DoFHandler< 3, spacedim > &dof_handler)
static void renumber_mg_dofs(const std::vector<::types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler, const unsigned int level, const bool check_validity)
static void renumber_vertex_mg_dofs(const std::vector<::types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler, const unsigned int level)
static std::map< types::global_dof_index, types::global_dof_index > compute_vertex_dof_identities(const DoFHandler< dim, spacedim > &dof_handler)
static types::global_dof_index enumerate_dof_indices_for_renumbering(std::vector< types::global_dof_index > &new_dof_indices, const std::vector< std::map< types::global_dof_index, types::global_dof_index > > &all_constrained_indices, const types::global_dof_index start_dof_index)
static void merge_invalid_line_dofs_on_ghost_interfaces(DoFHandler< 1, spacedim > &dof_handler)
static void renumber_face_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< 2, spacedim > &dof_handler)
static void renumber_face_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler)
static void compute_dof_identities(std::vector< std::map< types::global_dof_index, types::global_dof_index > > &all_constrained_indices, const DoFHandler< dim, spacedim > &dof_handler)
static void renumber_cell_dofs(const std::vector< types::global_dof_index > &new_numbers, const IndexSet &indices_we_care_about, DoFHandler< dim, spacedim > &dof_handler)
static std::map< types::global_dof_index, types::global_dof_index > compute_line_dof_identities(const DoFHandler< dim, spacedim > &dof_handler)
static void invalidate_dof_indices_on_weaker_ghost_cells_for_renumbering(std::vector< types::global_dof_index > &renumbering, const types::subdomain_id subdomain_id, const DoFHandler< dim, spacedim > &dof_handler)
static types::global_dof_index distribute_dofs(const types::subdomain_id subdomain_id, DoFHandler< dim, spacedim > &dof_handler)
static void merge_invalid_quad_dofs_on_ghost_interfaces(DoFHandler< dim, spacedim > &dof_handler)
static void renumber_face_mg_dofs(const std::vector< types::global_dof_index > &, const IndexSet &, DoFHandler< 1, spacedim > &, const unsigned int, const bool)
static types::global_dof_index distribute_dofs_on_level(const types::subdomain_id level_subdomain_id, DoFHandler< dim, spacedim > &dof_handler, const unsigned int level)
static void renumber_face_dofs(const std::vector< types::global_dof_index > &, const IndexSet &, DoFHandler< 1, spacedim > &)
const ::Triangulation< dim, spacedim > & tria
#define DEAL_II_DOF_INDEX_MPI_TYPE