72 template <
int dim,
typename Number =
double>
86 for (
unsigned int d = 0; d < dim; ++d)
97 for (
unsigned int d = 0; d < dim; ++d)
121 template <
int dim,
int spacedim>
122 std::vector<unsigned char>
127 fe.n_dofs_per_cell(),
static_cast<unsigned char>(-1));
133 for (
unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
134 if (fe.is_primitive(i))
136 fe.system_to_component_index(i).first;
147 fe.get_nonzero_components(i).first_selected_component();
149 if ((fe.get_nonzero_components(i) & component_mask)
150 .n_selected_components(fe.n_components()) == 0)
158 for (
unsigned int c =
first_comp; c < fe.n_components(); ++c)
159 if (component_mask[c] ==
true)
168 static_cast<unsigned char>(-1)) ==
192 template <
int dim,
int spacedim>
198 const ::hp::FECollection<dim, spacedim> &fe_collection =
199 dof.get_fe_collection();
203 dof.n_locally_owned_dofs()));
213 fe_collection.size());
214 for (
unsigned int f = 0; f < fe_collection.size(); ++f)
222 std::vector<types::global_dof_index> indices;
227 const unsigned int dofs_per_cell = c->get_fe().n_dofs_per_cell();
228 indices.resize(dofs_per_cell);
229 c->get_dof_indices(indices);
230 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
231 if (dof.locally_owned_dofs().is_element(indices[i]))
245 template <
int dim,
int spacedim>
250 const ::hp::FECollection<dim, spacedim> &fe_collection =
251 dof.get_fe_collection();
255 dof.n_locally_owned_dofs()));
265 fe_collection.size());
266 for (
unsigned int f = 0; f < fe_collection.size(); ++f)
270 static_cast<unsigned char>(-1));
271 for (
unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
276 static_cast<unsigned char>(-1)) ==
282 std::vector<types::global_dof_index> indices;
283 for (
const auto &cell : dof.active_cell_iterators())
284 if (cell->is_locally_owned())
287 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
288 indices.resize(dofs_per_cell);
289 cell->get_dof_indices(indices);
290 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
291 if (dof.locally_owned_dofs().is_element(indices[i]))
300 template <
int dim,
int spacedim,
typename Number>
305 const unsigned int component)
312 const auto &fe_collection = dof_handler.get_fe_collection();
314 for (
unsigned int i = 0; i < fe_collection.size(); ++i)
316 Assert(fe_collection[i].is_primitive() ==
true,
324 (dof_handler.get_fe_collection().n_components() != 1);
332 dof_handler.n_locally_owned_dofs());
338 for (
unsigned int i = 0; i < dof_data.
size(); ++i)
344 std::vector<unsigned char>
touch_count(dof_handler.n_dofs(), 0);
346 std::vector<types::global_dof_index> dof_indices;
347 dof_indices.reserve(fe_collection.max_dofs_per_cell());
349 for (
const auto &cell : dof_handler.active_cell_iterators())
351 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
352 dof_indices.resize(dofs_per_cell);
353 cell->get_dof_indices(dof_indices);
355 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
359 (cell->get_fe().system_to_component_index(i).first == component))
362 dof_data(dof_indices[i]) += cell_data(cell->active_cell_index());
384 template <
int dim,
int spacedim>
390 dof.get_fe_collection().n_components()),
392 "The given component mask is not sized correctly to represent the "
393 "components of the given finite element."));
398 dof.get_fe_collection().n_components()) == 0)
401 dof.get_fe_collection().n_components()) ==
402 dof.get_fe_collection().n_components())
403 return dof.locally_owned_dofs();
415 selected_dofs.push_back(dof.locally_owned_dofs().nth_index_in_set(i));
425 template <
int dim,
int spacedim>
432 dof, dof.get_fe_collection().component_mask(block_mask));
437 template <
int dim,
int spacedim>
438 std::vector<IndexSet>
442 const auto n_comps = dof.get_fe_collection().n_components();
445 "The given component mask is not sized correctly to represent the "
446 "components of the given finite element."));
448 const auto &locally_owned_dofs = dof.locally_owned_dofs();
460 if (component_mask[
comp_i])
462 locally_owned_dofs.nth_index_in_set(i));
471 template <
int dim,
int spacedim>
481 dof.get_fe_collection().n_components()),
483 "The given component mask is not sized correctly to represent the "
484 "components of the given finite element."));
491 dof.get_fe_collection().n_components()) == 0)
497 dof.get_fe_collection().n_components()) ==
498 dof.get_fe_collection().n_components())
512 for (
unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
516 std::vector<types::global_dof_index> indices(fe.n_dofs_per_cell());
517 for (
const auto &cell : dof.cell_iterators_on_level(
level))
519 cell->get_mg_dof_indices(indices);
520 for (
unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
527 template <
int dim,
int spacedim>
537 dof.get_fe().component_mask(block_mask),
543 template <
int dim,
int spacedim>
548 const std::set<types::boundary_id> &boundary_ids)
552 &dof_handler.get_triangulation()) ==
nullptr),
554 "This function can not be used with distributed triangulations. "
555 "See the documentation for more information."));
570 template <
int dim,
int spacedim>
575 const std::set<types::boundary_id> &boundary_ids)
584 template <
int dim,
int spacedim>
588 const std::set<types::boundary_id> &boundary_ids)
591 dof_handler.get_fe_collection().n_components()),
592 ExcMessage(
"Component mask has invalid size."));
608 dof_handler.get_fe_collection().n_components()) !=
609 dof_handler.get_fe_collection().n_components()));
613 dof_handler.get_fe_collection().max_dofs_per_face());
621 for (
const auto &cell : dof_handler.active_cell_iterators())
624 if (cell->is_artificial() ==
false)
625 for (
const unsigned int face : cell->face_indices())
626 if (cell->at_boundary(face))
628 (boundary_ids.find(cell->face(face)->boundary_id()) !=
633 const auto reference_cell = cell->reference_cell();
636 reference_cell.n_vertices();
639 reference_cell.face_reference_cell(face).n_vertices();
641 reference_cell.face_reference_cell(face).n_lines();
643 const unsigned int dofs_per_face = fe.n_dofs_per_face(face);
646 cell->active_fe_index());
648 for (
unsigned int i = 0; i < fe.n_dofs_per_face(face); ++i)
662 (i < 2 * fe.n_dofs_per_vertex() ?
664 i + 2 * fe.n_dofs_per_vertex()) :
666 fe.n_dofs_per_vertex() ?
669 fe.n_dofs_per_vertex() +
671 fe.n_dofs_per_line() ?
673 fe.n_dofs_per_vertex()) +
675 fe.n_dofs_per_vertex() :
678 fe.n_dofs_per_vertex() -
680 fe.n_dofs_per_line()) +
682 fe.n_dofs_per_vertex() +
684 fe.n_dofs_per_line())) :
688 if (component_mask[fe.face_system_to_component_index(
697 .first_selected_component();
712 template <
int dim,
int spacedim>
718 const std::set<types::boundary_id> &boundary_ids)
721 dof_handler.get_fe_collection().n_components()),
722 ExcMessage(
"This component mask has the wrong size."));
741 dof_handler.get_fe_collection().max_dofs_per_cell());
749 for (
const auto &cell : dof_handler.active_cell_iterators())
750 for (
const unsigned int face : cell->face_indices())
751 if (cell->at_boundary(face))
753 (boundary_ids.find(cell->face(face)->boundary_id()) !=
758 const unsigned int dofs_per_cell = fe.n_dofs_per_cell();
762 for (
unsigned int i = 0; i < fe.n_dofs_per_cell(); ++i)
763 if (fe.has_support_on_face(i, face))
772 if (fe.is_primitive(i))
774 (component_mask[fe.system_to_component_index(i)
779 fe.get_nonzero_components(i)
780 .first_selected_component();
794 template <
int dim,
int spacedim,
typename number>
803 const std::function<
bool(
808 ->
bool {
return cell->is_locally_owned() && predicate(cell); };
810 std::vector<types::global_dof_index> local_dof_indices;
811 local_dof_indices.reserve(
812 dof_handler.get_fe_collection().max_dofs_per_cell());
817 for (
const auto &cell : dof_handler.active_cell_iterators())
818 if (!cell->is_artificial() && predicate(cell))
820 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
821 cell->get_dof_indices(local_dof_indices);
823 local_dof_indices.end());
829 const std::vector<typename DoFHandler<dim, spacedim>::active_cell_iterator>
833 active_cell_iterator>::const_iterator
it =
847 const unsigned int dofs_per_cell = (*it)->get_fe().n_dofs_per_cell();
848 local_dof_indices.resize(dofs_per_cell);
849 (*it)->get_dof_indices(local_dof_indices);
851 local_dof_indices.end());
857 if (
cm.n_constraints() > 0)
868 if (
const auto *
line_ptr =
cm.get_constraint_entries(dof))
902 template <
int spacedim>
907 return IndexSet(dof_handler.n_dofs());
911 template <
int spacedim>
915 const unsigned int dim = 2;
923 for (
const auto &cell : dof_handler.active_cell_iterators())
924 if (!cell->is_artificial())
926 for (
const unsigned int face : cell->face_indices())
927 if (cell->face(face)->has_children())
930 line = cell->face(face);
932 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex();
935 line->child(0)->vertex_dof_index(1, dof));
937 for (
unsigned int child = 0; child < 2; ++child)
939 if (cell->neighbor_child_on_subface(face, child)
942 for (
unsigned int dof = 0; dof != fe.n_dofs_per_line();
945 line->child(child)->dof_index(dof));
955 template <
int spacedim>
959 const unsigned int dim = 3;
966 for (
const auto &cell : dof_handler.active_cell_iterators())
967 if (!cell->is_artificial())
968 for (
auto f : cell->face_indices())
972 if (cell->face(f)->has_children())
974 for (
unsigned int child = 0; child < 4; ++child)
975 if (!cell->neighbor_child_on_subface(f, child)
979 std::vector<types::global_dof_index>
ldi(
980 fe.n_dofs_per_face(f, child));
981 face->child(child)->get_dof_indices(
ldi);
987 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
988 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex();
991 face->vertex_dof_index(vertex, dof));
1002 template <
int dim,
int spacedim>
1006 return internal::extract_hanging_node_dofs(dof_handler);
1011 template <
int dim,
int spacedim>
1023 std::vector<types::global_dof_index> local_dof_indices;
1024 local_dof_indices.reserve(
1025 dof_handler.get_fe_collection().max_dofs_per_cell());
1029 for (
const auto &cell : dof_handler.active_cell_iterators())
1030 if (cell->subdomain_id() == subdomain_id)
1032 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
1033 local_dof_indices.resize(dofs_per_cell);
1034 cell->get_dof_indices(local_dof_indices);
1035 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1042 template <
int dim,
int spacedim>
1052 std::vector<types::global_dof_index> dof_indices;
1055 for (
const auto &cell : dof_handler.active_cell_iterators() |
1058 dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1059 cell->get_dof_indices(dof_indices);
1062 if (!
dof_set.is_element(dof_index))
1075 template <
int dim,
int spacedim>
1085 template <
int dim,
int spacedim>
1089 const unsigned int level)
1097 std::vector<types::global_dof_index> dof_indices;
1105 dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1106 cell->get_mg_dof_indices(dof_indices);
1109 if (!
dof_set.is_element(dof_index))
1122 template <
int dim,
int spacedim>
1127 const unsigned int level)
1134 template <
int dim,
int spacedim>
1149 std::vector<types::global_dof_index> dof_indices;
1152 for (
const auto &cell : dof_handler.active_cell_iterators())
1153 if (cell->is_ghost())
1155 dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1156 cell->get_dof_indices(dof_indices);
1157 for (
const auto dof_index : dof_indices)
1158 if (!
dof_set.is_element(dof_index))
1174 template <
int dim,
int spacedim>
1184 template <
int dim,
int spacedim>
1188 const unsigned int level)
1201 std::vector<types::global_dof_index> dof_indices;
1204 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
1209 if (
id == dof_handler.get_triangulation().locally_owned_subdomain() ||
1213 dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1214 cell->get_mg_dof_indices(dof_indices);
1215 for (
const auto dof_index : dof_indices)
1216 if (!
dof_set.is_element(dof_index))
1233 template <
int dim,
int spacedim>
1237 const unsigned int level,
1245 template <
int dim,
int spacedim>
1249 std::vector<std::vector<bool>> & constant_modes)
1253 if (dof_handler.n_locally_owned_dofs() == 0)
1255 constant_modes = std::vector<std::vector<bool>>(0);
1259 const unsigned int n_components = dof_handler.get_fe(0).n_components();
1264 dof_handler.n_locally_owned_dofs());
1269 for (
unsigned int i = 0; i < n_components; ++i)
1270 if (component_mask[i] ==
true)
1275 const IndexSet &locally_owned_dofs = dof_handler.locally_owned_dofs();
1278 for (
unsigned int i = 0,
count = 0; i < locally_owned_dofs.
n_elements();
1288 const ::hp::FECollection<dim, spacedim> &fe_collection =
1289 dof_handler.get_fe_collection();
1291 std::vector<std::vector<std::pair<unsigned int, unsigned int>>>
1296 for (
unsigned int f = 0; f < fe_collection.size(); ++f)
1298 std::pair<Table<2, bool>, std::vector<unsigned int>> data =
1299 fe_collection[f].get_constant_modes();
1309 for (
unsigned int i = 0; i < data.second.
size(); ++i)
1310 if (component_mask[data.second[i]])
1329 constant_modes.clear();
1335 std::vector<types::global_dof_index> dof_indices;
1336 for (
const auto &cell : dof_handler.active_cell_iterators() |
1339 dof_indices.resize(cell->get_fe().n_dofs_per_cell());
1340 cell->get_dof_indices(dof_indices);
1342 for (
unsigned int i = 0; i < dof_indices.
size(); ++i)
1343 if (locally_owned_dofs.
is_element(dof_indices[i]))
1348 if (component_mask[
comp])
1349 for (
auto &indices :
1351 constant_modes[indices
1361 template <
int dim,
int spacedim>
1364 std::vector<unsigned int> & active_fe_indices)
1367 dof_handler.get_triangulation().n_active_cells());
1369 std::vector<types::fe_index> indices = dof_handler.get_active_fe_indices();
1371 active_fe_indices.assign(indices.begin(), indices.end());
1374 template <
int dim,
int spacedim>
1375 std::vector<IndexSet>
1378 Assert(dof_handler.n_dofs() > 0,
1379 ExcMessage(
"The given DoFHandler has no DoFs."));
1385 &dof_handler.get_triangulation()) ==
nullptr),
1387 "For parallel::distributed::Triangulation objects and "
1388 "associated DoF handler objects, asking for any information "
1389 "related to a subdomain other than the locally owned one does "
1390 "not make sense."));
1395 dof_handler.n_dofs());
1411 const unsigned int n_subdomains =
1413 &dof_handler.get_triangulation()) ==
nullptr ?
1416 for (
const auto &cell : dof_handler.active_cell_iterators())
1423 &dof_handler.get_triangulation())
1430 n_subdomains,
::IndexSet(dof_handler.n_dofs()));
1463 for (
unsigned int i = 0; i < n_subdomains; ++i)
1469 template <
int dim,
int spacedim>
1470 std::vector<IndexSet>
1478 &dof_handler.get_triangulation()) ==
nullptr),
1480 "For parallel::distributed::Triangulation objects and "
1481 "associated DoF handler objects, asking for any information "
1482 "related to a subdomain other than the locally owned one does "
1483 "not make sense."));
1491 std::vector<IndexSet>
dof_set =
1493 const ::types::subdomain_id n_subdomains =
dof_set.
size();
1499 subdomain_id < n_subdomains;
1512 std::vector<types::global_dof_index> local_dof_indices;
1514 for (
typename std::vector<
1523 cell->subdomain_id() != subdomain_id,
1525 "The subdomain ID of the halo cell should not match that of the vector entry."));
1527 local_dof_indices.resize(cell->
get_fe().n_dofs_per_cell());
1528 cell->get_dof_indices(local_dof_indices);
1535 dof_set[subdomain_id].add_indices(
1539 dof_set[subdomain_id].compress();
1545 template <
int dim,
int spacedim>
1555 &dof_handler.get_triangulation()) ==
nullptr),
1557 "For parallel::distributed::Triangulation objects and "
1558 "associated DoF handler objects, asking for any subdomain other "
1559 "than the locally owned one does not make sense."));
1563 dof_handler.n_dofs()));
1576 dof_handler.get_triangulation().n_active_cells());
1579 &dof_handler.get_triangulation())))
1583 tr->n_active_cells(),
1588 for (
const auto &cell : dof_handler.active_cell_iterators() |
1590 cell_owners[cell->active_cell_index()] = cell->subdomain_id();
1595 dof_handler.n_dofs(),
1598 std::vector<types::global_dof_index> local_dof_indices;
1599 local_dof_indices.reserve(
1600 dof_handler.get_fe_collection().max_dofs_per_cell());
1604 for (
const auto &cell : dof_handler.active_cell_iterators())
1608 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
1609 local_dof_indices.resize(dofs_per_cell);
1610 cell->get_dof_indices(local_dof_indices);
1616 for (
unsigned int i = 0; i < dofs_per_cell; ++i)
1635 template <
int dim,
int spacedim>
1642 dof_handler.n_dofs());
1652 template <
int dim,
int spacedim>
1660 Assert((dof_handler.get_triangulation().locally_owned_subdomain() ==
1663 dof_handler.get_triangulation().locally_owned_subdomain()),
1665 "For parallel::distributed::Triangulation objects and "
1666 "associated DoF handler objects, asking for any subdomain other "
1667 "than the locally owned one does not make sense."));
1669 IndexSet index_set(dof_handler.n_dofs());
1671 std::vector<types::global_dof_index> local_dof_indices;
1672 local_dof_indices.reserve(
1673 dof_handler.get_fe_collection().max_dofs_per_cell());
1682 for (
const auto &cell : dof_handler.active_cell_iterators())
1683 if ((cell->is_artificial() ==
false) &&
1686 const unsigned int dofs_per_cell = cell->get_fe().n_dofs_per_cell();
1687 local_dof_indices.resize(dofs_per_cell);
1688 cell->get_dof_indices(local_dof_indices);
1690 local_dof_indices.begin(),
1691 local_dof_indices.end());
1708 template <
int dim,
int spacedim>
1717 dof_handler.get_fe(0).n_components()));
1722 dof_handler.begin_active(),
1727 return cell.subdomain_id() == subdomain;
1729 ExcMessage(
"There are no cells for the given subdomain!"));
1732 dof_handler.n_dofs());
1737 std::vector<bool>(),
1740 for (
unsigned int c = 0; c < dof_handler.get_fe(0).n_components(); ++c)
1757 template <
int dim,
int spacedim>
1761 const std::vector<unsigned int> & target_component,
1763 std::vector<types::global_dof_index> &dofs_per_component,
1764 unsigned int & component)
1766 for (
unsigned int b = 0; b < fe.n_base_elements(); ++b)
1770 unsigned int d = base.n_components();
1772 for (
unsigned int m = 0; m < fe.element_multiplicity(b); ++m)
1774 if (base.n_base_elements() > 1)
1783 for (
unsigned int dd = 0;
dd < d; ++
dd, ++component)
1784 dofs_per_component[target_component[component]] +=
1793 for (
unsigned int dd = 1;
dd < d; ++
dd)
1794 dofs_per_component[target_component[component - d +
dd]] =
1795 dofs_per_component[target_component[component - d]];
1802 template <
int dim,
int spacedim>
1806 const std::vector<unsigned int> & target_component,
1808 std::vector<types::global_dof_index> &dofs_per_component,
1809 unsigned int & component)
1814 for (
unsigned int fe = 1; fe < fe_collection.
size(); ++fe)
1816 Assert(fe_collection[fe].n_components() ==
1817 fe_collection[0].n_components(),
1819 Assert(fe_collection[fe].n_base_elements() ==
1820 fe_collection[0].n_base_elements(),
1822 for (
unsigned int b = 0; b < fe_collection[0].n_base_elements(); ++b)
1824 Assert(fe_collection[fe].base_element(b).n_components() ==
1825 fe_collection[0].base_element(b).n_components(),
1827 Assert(fe_collection[fe].base_element(b).n_base_elements() ==
1828 fe_collection[0].base_element(b).n_base_elements(),
1851 template <
int dim,
int spacedim>
1855 return fe.is_primitive();
1863 template <
int dim,
int spacedim>
1866 const ::hp::FECollection<dim, spacedim> &fe_collection)
1868 for (
unsigned int i = 0; i < fe_collection.size(); ++i)
1869 if (fe_collection[i].is_primitive() ==
false)
1879 template <
int dim,
int spacedim>
1880 std::vector<types::global_dof_index>
1886 const unsigned int n_components = dof_handler.get_fe(0).n_components();
1891 if (target_component.size() == 0)
1893 target_component.resize(n_components);
1894 for (
unsigned int i = 0; i < n_components; ++i)
1895 target_component[i] = i;
1898 Assert(target_component.size() == n_components,
1903 *std::max_element(target_component.begin(), target_component.end());
1906 std::vector<types::global_dof_index> dofs_per_component(
1911 if (n_components == 1)
1913 dofs_per_component[0] = dof_handler.n_locally_owned_dofs();
1914 return dofs_per_component;
1921 dof_handler.n_locally_owned_dofs());
1927 unsigned int component = 0;
1938 Assert((internal::all_elements_are_primitive(
1939 dof_handler.get_fe_collection()) ==
false) ||
1940 (std::accumulate(dofs_per_component.begin(),
1941 dofs_per_component.end(),
1943 dof_handler.n_locally_owned_dofs()),
1947#ifdef DEAL_II_WITH_MPI
1951 &dof_handler.get_triangulation())))
1957 dofs_per_component.data(),
1961 tria->get_communicator());
1966 return dofs_per_component;
1971 template <
int dim,
int spacedim>
1972 std::vector<types::global_dof_index>
1976 const ::hp::FECollection<dim, spacedim> &fe_collection =
1977 dof_handler.get_fe_collection();
1985 const unsigned int n_blocks = fe_collection[0].n_blocks();
1991 for (
unsigned int i = 0; i < n_blocks; ++i)
1997 for (
unsigned int f = 1; f < fe_collection.size(); ++f)
1998 Assert(fe_collection[0].n_blocks() == fe_collection[f].n_blocks(),
1999 ExcMessage(
"This function can only work if all elements in a "
2000 "collection have the same number of blocks."));
2020 for (
unsigned int this_fe = fe_collection.
size() - 1;
2027 dof_handler.n_locally_owned_dofs());
2031 for (
unsigned int block = 0; block < fe.n_blocks(); ++block)
2035#ifdef DEAL_II_WITH_MPI
2040 &dof_handler.get_triangulation())))
2049 tria->get_communicator());
2060 template <
int dim,
int spacedim>
2063 std::vector<types::global_dof_index> &mapping)
2066 mapping.insert(mapping.end(),
2067 dof_handler.n_dofs(),
2071 dofs_on_face.reserve(dof_handler.get_fe_collection().max_dofs_per_face());
2080 for (
const auto &cell : dof_handler.active_cell_iterators())
2081 for (
const unsigned int f : cell->face_indices())
2082 if (cell->at_boundary(f))
2084 const unsigned int dofs_per_face =
2085 cell->get_fe().n_dofs_per_face(f);
2088 cell->active_fe_index());
2089 for (
unsigned int i = 0; i < dofs_per_face; ++i)
2099 template <
int dim,
int spacedim>
2102 const std::set<types::boundary_id> &boundary_ids,
2103 std::vector<types::global_dof_index> &mapping)
2110 mapping.insert(mapping.end(),
2111 dof_handler.n_dofs(),
2115 if (boundary_ids.size() == 0)
2119 dofs_on_face.reserve(dof_handler.get_fe_collection().max_dofs_per_face());
2122 for (
const auto &cell : dof_handler.active_cell_iterators())
2123 for (
const unsigned int f : cell->face_indices())
2124 if (boundary_ids.find(cell->face(f)->boundary_id()) !=
2127 const unsigned int dofs_per_face =
2128 cell->get_fe().n_dofs_per_face(f);
2131 cell->active_fe_index());
2132 for (
unsigned int i = 0; i < dofs_per_face; ++i)
2138 dof_handler.n_boundary_dofs(boundary_ids));
2145 template <
int dim,
int spacedim>
2146 std::map<types::global_dof_index, Point<spacedim>>
2152 std::map<types::global_dof_index, Point<spacedim>>
support_points;
2155 dof_handler.get_fe_collection();
2158 for (
unsigned int fe_index = 0; fe_index < fe_collection.
size();
2162 Assert((fe_collection[fe_index].n_dofs_per_cell() == 0) ||
2163 (fe_collection[fe_index].has_support_points()),
2166 fe_collection[fe_index].get_unit_support_points()));
2187 std::vector<types::global_dof_index> local_dof_indices;
2188 for (
const auto &cell : dof_handler.active_cell_iterators())
2190 if (cell->is_artificial() ==
false)
2192 hp_fe_values.
reinit(cell);
2194 hp_fe_values.get_present_fe_values();
2196 local_dof_indices.resize(cell->get_fe().n_dofs_per_cell());
2197 cell->get_dof_indices(local_dof_indices);
2199 const std::vector<Point<spacedim>> &points =
2200 fe_values.get_quadrature_points();
2201 for (
unsigned int i = 0; i < cell->get_fe().n_dofs_per_cell();
2205 cell->get_fe().system_to_component_index(i).first;
2217 template <
int dim,
int spacedim>
2218 std::vector<Point<spacedim>>
2224 std::vector<Point<spacedim>>
support_points(dof_handler.n_dofs());
2227 const std::map<types::global_dof_index, Point<spacedim>>
2247 template <
int dim,
int spacedim>
2257 &dof_handler.get_triangulation()) ==
nullptr),
2259 "This function can not be used with distributed triangulations. "
2260 "See the documentation for more information."));
2267 internal::map_dofs_to_support_points_vector(mapping_collection,
2273 template <
int dim,
int spacedim>
2284 &dof_handler.get_triangulation()) ==
nullptr),
2286 "This function can not be used with distributed triangulations. "
2287 "See the documentation for more information."));
2292 internal::map_dofs_to_support_points_vector(mapping, dof_handler, mask);
2297 template <
int dim,
int spacedim>
2311 support_points = internal::map_dofs_to_support_points(mapping_collection,
2318 template <
int dim,
int spacedim>
2331 internal::map_dofs_to_support_points(mapping, dof_handler, mask);
2335 template <
int dim,
int spacedim>
2336 std::map<types::global_dof_index, Point<spacedim>>
2345 return internal::map_dofs_to_support_points(mapping_collection,
2351 template <
int dim,
int spacedim>
2352 std::map<types::global_dof_index, Point<spacedim>>
2358 return internal::map_dofs_to_support_points(mapping, dof_handler, mask);
2362 template <
int spacedim>
2370 std::map<Point<spacedim>,
2371 std::vector<types::global_dof_index>,
2378 std::vector<types::global_dof_index> &v =
point_map[
it.second];
2379 v.push_back(
it.first);
2385 out <<
it.first <<
" \"";
2386 const std::vector<types::global_dof_index> &v =
it.second;
2387 for (
unsigned int i = 0; i < v.size(); ++i)
2401 template <
int dim,
int spacedim>
2407 if (dof_handler.has_hp_capabilities() ==
false)
2410 const unsigned int nb = fe.n_blocks();
2416 for (
unsigned int i = 0; i < fe.n_components(); ++i)
2418 const unsigned int ib = fe.component_to_block_index(i);
2419 for (
unsigned int j = 0;
j < fe.n_components(); ++
j)
2421 const unsigned int jb = fe.component_to_block_index(
j);
2429 dof_handler.get_fe_collection();
2432 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
2436 const unsigned int nb = fe.n_blocks();
2439 for (
unsigned int i = 0; i < fe.n_components(); ++i)
2441 const unsigned int ib = fe.component_to_block_index(i);
2442 for (
unsigned int j = 0;
j < fe.n_components(); ++
j)
2444 const unsigned int jb = fe.component_to_block_index(
j);
2454 template <
int dim,
int spacedim>
2458 const unsigned int level,
2462 std::vector<types::global_dof_index> indices;
2466 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2467 if (cell->is_locally_owned_on_level())
2470 dof_handler.n_dofs(),
2471 dof_handler.get_fe().n_dofs_per_cell());
2473 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2474 if (cell->is_locally_owned_on_level())
2476 indices.resize(cell->get_fe().n_dofs_per_cell());
2477 cell->get_mg_dof_indices(indices);
2485 block_list.
add(i, indices[
j] - offset);
2489 block_list.
add(i, indices[
j] - offset);
2497 template <
int dim,
int spacedim>
2501 const unsigned int level,
2505 block_list.
reinit(1, dof_handler.n_dofs(
level), dof_handler.n_dofs(
level));
2507 std::vector<types::global_dof_index> indices;
2510 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2512 indices.resize(cell->get_fe().n_dofs_per_cell());
2513 cell->get_mg_dof_indices(indices);
2518 exclude.resize(fe.n_dofs_per_cell());
2521 for (
const unsigned int face : cell->face_indices())
2522 if (cell->at_boundary(face) ||
2523 cell->neighbor(face)->level() != cell->level())
2524 for (
unsigned int i = 0; i < fe.n_dofs_per_face(face); ++i)
2525 exclude[fe.face_to_cell_index(i, face)] =
true;
2528 block_list.
add(0, indices[
j]);
2532 for (
const auto index : indices)
2533 block_list.
add(0, index);
2539 template <
int dim,
int spacedim>
2543 const unsigned int level,
2550 std::vector<types::global_dof_index> indices;
2553 unsigned int block = 0;
2554 for (
const auto &
pcell : dof_handler.cell_iterators_on_level(
level - 1))
2556 if (
pcell->is_active())
2559 for (
unsigned int child = 0; child <
pcell->n_children(); ++child)
2561 const auto cell =
pcell->child(child);
2565 const unsigned int n_dofs = fe.n_dofs_per_cell();
2566 indices.resize(n_dofs);
2569 cell->get_mg_dof_indices(indices);
2575 for (
unsigned int d = 0; d < dim; ++d)
2577 const unsigned int face =
2579 for (
unsigned int i = 0; i < fe.n_dofs_per_face(face); ++i)
2580 exclude[fe.face_to_cell_index(i, face)] =
true;
2586 for (
const unsigned int face :
2588 if (cell->at_boundary(face))
2589 for (
unsigned int i = 0; i < fe.n_dofs_per_face(face);
2591 exclude[fe.face_to_cell_index(i, face)] =
false;
2594 for (
unsigned int i = 0; i < n_dofs; ++i)
2596 block_list.
add(block, indices[i]);
2602 template <
int dim,
int spacedim>
2603 std::vector<unsigned int>
2606 const unsigned int level,
2613 const unsigned int n_blocks = dof_handler.get_fe().n_blocks();
2625 template <
int dim,
int spacedim>
2626 std::vector<unsigned int>
2629 const unsigned int level,
2639 dof_handler.get_triangulation().n_vertices(), 0);
2643 dof_handler.get_triangulation().n_vertices(),
false);
2646 dof_handler.get_triangulation().n_vertices(),
2651 dof_handler.get_triangulation().n_vertices(), 0);
2655 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2656 for (
const unsigned int v : cell->vertex_indices())
2658 const unsigned int vg = cell->vertex_index(v);
2661 for (
unsigned int d = 0; d < dim; ++d)
2664 if (cell->at_boundary(face))
2667 (cell->neighbor(face)->level() !=
2668 static_cast<int>(
level)))
2698 dof_handler.n_dofs(
level),
2701 std::vector<types::global_dof_index> indices;
2704 for (
const auto &cell : dof_handler.cell_iterators_on_level(
level))
2707 indices.resize(fe.n_dofs_per_cell());
2708 cell->get_mg_dof_indices(indices);
2710 for (
const unsigned int v : cell->vertex_indices())
2712 const unsigned int vg = cell->vertex_index(v);
2724 exclude.resize(fe.n_dofs_per_cell());
2727 for (
unsigned int d = 0; d < dim; ++d)
2729 const unsigned int a_face =
2731 const unsigned int face =
2733 for (
unsigned int i = 0; i < fe.n_dofs_per_face(face); ++i)
2738 fe.face_to_cell_index(
2741 exclude[fe.face_to_cell_index(i, face)] =
true;
2744 for (
unsigned int j = 0;
j < indices.
size(); ++
j)
2746 block_list.
add(block, indices[
j]);
2750 for (
const auto index : indices)
2751 block_list.
add(block, index);
2772 template <
int dim,
int spacedim>
2779 std::vector<types::global_dof_index> local_dof_indices;
2784 for (
unsigned int i = 0; i <
patch.
size(); ++i)
2788 Assert(cell->is_artificial() ==
false,
2789 ExcMessage(
"This function can not be called with cells that are "
2790 "not either locally owned or ghost cells."));
2791 local_dof_indices.resize(cell->
get_fe().n_dofs_per_cell());
2792 cell->get_dof_indices(local_dof_indices);
2794 local_dof_indices.end());
2803 template <
int dim,
int spacedim>
2804 std::vector<types::global_dof_index>
2810 std::vector<types::global_dof_index> local_dof_indices;
2815 for (
unsigned int i = 0; i <
patch.
size(); ++i)
2819 Assert(cell->is_artificial() ==
false,
2820 ExcMessage(
"This function can not be called with cells that are "
2821 "not either locally owned or ghost cells."));
2822 local_dof_indices.resize(cell->
get_fe().n_dofs_per_cell());
2823 cell->get_dof_indices(local_dof_indices);
2825 local_dof_indices.end());
2846#include "dof_tools.inst"
value_type * data() const noexcept
void reinit(value_type *starting_element, const std::size_t n_elements)
bool represents_n_components(const unsigned int n) const
bool represents_the_all_selected_mask() const
unsigned int size() const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
size_type index_within_set(const size_type global_index) const
size_type n_elements() const
bool is_element(const size_type index) const
void fill_binary_vector(VectorType &vector) const
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
void reinit(const size_type m, const size_type n, const ArrayView< const unsigned int > &row_lengths)
void add(const size_type i, const size_type j)
unsigned int size() const
unsigned int n_components() const
virtual MPI_Comm get_communicator() const override
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
IteratorRange< FilteredIterator< BaseIterator > > filter_iterators(IteratorRange< BaseIterator > i, const Predicate &p)
static ::ExceptionBase & ExcIO()
static ::ExceptionBase & ExcInvalidBoundaryIndicator()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertThrowMPI(error_code)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcIndexRange(std::size_t arg1, std::size_t arg2, std::size_t arg3)
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::line_iterator line_iterator
typename ActiveSelector::face_iterator face_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
typename ActiveSelector::CellAccessor cell_accessor
@ update_quadrature_points
Transformed quadrature points.
unsigned int n_mpi_processes(const MPI_Comm mpi_communicator)
const types::boundary_id internal_face_boundary_id
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
::VectorizedArray< Number, width > max(const ::VectorizedArray< Number, width > &, const ::VectorizedArray< Number, width > &)
static std_cxx20::ranges::iota_view< unsigned int, unsigned int > face_indices()
const ::Triangulation< dim, spacedim > & tria
#define DEAL_II_DOF_INDEX_MPI_TYPE