61 typename SparsityPatternType,
65 SparsityPatternType & sparsity,
67 const bool keep_constrained_dofs,
73 Assert(sparsity.n_rows() == n_dofs,
75 Assert(sparsity.n_cols() == n_dofs,
87 "For parallel::distributed::Triangulation objects and "
88 "associated DoF handler objects, asking for any subdomain other "
89 "than the locally owned one does not make sense."));
91 std::vector<types::global_dof_index> dofs_on_this_cell;
100 for (; cell != endc; ++cell)
103 cell->is_locally_owned())
106 dofs_on_this_cell.resize(dofs_per_cell);
107 cell->get_dof_indices(dofs_on_this_cell);
114 keep_constrained_dofs);
122 typename SparsityPatternType,
127 SparsityPatternType & sparsity,
129 const bool keep_constrained_dofs,
135 Assert(sparsity.n_rows() == n_dofs,
137 Assert(sparsity.n_cols() == n_dofs,
155 "For parallel::distributed::Triangulation objects and "
156 "associated DoF handler objects, asking for any subdomain other "
157 "than the locally owned one does not make sense."));
162 const std::vector<Table<2, Coupling>> dof_mask
167 std::vector<Table<2, bool>> bool_dof_mask(fe_collection.
size());
168 for (
unsigned int f = 0; f < fe_collection.
size(); ++f)
170 bool_dof_mask[f].reinit(
172 fe_collection[f].n_dofs_per_cell()));
173 bool_dof_mask[f].fill(
false);
174 for (
unsigned int i = 0; i < fe_collection[f].n_dofs_per_cell(); ++i)
175 for (
unsigned int j = 0; j < fe_collection[f].n_dofs_per_cell(); ++j)
176 if (dof_mask[f](i, j) !=
none)
177 bool_dof_mask[f](i, j) =
true;
180 std::vector<types::global_dof_index> dofs_on_this_cell(
189 for (; cell != endc; ++cell)
192 cell->is_locally_owned())
194 const unsigned int fe_index = cell->active_fe_index();
195 const unsigned int dofs_per_cell =
196 fe_collection[fe_index].n_dofs_per_cell();
198 dofs_on_this_cell.resize(dofs_per_cell);
199 cell->get_dof_indices(dofs_on_this_cell);
207 keep_constrained_dofs,
208 bool_dof_mask[fe_index]);
214 template <
int dim,
int spacedim,
typename SparsityPatternType>
218 SparsityPatternType & sparsity)
225 Assert(sparsity.n_rows() == n_dofs_row,
227 Assert(sparsity.n_cols() == n_dofs_col,
241 ExcMessage(
"This function can only be used with with parallel "
242 "Triangulations when the Triangulations are equal."));
248 std::list<std::pair<cell_iterator, cell_iterator>> cell_list =
251#ifdef DEAL_II_WITH_MPI
262 Assert(this_subdomain_id ==
269 [=](
const std::pair<cell_iterator, cell_iterator> &pair) {
270 return pair.first->subdomain_id() != this_subdomain_id ||
271 pair.second->subdomain_id() != this_subdomain_id;
277 for (
const auto &cell_pair : cell_list)
279 const cell_iterator cell_row = cell_pair.first;
280 const cell_iterator cell_col = cell_pair.second;
282 if (cell_row->is_active() && cell_col->is_active())
284 const unsigned int dofs_per_cell_row =
285 cell_row->get_fe().n_dofs_per_cell();
286 const unsigned int dofs_per_cell_col =
287 cell_col->get_fe().n_dofs_per_cell();
288 std::vector<types::global_dof_index> local_dof_indices_row(
290 std::vector<types::global_dof_index> local_dof_indices_col(
292 cell_row->get_dof_indices(local_dof_indices_row);
293 cell_col->get_dof_indices(local_dof_indices_col);
294 for (
unsigned int i = 0; i < dofs_per_cell_row; ++i)
295 sparsity.add_entries(local_dof_indices_row[i],
296 local_dof_indices_col.begin(),
297 local_dof_indices_col.end());
299 else if (cell_row->has_children())
304 GridTools::get_active_child_cells<DoFHandler<dim, spacedim>>(
306 for (
unsigned int i = 0; i < child_cells.size(); i++)
309 cell_row_child = child_cells[i];
310 const unsigned int dofs_per_cell_row =
312 const unsigned int dofs_per_cell_col =
313 cell_col->get_fe().n_dofs_per_cell();
314 std::vector<types::global_dof_index> local_dof_indices_row(
316 std::vector<types::global_dof_index> local_dof_indices_col(
318 cell_row_child->get_dof_indices(local_dof_indices_row);
319 cell_col->get_dof_indices(local_dof_indices_col);
320 for (
unsigned int r = 0; r < dofs_per_cell_row; ++r)
321 sparsity.add_entries(local_dof_indices_row[r],
322 local_dof_indices_col.begin(),
323 local_dof_indices_col.end());
331 GridTools::get_active_child_cells<DoFHandler<dim, spacedim>>(
333 for (
unsigned int i = 0; i < child_cells.size(); i++)
336 cell_col_child = child_cells[i];
337 const unsigned int dofs_per_cell_row =
339 const unsigned int dofs_per_cell_col =
341 std::vector<types::global_dof_index> local_dof_indices_row(
343 std::vector<types::global_dof_index> local_dof_indices_col(
345 cell_row->get_dof_indices(local_dof_indices_row);
346 cell_col_child->get_dof_indices(local_dof_indices_col);
347 for (
unsigned int r = 0; r < dofs_per_cell_row; ++r)
348 sparsity.add_entries(local_dof_indices_row[r],
349 local_dof_indices_col.begin(),
350 local_dof_indices_col.end());
358 template <
int dim,
int spacedim,
typename SparsityPatternType>
362 const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
363 SparsityPatternType & sparsity)
369 std::map<types::boundary_id, const Function<spacedim, double> *>
371 boundary_ids[0] =
nullptr;
372 boundary_ids[1] =
nullptr;
373 make_boundary_sparsity_pattern<dim, spacedim, SparsityPatternType>(
374 dof, boundary_ids, dof_to_boundary_mapping, sparsity);
385 if (sparsity.n_rows() != 0)
395 std::vector<types::global_dof_index> dofs_on_this_face;
406 for (; cell != endc; ++cell)
407 for (
const unsigned int f : cell->face_indices())
408 if (cell->at_boundary(f))
410 const unsigned int dofs_per_face =
412 dofs_on_this_face.resize(dofs_per_face);
413 cell->face(f)->get_dof_indices(dofs_on_this_face,
414 cell->active_fe_index());
417 for (
unsigned int i = 0; i < dofs_per_face; ++i)
418 for (
unsigned int j = 0; j < dofs_per_face; ++j)
419 sparsity.add(dof_to_boundary_mapping[dofs_on_this_face[i]],
420 dof_to_boundary_mapping[dofs_on_this_face[j]]);
428 typename SparsityPatternType,
435 const std::vector<types::global_dof_index> &dof_to_boundary_mapping,
436 SparsityPatternType & sparsity)
441 for (
unsigned int direction = 0; direction < 2; ++direction)
444 if (boundary_ids.find(direction) == boundary_ids.end())
451 while (!cell->at_boundary(direction))
452 cell = cell->neighbor(direction);
453 while (!cell->is_active())
454 cell = cell->child(direction);
456 const unsigned int dofs_per_vertex =
458 std::vector<types::global_dof_index> boundary_dof_boundary_indices(
462 for (
unsigned int i = 0; i < dofs_per_vertex; ++i)
463 boundary_dof_boundary_indices[i] =
464 dof_to_boundary_mapping[cell->vertex_dof_index(direction, i)];
466 for (
unsigned int i = 0; i < dofs_per_vertex; ++i)
467 sparsity.add_entries(boundary_dof_boundary_indices[i],
468 boundary_dof_boundary_indices.begin(),
469 boundary_dof_boundary_indices.end());
488 if (sparsity.n_rows() != 0)
498 std::vector<types::global_dof_index> dofs_on_this_face;
503 for (; cell != endc; ++cell)
504 for (
const unsigned int f : cell->face_indices())
505 if (boundary_ids.find(cell->face(f)->boundary_id()) !=
508 const unsigned int dofs_per_face =
510 dofs_on_this_face.resize(dofs_per_face);
511 cell->face(f)->get_dof_indices(dofs_on_this_face,
512 cell->active_fe_index());
515 for (
unsigned int i = 0; i < dofs_per_face; ++i)
516 for (
unsigned int j = 0; j < dofs_per_face; ++j)
517 sparsity.add(dof_to_boundary_mapping[dofs_on_this_face[i]],
518 dof_to_boundary_mapping[dofs_on_this_face[j]]);
526 typename SparsityPatternType,
530 SparsityPatternType & sparsity,
532 const bool keep_constrained_dofs,
553 "For parallel::distributed::Triangulation objects and "
554 "associated DoF handler objects, asking for any subdomain other "
555 "than the locally owned one does not make sense."));
557 std::vector<types::global_dof_index> dofs_on_this_cell;
558 std::vector<types::global_dof_index> dofs_on_other_cell;
573 for (; cell != endc; ++cell)
576 cell->is_locally_owned())
578 const unsigned int n_dofs_on_this_cell =
580 dofs_on_this_cell.resize(n_dofs_on_this_cell);
581 cell->get_dof_indices(dofs_on_this_cell);
588 keep_constrained_dofs);
590 for (
const unsigned int face : cell->face_indices())
594 const bool periodic_neighbor = cell->has_periodic_neighbor(face);
595 if (!cell->at_boundary(face) || periodic_neighbor)
598 neighbor = cell->neighbor_or_periodic_neighbor(face);
605 while (neighbor->has_children())
606 neighbor = neighbor->child(face == 0 ? 1 : 0);
608 if (neighbor->has_children())
610 for (
unsigned int sub_nr = 0;
611 sub_nr != cell_face->n_active_descendants();
615 level_cell_iterator sub_neighbor =
617 cell->periodic_neighbor_child_on_subface(
619 cell->neighbor_child_on_subface(face, sub_nr);
621 const unsigned int n_dofs_on_neighbor =
623 dofs_on_other_cell.resize(n_dofs_on_neighbor);
624 sub_neighbor->get_dof_indices(dofs_on_other_cell);
630 keep_constrained_dofs);
635 keep_constrained_dofs);
639 if (sub_neighbor->subdomain_id() !=
640 cell->subdomain_id())
644 keep_constrained_dofs);
651 if ((!periodic_neighbor &&
652 cell->neighbor_is_coarser(face)) ||
653 (periodic_neighbor &&
654 cell->periodic_neighbor_is_coarser(face)))
655 if (neighbor->subdomain_id() == cell->subdomain_id())
658 const unsigned int n_dofs_on_neighbor =
660 dofs_on_other_cell.resize(n_dofs_on_neighbor);
662 neighbor->get_dof_indices(dofs_on_other_cell);
668 keep_constrained_dofs);
674 if (!cell->neighbor_or_periodic_neighbor(face)
676 (neighbor->subdomain_id() != cell->subdomain_id()))
682 keep_constrained_dofs);
683 if (neighbor->subdomain_id() != cell->subdomain_id())
687 keep_constrained_dofs);
697 template <
int dim,
int spacedim,
typename SparsityPatternType>
700 SparsityPatternType & sparsity)
706 template <
int dim,
int spacedim>
723 for (
unsigned int i = 0; i < n_dofs; ++i)
725 const unsigned int ii =
731 for (
unsigned int j = 0; j < n_dofs; ++j)
733 const unsigned int jj =
739 dof_couplings(i, j) = component_couplings(ii, jj);
742 return dof_couplings;
747 template <
int dim,
int spacedim>
748 std::vector<Table<2, Coupling>>
753 std::vector<Table<2, Coupling>> return_value(fe.
size());
754 for (
unsigned int i = 0; i < fe.
size(); ++i)
771 typename SparsityPatternType,
776 SparsityPatternType & sparsity,
778 const bool keep_constrained_dofs,
784 const unsigned int)> &face_has_flux_coupling)
790 std::vector<types::global_dof_index> dofs_on_this_cell(
792 std::vector<types::global_dof_index> dofs_on_other_cell(
811 bool_int_dof_mask.fill(
false);
814 if (int_dof_mask(i, j) != none)
815 bool_int_dof_mask(i, j) =
true;
820 for (; cell != endc; ++cell)
823 cell->is_locally_owned())
825 cell->get_dof_indices(dofs_on_this_cell);
829 keep_constrained_dofs,
832 for (
const unsigned int face_n : cell->face_indices())
835 cell_face = cell->face(face_n);
837 const bool periodic_neighbor =
838 cell->has_periodic_neighbor(face_n);
840 if (cell->at_boundary(face_n) && (!periodic_neighbor))
845 const bool i_non_zero_i =
846 support_on_face(i, face_n);
850 const bool j_non_zero_i =
851 support_on_face(j, face_n);
853 if (flux_dof_mask(i, j) ==
always ||
854 (flux_dof_mask(i, j) ==
nonzero &&
855 i_non_zero_i && j_non_zero_i))
856 sparsity.add(dofs_on_this_cell[i],
857 dofs_on_this_cell[j]);
863 if (!face_has_flux_coupling(cell, face_n))
867 spacedim>::level_cell_iterator
869 cell->neighbor_or_periodic_neighbor(face_n);
874 if (neighbor->level() == cell->level() &&
875 neighbor->index() > cell->index() &&
876 neighbor->is_active() &&
877 neighbor->is_locally_owned())
891 if (neighbor->level() != cell->level() &&
892 ((!periodic_neighbor &&
893 !cell->neighbor_is_coarser(face_n)) ||
894 (periodic_neighbor &&
895 !cell->periodic_neighbor_is_coarser(face_n))) &&
896 neighbor->is_locally_owned())
899 const unsigned int neighbor_face_n =
901 cell->periodic_neighbor_face_no(face_n) :
902 cell->neighbor_face_no(face_n);
912 while (neighbor->has_children())
913 neighbor = neighbor->child(face_n == 0 ? 1 : 0);
915 if (neighbor->has_children())
917 for (
unsigned int sub_nr = 0;
918 sub_nr != cell_face->n_children();
922 level_cell_iterator sub_neighbor =
925 ->periodic_neighbor_child_on_subface(
927 cell->neighbor_child_on_subface(face_n,
930 sub_neighbor->get_dof_indices(
932 for (
unsigned int i = 0;
936 const bool i_non_zero_i =
937 support_on_face(i, face_n);
938 const bool i_non_zero_e =
939 support_on_face(i, neighbor_face_n);
940 for (
unsigned int j = 0;
944 const bool j_non_zero_i =
945 support_on_face(j, face_n);
946 const bool j_non_zero_e =
947 support_on_face(j, neighbor_face_n);
949 if (flux_dof_mask(i, j) ==
always)
952 dofs_on_this_cell[i],
953 dofs_on_other_cell[j]);
955 dofs_on_other_cell[i],
956 dofs_on_this_cell[j]);
958 dofs_on_this_cell[i],
959 dofs_on_this_cell[j]);
961 dofs_on_other_cell[i],
962 dofs_on_other_cell[j]);
964 else if (flux_dof_mask(i, j) ==
967 if (i_non_zero_i && j_non_zero_e)
969 dofs_on_this_cell[i],
970 dofs_on_other_cell[j]);
971 if (i_non_zero_e && j_non_zero_i)
973 dofs_on_other_cell[i],
974 dofs_on_this_cell[j]);
975 if (i_non_zero_i && j_non_zero_i)
977 dofs_on_this_cell[i],
978 dofs_on_this_cell[j]);
979 if (i_non_zero_e && j_non_zero_e)
981 dofs_on_other_cell[i],
982 dofs_on_other_cell[j]);
985 if (flux_dof_mask(j, i) ==
always)
988 dofs_on_this_cell[j],
989 dofs_on_other_cell[i]);
991 dofs_on_other_cell[j],
992 dofs_on_this_cell[i]);
994 dofs_on_this_cell[j],
995 dofs_on_this_cell[i]);
997 dofs_on_other_cell[j],
998 dofs_on_other_cell[i]);
1000 else if (flux_dof_mask(j, i) ==
1003 if (j_non_zero_i && i_non_zero_e)
1005 dofs_on_this_cell[j],
1006 dofs_on_other_cell[i]);
1007 if (j_non_zero_e && i_non_zero_i)
1009 dofs_on_other_cell[j],
1010 dofs_on_this_cell[i]);
1011 if (j_non_zero_i && i_non_zero_i)
1013 dofs_on_this_cell[j],
1014 dofs_on_this_cell[i]);
1015 if (j_non_zero_e && i_non_zero_e)
1017 dofs_on_other_cell[j],
1018 dofs_on_other_cell[i]);
1026 neighbor->get_dof_indices(dofs_on_other_cell);
1030 const bool i_non_zero_i =
1031 support_on_face(i, face_n);
1032 const bool i_non_zero_e =
1033 support_on_face(i, neighbor_face_n);
1034 for (
unsigned int j = 0;
1038 const bool j_non_zero_i =
1039 support_on_face(j, face_n);
1040 const bool j_non_zero_e =
1041 support_on_face(j, neighbor_face_n);
1042 if (flux_dof_mask(i, j) ==
always)
1044 sparsity.add(dofs_on_this_cell[i],
1045 dofs_on_other_cell[j]);
1046 sparsity.add(dofs_on_other_cell[i],
1047 dofs_on_this_cell[j]);
1048 sparsity.add(dofs_on_this_cell[i],
1049 dofs_on_this_cell[j]);
1050 sparsity.add(dofs_on_other_cell[i],
1051 dofs_on_other_cell[j]);
1053 if (flux_dof_mask(i, j) ==
nonzero)
1055 if (i_non_zero_i && j_non_zero_e)
1056 sparsity.add(dofs_on_this_cell[i],
1057 dofs_on_other_cell[j]);
1058 if (i_non_zero_e && j_non_zero_i)
1059 sparsity.add(dofs_on_other_cell[i],
1060 dofs_on_this_cell[j]);
1061 if (i_non_zero_i && j_non_zero_i)
1062 sparsity.add(dofs_on_this_cell[i],
1063 dofs_on_this_cell[j]);
1064 if (i_non_zero_e && j_non_zero_e)
1065 sparsity.add(dofs_on_other_cell[i],
1066 dofs_on_other_cell[j]);
1069 if (flux_dof_mask(j, i) ==
always)
1071 sparsity.add(dofs_on_this_cell[j],
1072 dofs_on_other_cell[i]);
1073 sparsity.add(dofs_on_other_cell[j],
1074 dofs_on_this_cell[i]);
1075 sparsity.add(dofs_on_this_cell[j],
1076 dofs_on_this_cell[i]);
1077 sparsity.add(dofs_on_other_cell[j],
1078 dofs_on_other_cell[i]);
1080 if (flux_dof_mask(j, i) ==
nonzero)
1082 if (j_non_zero_i && i_non_zero_e)
1083 sparsity.add(dofs_on_this_cell[j],
1084 dofs_on_other_cell[i]);
1085 if (j_non_zero_e && i_non_zero_i)
1086 sparsity.add(dofs_on_other_cell[j],
1087 dofs_on_this_cell[i]);
1088 if (j_non_zero_i && i_non_zero_i)
1089 sparsity.add(dofs_on_this_cell[j],
1090 dofs_on_this_cell[i]);
1091 if (j_non_zero_e && i_non_zero_e)
1092 sparsity.add(dofs_on_other_cell[j],
1093 dofs_on_other_cell[i]);
1111 const ::hp::FECollection<dim, spacedim> &fe =
1114 std::vector<types::global_dof_index> dofs_on_this_cell(
1116 std::vector<types::global_dof_index> dofs_on_other_cell(
1119 const unsigned int n_components = fe.n_components();
1129 for (
unsigned int c1 = 0; c1 < n_components; ++c1)
1130 for (
unsigned int c2 = 0; c2 < n_components; ++c2)
1131 if (int_mask(c1, c2) != none || flux_mask(c1, c2) != none)
1132 int_and_flux_mask(c1, c2) =
always;
1134 std::vector<Table<2, Coupling>> int_and_flux_dof_mask =
1139 std::vector<Table<2, bool>> bool_int_and_flux_dof_mask(fe.size());
1140 for (
unsigned int f = 0; f < fe.size(); ++f)
1142 bool_int_and_flux_dof_mask[f].reinit(
1144 fe[f].n_dofs_per_cell()));
1145 bool_int_and_flux_dof_mask[f].fill(
false);
1146 for (
unsigned int i = 0; i < fe[f].n_dofs_per_cell(); ++i)
1147 for (
unsigned int j = 0; j < fe[f].n_dofs_per_cell(); ++j)
1148 if (int_and_flux_dof_mask[f](i, j) != none)
1149 bool_int_and_flux_dof_mask[f](i, j) =
true;
1153 typename ::DoFHandler<dim, spacedim>::active_cell_iterator
1156 for (; cell != endc; ++cell)
1159 cell->is_locally_owned())
1161 dofs_on_this_cell.resize(cell->get_fe().n_dofs_per_cell());
1162 cell->get_dof_indices(dofs_on_this_cell);
1170 keep_constrained_dofs,
1171 bool_int_and_flux_dof_mask[cell->active_fe_index()]);
1174 for (
const unsigned int face : cell->face_indices())
1176 const typename ::DoFHandler<dim,
1177 spacedim>::face_iterator
1178 cell_face = cell->face(face);
1180 const bool periodic_neighbor =
1181 cell->has_periodic_neighbor(face);
1183 if ((!cell->at_boundary(face)) || periodic_neighbor)
1185 typename ::DoFHandler<dim, spacedim>::
1186 level_cell_iterator neighbor =
1187 cell->neighbor_or_periodic_neighbor(face);
1189 if (!face_has_flux_coupling(cell, face))
1196 if (neighbor->level() == cell->level() &&
1197 neighbor->index() > cell->index() &&
1198 neighbor->is_active() &&
1199 neighbor->is_locally_owned())
1213 if (neighbor->level() != cell->level() &&
1214 ((!periodic_neighbor &&
1215 !cell->neighbor_is_coarser(face)) ||
1216 (periodic_neighbor &&
1217 !cell->periodic_neighbor_is_coarser(face))) &&
1218 neighbor->is_locally_owned())
1228 while (neighbor->has_children())
1229 neighbor = neighbor->child(face == 0 ? 1 : 0);
1231 if (neighbor->has_children())
1233 for (
unsigned int sub_nr = 0;
1234 sub_nr != cell_face->n_children();
1237 const typename ::DoFHandler<dim,
1239 level_cell_iterator sub_neighbor =
1242 ->periodic_neighbor_child_on_subface(
1244 cell->neighbor_child_on_subface(face,
1247 dofs_on_other_cell.resize(
1248 sub_neighbor->get_fe().n_dofs_per_cell());
1249 sub_neighbor->get_dof_indices(
1250 dofs_on_other_cell);
1251 for (
unsigned int i = 0;
1252 i < cell->get_fe().n_dofs_per_cell();
1255 const unsigned int ii =
1256 (cell->get_fe().is_primitive(i) ?
1258 .system_to_component_index(i)
1261 .get_nonzero_components(i)
1262 .first_selected_component());
1264 Assert(ii < cell->get_fe().n_components(),
1267 for (
unsigned int j = 0;
1268 j < sub_neighbor->get_fe()
1272 const unsigned int jj =
1273 (sub_neighbor->get_fe()
1275 sub_neighbor->get_fe()
1276 .system_to_component_index(j)
1278 sub_neighbor->get_fe()
1279 .get_nonzero_components(j)
1280 .first_selected_component());
1282 Assert(jj < sub_neighbor->get_fe()
1286 if ((flux_mask(ii, jj) ==
always) ||
1287 (flux_mask(ii, jj) ==
nonzero))
1290 dofs_on_this_cell[i],
1291 dofs_on_other_cell[j]);
1294 if ((flux_mask(jj, ii) ==
always) ||
1295 (flux_mask(jj, ii) ==
nonzero))
1298 dofs_on_other_cell[j],
1299 dofs_on_this_cell[i]);
1307 dofs_on_other_cell.resize(
1308 neighbor->get_fe().n_dofs_per_cell());
1309 neighbor->get_dof_indices(dofs_on_other_cell);
1310 for (
unsigned int i = 0;
1311 i < cell->get_fe().n_dofs_per_cell();
1314 const unsigned int ii =
1315 (cell->get_fe().is_primitive(i) ?
1317 .system_to_component_index(i)
1320 .get_nonzero_components(i)
1321 .first_selected_component());
1323 Assert(ii < cell->get_fe().n_components(),
1326 for (
unsigned int j = 0;
1327 j < neighbor->get_fe().n_dofs_per_cell();
1330 const unsigned int jj =
1331 (neighbor->get_fe().is_primitive(j) ?
1333 .system_to_component_index(j)
1336 .get_nonzero_components(j)
1337 .first_selected_component());
1340 jj < neighbor->get_fe().n_components(),
1343 if ((flux_mask(ii, jj) ==
always) ||
1344 (flux_mask(ii, jj) ==
nonzero))
1346 sparsity.add(dofs_on_this_cell[i],
1347 dofs_on_other_cell[j]);
1350 if ((flux_mask(jj, ii) ==
always) ||
1351 (flux_mask(jj, ii) ==
nonzero))
1353 sparsity.add(dofs_on_other_cell[j],
1354 dofs_on_this_cell[i]);
1370 template <
int dim,
int spacedim,
typename SparsityPatternType>
1373 SparsityPatternType & sparsity,
1380 const bool keep_constrained_dofs =
true;
1385 keep_constrained_dofs,
1389 internal::always_couple_on_faces<dim, spacedim>);
1396 typename SparsityPatternType,
1401 SparsityPatternType & sparsity,
1403 const bool keep_constrained_dofs,
1407 const std::function<
1409 const unsigned int)> &face_has_flux_coupling)
1418 Assert(sparsity.n_rows() == n_dofs,
1420 Assert(sparsity.n_cols() == n_dofs,
1422 Assert(int_mask.n_rows() == n_comp,
1424 Assert(int_mask.n_cols() == n_comp,
1426 Assert(flux_mask.n_rows() == n_comp,
1428 Assert(flux_mask.n_cols() == n_comp,
1440 "For parallel::distributed::Triangulation objects and "
1441 "associated DoF handler objects, asking for any subdomain other "
1442 "than the locally owned one does not make sense."));
1445 face_has_flux_coupling,
1447 "The function which specifies if a flux coupling occurs over a given "
1453 keep_constrained_dofs,
1457 face_has_flux_coupling);
1465#include "dof_tools_sparsity.inst"
void add_entries_local_to_global(const std::vector< size_type > &local_dof_indices, SparsityPatternType &sparsity_pattern, const bool keep_constrained_entries=true, const Table< 2, bool > &dof_mask=Table< 2, bool >()) const
unsigned int first_selected_component(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
cell_iterator end() const
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
types::global_dof_index n_boundary_dofs() const
const Triangulation< dim, spacedim > & get_triangulation() const
active_cell_iterator begin_active(const unsigned int level=0) const
bool has_hp_capabilities() const
types::global_dof_index n_dofs() const
cell_iterator begin(const unsigned int level=0) const
unsigned int n_dofs_per_vertex() const
unsigned int n_dofs_per_cell() const
unsigned int n_dofs_per_face(unsigned int face_no=0, unsigned int child=0) const
unsigned int n_components() const
const ComponentMask & get_nonzero_components(const unsigned int i) const
bool is_primitive() const
virtual bool has_support_on_face(const unsigned int shape_index, const unsigned int face_index) const
std::pair< unsigned int, unsigned int > system_to_component_index(const unsigned int index) const
virtual types::subdomain_id locally_owned_subdomain() const
unsigned int size() const
unsigned int max_dofs_per_face() const
unsigned int max_dofs_per_cell() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcDimensionMismatch(std::size_t arg1, std::size_t arg2)
static ::ExceptionBase & ExcMessage(std::string arg1)
void make_flux_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternType &sparsity_pattern)
void make_boundary_sparsity_pattern(const DoFHandler< dim, spacedim > &dof, const std::vector< types::global_dof_index > &dof_to_boundary_mapping, SparsityPatternType &sparsity_pattern)
void make_sparsity_pattern(const DoFHandler< dim, spacedim > &dof_handler, SparsityPatternType &sparsity_pattern, const AffineConstraints< number > &constraints=AffineConstraints< number >(), const bool keep_constrained_dofs=true, const types::subdomain_id subdomain_id=numbers::invalid_subdomain_id)
const types::boundary_id internal_face_boundary_id
const types::subdomain_id invalid_subdomain_id
const types::global_dof_index invalid_dof_index
unsigned int subdomain_id