41#ifdef DEAL_II_WITH_MPI
68 for (
unsigned int i = 0; i < N; ++i)
69 for (
unsigned int j = 0;
j < N; ++
j)
82 for (
unsigned int i = 0; i < N; ++i)
88 std::vector<unsigned int> p(N);
89 for (
unsigned int i = 0; i < N; ++i)
92 for (
unsigned int j = 0;
j < N; ++
j)
96 double max = std::fabs(tmp(
j,
j));
98 for (
unsigned int i =
j + 1; i < N; ++i)
100 if (std::fabs(tmp(i,
j)) > max)
102 max = std::fabs(tmp(i,
j));
115 for (
unsigned int k = 0;
k < N; ++
k)
116 std::swap(tmp(
j,
k), tmp(r,
k));
118 std::swap(p[
j], p[r]);
122 const double hr = 1. / tmp(
j,
j);
124 for (
unsigned int k = 0;
k < N; ++
k)
128 for (
unsigned int i = 0; i < N; ++i)
132 tmp(i,
k) -= tmp(i,
j) * tmp(
j,
k) *
hr;
135 for (
unsigned int i = 0; i < N; ++i)
171 template <
int dim,
int spacedim>
183 const unsigned int face_no = 0;
190 Assert(
fe2.n_dofs_per_vertex() <=
fe1.n_dofs_per_vertex(),
219 unsigned int index = 0;
311 template <
int dim,
int spacedim>
323 const unsigned int face_no = 0;
328 std::make_unique<std::vector<bool>>(
fe1.n_dofs_per_face(
face_no));
343 template <
int dim,
int spacedim>
354 const unsigned int face_no = 0;
356 if (matrix ==
nullptr)
358 matrix = std::make_unique<FullMatrix<double>>(
369 template <
int dim,
int spacedim>
374 const unsigned int subface,
381 const unsigned int face_no = 0;
383 if (matrix ==
nullptr)
385 matrix = std::make_unique<FullMatrix<double>>(
387 fe1.get_subface_interpolation_matrix(
fe2,
433 for (
unsigned int i = 0; i < n_dofs; ++i)
464 template <
int dim,
int spacedim>
468 if (dof_handler.has_hp_capabilities() ==
true)
469 return dof_handler.get_fe_collection().
size();
486 template <
typename number1,
typename number2>
489 const std::vector<types::global_dof_index> &
primary_dofs,
578 template <
typename number>
587 template <
typename number>
591 std::integral_constant<int, 1>)
597 template <
typename number>
606 template <
typename number>
610 std::integral_constant<int, 1>)
616 template <
typename number,
int spacedim>
626 template <
typename number,
int spacedim>
631 std::integral_constant<int, 1>)
636 template <
int dim_,
int spacedim,
typename number>
641 std::integral_constant<int, 2>)
643 const unsigned int dim = 2;
657 cell = dof_handler.begin_active(),
659 for (; cell !=
endc; ++cell)
663 if (cell->is_artificial())
666 for (
const unsigned int face : cell->face_indices())
667 if (cell->face(face)->has_children())
673 Assert(cell->face(face)->n_active_fe_indices() == 1,
675 Assert(cell->face(face)->fe_index_is_active(
676 cell->active_fe_index()) ==
true,
678 for (
unsigned int c = 0; c < cell->face(face)->n_children();
680 if (!cell->neighbor_child_on_subface(face, c)
682 Assert(cell->face(face)->child(c)->n_active_fe_indices() ==
688 for (
unsigned int c = 0; c < cell->face(face)->n_children();
690 if (!cell->neighbor_child_on_subface(face, c)
692 Assert(cell->face(face)->child(c)->fe_index_is_active(
693 cell->active_fe_index()) ==
true,
701 2 * fe.n_dofs_per_vertex() +
702 fe.n_dofs_per_line(),
704 fe.n_dofs_per_vertex() +
705 2 * fe.n_dofs_per_line();
715 fe.constraints().n()));
718 fe.constraints().m()));
725 unsigned int next_index = 0;
726 for (
unsigned int vertex = 0; vertex < 2; ++vertex)
727 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex();
730 this_face->vertex_dof_index(vertex, dof, fe_index);
731 for (
unsigned int dof = 0; dof != fe.n_dofs_per_line(); ++dof)
736 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex(); ++dof)
738 this_face->child(0)->vertex_dof_index(1, dof, fe_index));
739 for (
unsigned int child = 0; child < 2; ++child)
742 if (cell->neighbor_child_on_subface(face, child)
745 for (
unsigned int dof = 0; dof != fe.n_dofs_per_line();
748 this_face->child(child)->dof_index(dof, fe_index));
762 fe.constraints()(row, i));
773 if (!cell->at_boundary(face) &&
774 !cell->neighbor(face)->is_artificial())
776 Assert(cell->face(face)->n_active_fe_indices() == 1,
778 Assert(cell->face(face)->fe_index_is_active(
779 cell->active_fe_index()) ==
true,
788 template <
int dim_,
int spacedim,
typename number>
793 std::integral_constant<int, 3>)
795 const unsigned int dim = 3;
809 cell = dof_handler.begin_active(),
811 for (; cell !=
endc; ++cell)
815 if (cell->is_artificial())
818 for (
const unsigned int face : cell->face_indices())
819 if (cell->face(face)->has_children())
824 if (cell->
get_fe().n_dofs_per_face(face) == 0)
827 Assert(cell->face(face)->refinement_case() ==
836 Assert(cell->face(face)->fe_index_is_active(
837 cell->active_fe_index()) ==
true,
839 for (
unsigned int c = 0; c < cell->face(face)->n_children();
841 if (!cell->neighbor_child_on_subface(face, c)
844 cell->face(face)->child(c)->n_active_fe_indices(), 1);
849 for (
unsigned int c = 0; c < cell->face(face)->n_children();
851 if (!cell->neighbor_child_on_subface(face, c)
854 Assert(cell->face(face)->child(c)->fe_index_is_active(
855 cell->active_fe_index()) ==
true,
857 for (
unsigned int e = 0; e < 4; ++e)
862 ->n_active_fe_indices() == 1,
867 ->fe_index_is_active(
868 cell->active_fe_index()) ==
true,
872 for (
unsigned int e = 0; e < 4; ++e)
874 Assert(cell->face(face)->line(e)->n_active_fe_indices() ==
877 Assert(cell->face(face)->line(e)->fe_index_is_active(
878 cell->active_fe_index()) ==
true,
888 (5 * fe.n_dofs_per_vertex() + 12 * fe.n_dofs_per_line() +
889 4 * fe.n_dofs_per_quad(face));
902 fe.constraints().n()));
905 fe.constraints().m()));
912 unsigned int next_index = 0;
913 for (
unsigned int vertex = 0; vertex < 4; ++vertex)
914 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex();
917 this_face->vertex_dof_index(vertex, dof, fe_index);
918 for (
unsigned int line = 0; line < 4; ++line)
919 for (
unsigned int dof = 0; dof != fe.n_dofs_per_line(); ++dof)
921 this_face->line(line)->dof_index(dof, fe_index);
922 for (
unsigned int dof = 0; dof != fe.n_dofs_per_quad(face);
932 Assert(dof_handler.get_triangulation()
933 .get_anisotropic_refinement_flag() ||
934 ((
this_face->child(0)->vertex_index(3) ==
942 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex(); ++dof)
944 this_face->child(0)->vertex_dof_index(3, dof));
947 for (
unsigned int line = 0; line < 4; ++line)
948 for (
unsigned int dof = 0; dof != fe.n_dofs_per_vertex();
951 this_face->line(line)->child(0)->vertex_dof_index(
957 for (
unsigned int dof = 0; dof < fe.n_dofs_per_line(); ++dof)
959 this_face->child(0)->line(1)->dof_index(dof, fe_index));
960 for (
unsigned int dof = 0; dof < fe.n_dofs_per_line(); ++dof)
962 this_face->child(2)->line(1)->dof_index(dof, fe_index));
963 for (
unsigned int dof = 0; dof < fe.n_dofs_per_line(); ++dof)
965 this_face->child(0)->line(3)->dof_index(dof, fe_index));
966 for (
unsigned int dof = 0; dof < fe.n_dofs_per_line(); ++dof)
968 this_face->child(1)->line(3)->dof_index(dof, fe_index));
971 for (
unsigned int line = 0; line < 4; ++line)
972 for (
unsigned int child = 0; child < 2; ++child)
974 for (
unsigned int dof = 0; dof != fe.n_dofs_per_line();
977 this_face->line(line)->child(child)->dof_index(
982 for (
unsigned int child = 0; child < 4; ++child)
985 if (cell->neighbor_child_on_subface(face, child)
988 for (
unsigned int dof = 0; dof != fe.n_dofs_per_quad(face);
991 this_face->child(child)->dof_index(dof, fe_index));
1006 fe.constraints()(row, i));
1017 if (!cell->at_boundary(face) &&
1018 !cell->neighbor(face)->is_artificial())
1020 Assert(cell->face(face)->n_active_fe_indices() == 1,
1022 Assert(cell->face(face)->fe_index_is_active(
1023 cell->active_fe_index()) ==
true,
1032 template <
int dim,
int spacedim,
typename number>
1060 subface_interpolation_matrices(
1086 for (
const auto &cell : dof_handler.active_cell_iterators())
1090 if (cell->is_artificial())
1093 for (
const unsigned int face : cell->face_indices())
1094 if (cell->face(face)->has_children())
1099 if (cell->get_fe().n_dofs_per_face(face) == 0)
1102 Assert(cell->face(face)->refinement_case() ==
1113 Assert(cell->face(face)->n_active_fe_indices() == 1,
1115 Assert(cell->face(face)->fe_index_is_active(
1116 cell->active_fe_index()) ==
true,
1118 for (
unsigned int c = 0; c < cell->face(face)->n_children();
1120 if (!cell->neighbor_child_on_subface(face, c)
1122 Assert(cell->face(face)->child(c)->n_active_fe_indices() ==
1141 if (dof_handler.has_hp_capabilities())
1142 for (
unsigned int c = 0;
1143 c < cell->face(face)->n_active_descendants();
1147 cell->neighbor_child_on_subface(face, c);
1148 if (!
subcell->is_artificial())
1152 (cell->get_fe().compare_for_domination(
1172 cell->get_fe().n_dofs_per_face(face));
1174 cell->face(face)->get_dof_indices(
1181 for (
unsigned int c = 0;
1182 c < cell->face(face)->n_children();
1185 if (cell->neighbor_child_on_subface(face, c)
1191 cell->face(face)->child(c);
1193 Assert(subface->n_active_fe_indices() == 1,
1197 subface->nth_active_fe_index(0);
1208 if (cell->get_fe().compare_for_domination(
1218 .n_dofs_per_face(face, c));
1257 subface_interpolation_matrices
1264 *(subface_interpolation_matrices
1265 [cell->active_fe_index()]
1283 Assert(dof_handler.has_hp_capabilities() ==
true,
1286 const ::hp::FECollection<dim, spacedim>
1287 &fe_collection = dof_handler.get_fe_collection();
1315 fe_collection.find_dominating_fe_extended(
1323 "Could not find a least face dominating FE."));
1331 cell->get_fe().n_dofs_per_face(face),
1338 [cell->active_fe_index()]);
1348 [cell->active_fe_index()]);
1352 [cell->active_fe_index()],
1354 [cell->active_fe_index()]),
1373 cell->get_fe().n_dofs_per_face(face) -
1383 cell->get_fe().n_dofs_per_face(face));
1384 cell->face(face)->get_dof_indices(
1390 for (
unsigned int i = 0;
1391 i < cell->get_fe().n_dofs_per_face(face);
1395 ->active_fe_index()])[i] ==
1404 cell->get_fe().n_dofs_per_face(face) -
1416 for (
unsigned int sf = 0;
1417 sf < cell->face(face)->n_children();
1422 if (cell->neighbor_child_on_subface(face, sf)
1423 ->is_artificial() ||
1424 (dim == 2 && cell->is_ghost() &&
1425 cell->neighbor_child_on_subface(face, sf)
1431 ->n_active_fe_indices() == 1,
1435 cell->face(face)->child(sf)->nth_active_fe_index(
1449 subface_interpolation_matrices
1454 subface_interpolation_matrices
1467 cell->face(face)->child(sf)->get_dof_indices(
1493 Assert(cell->face(face)->fe_index_is_active(
1494 cell->active_fe_index()) ==
true,
1501 if (!cell->at_boundary(face) &&
1502 cell->neighbor(face)->is_artificial())
1507 if ((dof_handler.has_hp_capabilities()) &&
1508 !cell->face(face)->at_boundary() &&
1509 (cell->neighbor(face)->active_fe_index() !=
1510 cell->active_fe_index()) &&
1511 (!cell->face(face)->has_children() &&
1512 !cell->neighbor_is_coarser(face)))
1515 spacedim>::level_cell_iterator
1516 neighbor = cell->neighbor(face);
1520 cell->get_fe().compare_for_domination(neighbor->get_fe(),
1528 cell->get_fe().n_dofs_per_face(face));
1529 cell->face(face)->get_dof_indices(
1539 neighbor->get_fe().n_dofs_per_face(face));
1540 cell->face(face)->get_dof_indices(
1549 [cell->active_fe_index()]
1550 [neighbor->active_fe_index()]);
1557 [cell->active_fe_index()]
1558 [neighbor->active_fe_index()]),
1601 if (cell < neighbor)
1616 cell->active_fe_index();
1618 neighbor->active_fe_index();
1619 std::set<types::fe_index>
fes;
1622 const ::hp::FECollection<dim, spacedim>
1623 &fe_collection = dof_handler.get_fe_collection();
1627 fe_collection.find_dominating_fe_extended(
1633 "Could not find the dominating FE for " +
1634 cell->get_fe().get_name() +
" and " +
1635 neighbor->get_fe().get_name() +
1636 " inside FECollection."));
1647 cell->get_fe().n_dofs_per_face(face),
1663 [cell->active_fe_index()]),
1665 [cell->active_fe_index()]);
1671 [cell->active_fe_index()]),
1690 cell->get_fe().n_dofs_per_face(face) -
1700 cell->get_fe().n_dofs_per_face(face));
1701 cell->face(face)->get_dof_indices(
1707 for (
unsigned int i = 0;
1708 i < cell->get_fe().n_dofs_per_face(face);
1711 [cell->active_fe_index()])
1722 cell->get_fe().n_dofs_per_face(face) -
1734 neighbor->get_fe().n_dofs_per_face(face),
1742 [neighbor->active_fe_index()]);
1748 [neighbor->active_fe_index()]);
1751 neighbor->get_fe().n_dofs_per_face(face),
1759 neighbor->get_fe().n_dofs_per_face(face));
1760 cell->face(face)->get_dof_indices(
1789 template <
int dim,
int spacedim,
typename number>
1794 Assert(dof_handler.has_active_dofs(),
1796 "The given DoFHandler does not have any DoFs. Did you forget to "
1797 "call dof_handler.distribute_dofs()?"));
1803 if (dof_handler.get_fe_collection().hp_constraints_are_implemented())
1807 dof_handler, constraints, std::integral_constant<int, dim>());
1839 template <
typename FaceIterator,
typename number>
1847 const bool face_orientation,
1848 const bool face_flip,
1849 const bool face_rotation,
1852 static const int dim = FaceIterator::AccessorType::dimension;
1853 static const int spacedim = FaceIterator::AccessorType::space_dimension;
1863 face_1->get_fe(
face_1->nth_active_fe_index(0)).n_unique_faces(), 1);
1865 face_2->get_fe(
face_2->nth_active_fe_index(0)).n_unique_faces(), 1);
1866 const unsigned int face_no = 0;
1871 if (
face_2->has_children())
1877 const unsigned int dofs_per_face =
1884 for (
unsigned int c = 0; c <
face_2->n_children(); ++c)
1889 const auto &fe =
face_1->get_fe(
face_1->nth_active_fe_index(0));
1890 fe.get_subface_interpolation_matrix(fe,
1918 "Matching periodic cells need to use the same finite element"));
1924 "The number of components in the mask has to be either "
1925 "zero or equal to the number of components in the finite "
1928 const unsigned int dofs_per_face = fe.n_dofs_per_face(
face_no);
1930 std::vector<types::global_dof_index>
dofs_1(dofs_per_face);
1931 std::vector<types::global_dof_index>
dofs_2(dofs_per_face);
1952 for (
unsigned int i = 0; i < dofs_per_face; ++i)
1977 for (
unsigned int i = 0; i < dofs_per_face; ++i)
1980 fe.face_to_cell_index(i,
1996 for (
unsigned int i = 0; i < dofs_per_face; ++i)
2000 fe.n_components()) &&
2001 !component_mask[fe.face_system_to_component_index(i,
face_no)
2017 bool is_identity_constrained =
false;
2021 constexpr double eps = 1.e-13;
2022 for (
unsigned int jj = 0;
jj < dofs_per_face; ++
jj)
2027 if (is_identity_constrained)
2032 is_identity_constrained =
false;
2035 is_identity_constrained =
true;
2046 if (!is_identity_constrained)
2050 if (affine_constraints.is_constrained(
dofs_2[i]))
2054 affine_constraints.add_line(
dofs_2[i]);
2056 for (
unsigned int jj = 0;
jj < dofs_per_face; ++
jj)
2060 const unsigned int j =
2062 jj, 0, face_orientation, face_flip, face_rotation)];
2065 affine_constraints.add_entry(
dofs_2[i],
2078 const unsigned int j =
2080 target, 0, face_orientation, face_flip, face_rotation)];
2088 if (affine_constraints.is_constrained(
dof_left) ||
2090 !affine_constraints.is_constrained(
dof_right)))
2101 if (affine_constraints.is_constrained(
dof_left) &&
2102 affine_constraints.is_constrained(
dof_right))
2114 if (!affine_constraints.is_constrained(
test_dof))
2120 const auto &constraint_entries =
2121 *affine_constraints.get_constraint_entries(
test_dof);
2122 if (constraint_entries.size() == 1)
2124 test_dof = constraint_entries[0].first;
2147 affine_constraints.add_line(
dof_left);
2151 affine_constraints.add_line(
dof_left);
2152 affine_constraints.add_entry(
dof_left,
2176 ExcMessage(
"The periodicity constraint is too large. "
2177 "The parameter periodicity_factor might "
2178 "be too large or too small."));
2190 template <
int dim,
int spacedim>
2200 const unsigned int face_no = 0;
2204 const unsigned int n_dofs_per_face = fe.n_dofs_per_face(
face_no);
2206 if (
matrix.m() == n_dofs_per_face)
2226 quadrature(fe.get_unit_face_support_points(
face_no));
2235 for (
unsigned int i = 0; i < n_dofs_per_face; ++i)
2237 std::vector<unsigned int>::const_iterator
comp_it =
2240 fe.face_system_to_component_index(i,
face_no).first);
2243 const unsigned int first_vector_component = *
comp_it;
2251 *
comp_it + spacedim <= fe.n_components(),
2253 "Error: the finite element does not have enough components "
2254 "to define rotated periodic boundaries."));
2256 for (
unsigned int k = 0;
k < n_dofs_per_face; ++
k)
2257 if ((
k != i) && (quadrature.point(
k) == quadrature.point(i)) &&
2258 (fe.face_system_to_component_index(
k,
face_no).first >=
2259 first_vector_component) &&
2260 (fe.face_system_to_component_index(
k,
face_no).first <
2261 first_vector_component + spacedim))
2265 first_vector_component] =
k;
2273 for (
unsigned int i = 0; i < spacedim; ++i)
2276 for (
unsigned int j = 0;
j < spacedim; ++
j)
2290 template <
typename FaceIterator,
typename number>
2297 const bool face_orientation,
2298 const bool face_flip,
2299 const bool face_rotation,
2304 static const int dim = FaceIterator::AccessorType::dimension;
2305 static const int spacedim = FaceIterator::AccessorType::space_dimension;
2307 Assert((dim != 1) || (face_orientation ==
true && face_flip ==
false &&
2308 face_rotation ==
false),
2310 "(face_orientation, face_flip, face_rotation) "
2311 "is invalid for 1d"));
2313 Assert((dim != 2) || (face_orientation ==
true && face_rotation ==
false),
2315 "(face_orientation, face_flip, face_rotation) "
2316 "is invalid for 2d"));
2319 ExcMessage(
"face_1 and face_2 are equal! Cannot constrain DoFs "
2320 "on the very same face"));
2323 ExcMessage(
"Faces for periodicity constraints must be on the "
2326 Assert(matrix.m() == matrix.n(),
2327 ExcMessage(
"The supplied (rotation or interpolation) matrix must "
2328 "be a square matrix"));
2331 ExcMessage(
"first_vector_components is nonempty, so matrix must "
2332 "be a rotation matrix exactly of size spacedim"));
2335 if (!
face_1->has_children())
2340 face_1->get_fe(
face_1->nth_active_fe_index(0)).n_unique_faces(), 1);
2341 const unsigned int face_no = 0;
2344 const unsigned int n_dofs_per_face =
2348 Assert(matrix.m() == 0 ||
2350 matrix.m() == n_dofs_per_face) ||
2353 "The matrix must have either size 0 or spacedim "
2354 "(if first_vector_components is nonempty) "
2355 "or the size must be equal to the # of DoFs on the face "
2356 "(if first_vector_components is empty)."));
2359 if (!
face_2->has_children())
2364 face_2->get_fe(
face_2->nth_active_fe_index(0)).n_unique_faces(), 1);
2365 const unsigned int face_no = 0;
2368 const unsigned int n_dofs_per_face =
2372 Assert(matrix.m() == 0 ||
2374 matrix.m() == n_dofs_per_face) ||
2377 "The matrix must have either size 0 or spacedim "
2378 "(if first_vector_components is nonempty) "
2379 "or the size must be equal to the # of DoFs on the face "
2380 "(if first_vector_components is empty)."));
2472 const unsigned int face_no = 0;
2474 const unsigned int n_dofs_per_face = fe.n_dofs_per_face(
face_no);
2478 if (n_dofs_per_face == 0)
2484 if (!
face_2->has_children())
2533 face_rotation ^ face_flip :
2543 template <
int dim,
int spacedim,
typename number>
2571 pair.orientation[0],
2572 pair.orientation[1],
2573 pair.orientation[2],
2584 template <
int dim,
int spacedim,
typename number>
2589 const unsigned int direction,
2597 ExcMessage(
"The boundary indicators b_id1 and b_id2 must be "
2598 "different to denote different boundaries."));
2611 std::vector<unsigned int>(),
2617 template <
int dim,
int spacedim,
typename number>
2621 const unsigned int direction,
2643 std::vector<unsigned int>(),
2657 template <
int dim,
int spacedim>
2662#ifdef DEAL_II_WITH_MPI
2663 std::vector<::LinearAlgebra::distributed::Vector<double>>
2678 template <
int dim,
int spacedim>
2771 template <
int dim,
int spacedim>
2774 const Assembler::CopyData<dim, spacedim> & copy_data,
2779 std::vector<std::map<types::global_dof_index, float>> &weights)
2781 unsigned int pos = 0;
2809 i < copy_data.global_parameter_representation[
pos].
size();
2815 if (copy_data.global_parameter_representation[
pos](i) != 0)
2818 wi = copy_data.parameter_dof_indices[
local_dof],
2821 copy_data.global_parameter_representation[
pos](i);
2829 Assert(copy_data.global_parameter_representation[
pos](i) ==
2845 template <
int dim,
int spacedim>
2853 std::vector<std::map<types::global_dof_index, float>> &weights)
2855 Assembler::Scratch scratch;
2856 Assembler::CopyData<dim, spacedim> copy_data;
2860 local_dof < coarse_grid.get_fe().n_dofs_per_cell();
2862 if (coarse_grid.get_fe().system_to_component_index(
local_dof).first ==
2869 for (std::size_t i = 0;
2870 i < copy_data.global_parameter_representation.
size();
2873#ifdef DEAL_II_WITH_MPI
2877 const typename ::parallel::TriangulationBase<dim,
2879 &
tria =
dynamic_cast<const typename ::parallel::
2880 TriangulationBase<dim, spacedim> &
>(
2882 .get_triangulation());
2883 communicator =
tria.get_communicator();
2886 catch (std::bad_cast &)
2897 copy_data.global_parameter_representation[i].reinit(
2899 .locally_owned_dofs(),
2904 copy_data.global_parameter_representation[i].reinit(
n_fine_dofs);
2915 const Assembler::Scratch & scratch_data,
2916 Assembler::CopyData<dim, spacedim> ©_data) {
2921 coarse_grid.get_fe(),
2931 &weights](
const Assembler::CopyData<dim, spacedim> ©_data) {
2934 coarse_grid.get_fe(),
2947#ifdef DEAL_II_WITH_MPI
2948 for (std::size_t i = 0;
2949 i < copy_data.global_parameter_representation.
size();
2951 copy_data.global_parameter_representation[i].update_ghost_values();
2962 template <
int dim,
int spacedim>
2970 std::vector<std::map<types::global_dof_index, float>> &weights,
2995 Assert(coarse_grid.get_triangulation().n_cells(0) ==
2996 fine_grid.get_triangulation().n_cells(0),
3020 for (
const auto &cell : coarse_grid.active_cell_iterators())
3072 std::vector<types::global_dof_index> local_dof_indices(
3075 for (
const auto &cell :
fine_grid.active_cell_iterators() |
3078 cell->get_dof_indices(local_dof_indices);
3079 for (
unsigned int i = 0; i <
fine_fe.n_dofs_per_cell(); ++i)
3080 if (
fine_fe.system_to_component_index(i).first ==
3099 std::vector<types::global_dof_index> local_dof_indices(
3102 for (
const auto &cell :
fine_grid.active_cell_iterators() |
3105 cell->get_dof_indices(local_dof_indices);
3106 for (
unsigned int i = 0; i <
fine_fe.n_dofs_per_cell(); ++i)
3109 if ((
fine_fe.system_to_component_index(i).first ==
3157 if (weights[row].find(col) != weights[row].
end())
3158 sum += weights[row][col];
3159 Assert((std::fabs(sum - 1) < 1.e-12) ||
3160 ((
coarse_fe.n_components() > 1) && (sum == 0)),
3175 template <
int dim,
int spacedim>
3185 Assert(coarse_grid.get_fe_collection().
size() == 1 &&
3187 ExcMessage(
"This function is not yet implemented for DoFHandlers "
3188 "using hp-capabilities."));
3209 std::vector<std::map<types::global_dof_index, float>> weights;
3218 internal::compute_intergrid_weights_1(coarse_grid,
3236 std::vector<bool> mask(coarse_grid.get_fe(0).n_components(),
false);
3264 std::map<types::global_dof_index, float>::const_iterator i =
3299 std::vector<std::pair<types::global_dof_index, double>>
constraint_line;
3318 std::map<types::global_dof_index, float>::const_iterator
col_entry =
3346 const std::map<types::global_dof_index, float>::const_iterator
j =
3347 weights[row].find(col);
3348 if ((
j != weights[row].end()) && (
j->second != 0))
3358 template <
int dim,
int spacedim>
3366 std::vector<std::map<types::global_dof_index, float>>
3369 Assert(coarse_grid.get_fe_collection().
size() == 1 &&
3371 ExcMessage(
"This function is not yet implemented for DoFHandlers "
3372 "using hp-capabilities."));
3393 std::vector<std::map<types::global_dof_index, float>> weights;
3401 internal::compute_intergrid_weights_1(coarse_grid,
3414 return dof != numbers::invalid_dof_index;
3444 std::map<types::global_dof_index, float>::const_iterator
j =
3446 for (;
j != weights[i].
end(); ++
j)
3458 template <
int dim,
int spacedim,
typename number>
3467 ExcMessage(
"The number of components in the mask has to be either "
3468 "zero or equal to the number of components in the finite "
3471 const unsigned int n_components = dof.get_fe_collection().n_components();
3477 std::vector<types::global_dof_index>
face_dofs;
3478 face_dofs.reserve(dof.get_fe_collection().max_dofs_per_face());
3480 std::vector<types::global_dof_index>
cell_dofs;
3481 cell_dofs.reserve(dof.get_fe_collection().max_dofs_per_cell());
3484 cell = dof.begin_active(),
3486 for (; cell !=
endc; ++cell)
3487 if (!cell->is_artificial() && cell->at_boundary())
3495 for (
const auto face_no : cell->face_indices())
3502 if (face->at_boundary() &&
3504 (face->boundary_id() == boundary_id)))
3508 face->get_dof_indices(
face_dofs, cell->active_fe_index());
3516 const std::vector<types::global_dof_index>::iterator
3527 for (
unsigned int c = 0; c < n_components; ++c)
3544 template <
int dim,
int spacedim,
typename number>
3564#include "dof_tools_constraints.inst"
void reinit(value_type *starting_element, const std::size_t n_elements)
bool represents_n_components(const unsigned int n) 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
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInvalidIterator()
static ::ExceptionBase & ExcGridNotCoarser()
static ::ExceptionBase & ExcNotImplemented()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcFiniteElementsDontMatch()
static ::ExceptionBase & ExcNoComponentSelected()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcGridsDontMatch()
static ::ExceptionBase & ExcMessage(std::string arg1)
#define AssertThrow(cond, exc)
typename ActiveSelector::cell_iterator cell_iterator
typename ActiveSelector::line_iterator line_iterator
typename ActiveSelector::face_iterator face_iterator
typename ActiveSelector::active_cell_iterator active_cell_iterator
void compute_intergrid_transfer_representation(const DoFHandler< dim, spacedim > &coarse_grid, const unsigned int coarse_component, const DoFHandler< dim, spacedim > &fine_grid, const unsigned int fine_component, const InterGridMap< DoFHandler< dim, spacedim > > &coarse_to_fine_grid_map, std::vector< std::map< types::global_dof_index, float > > &transfer_representation)
void make_zero_boundary_constraints(const DoFHandler< dim, spacedim > &dof, const types::boundary_id boundary_id, AffineConstraints< number > &zero_boundary_constraints, const ComponentMask &component_mask=ComponentMask())
void make_hanging_node_constraints(const DoFHandler< dim, spacedim > &dof_handler, AffineConstraints< number > &constraints)
void compute_intergrid_constraints(const DoFHandler< dim, spacedim > &coarse_grid, const unsigned int coarse_component, const DoFHandler< dim, spacedim > &fine_grid, const unsigned int fine_component, const InterGridMap< DoFHandler< dim, spacedim > > &coarse_to_fine_grid_map, AffineConstraints< double > &constraints)
@ either_element_can_dominate
@ other_element_dominates
@ neither_element_dominates
@ matrix
Contents is actually a matrix.
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
VectorType::value_type * end(VectorType &V)
T sum(const T &t, const MPI_Comm mpi_communicator)
void run(const std::vector< std::vector< Iterator > > &colored_iterators, Worker worker, Copier copier, const ScratchData &sample_scratch_data, const CopyData &sample_copy_data, const unsigned int queue_length=2 *MultithreadInfo::n_threads(), const unsigned int chunk_size=8)
const types::boundary_id invalid_boundary_id
const types::fe_index invalid_fe_index
static const unsigned int invalid_unsigned_int
const types::global_dof_index invalid_dof_index
typename type_identity< T >::type type_identity_t
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)
const ::Triangulation< dim, spacedim > & tria