16#ifndef dealii_mg_constrained_dofs_h
17#define dealii_mg_constrained_dofs_h
35template <
int dim,
int spacedim>
50 using size_dof = std::vector<std::set<types::global_dof_index>>::size_type;
76 template <
int dim,
int spacedim>
92 template <
int dim,
int spacedim>
96 const std::set<types::boundary_id> &boundary_ids,
105 template <
int dim,
int spacedim>
108 const unsigned int level,
143 template <
int dim,
int spacedim>
147 const unsigned int first_vector_component);
253template <
int dim,
int spacedim>
264 const unsigned int nlevels = dof.get_triangulation().n_global_levels();
276 for (
unsigned int l = min_level; l <= max_level; ++l)
293 for (; cell !=
endc; ++cell)
296 for (
auto f : cell->face_indices())
297 if (cell->has_periodic_neighbor(f) &&
298 cell->periodic_neighbor(f)->level() == cell->level())
300 if (cell->is_locally_owned_on_level())
303 cell->periodic_neighbor(f)->level_subdomain_id() !=
306 "Periodic neighbor of a locally owned cell must either be owned or ghost."));
310 else if (cell->periodic_neighbor(f)->level_subdomain_id() ==
313 Assert(cell->is_locally_owned_on_level() ==
false,
318 const unsigned int dofs_per_face =
319 dof.get_fe(0).n_dofs_per_face(f);
320 std::vector<types::global_dof_index>
dofs_1(dofs_per_face);
321 std::vector<types::global_dof_index>
dofs_2(dofs_per_face);
323 cell->periodic_neighbor(f)
324 ->face(cell->periodic_neighbor_face_no(f))
325 ->get_mg_dof_indices(l,
dofs_1, 0);
326 cell->face(f)->get_mg_dof_indices(l,
dofs_2, 0);
332 for (
unsigned int i = 0; i < dofs_per_face; ++i)
355template <
int dim,
int spacedim>
359 const std::set<types::boundary_id> &boundary_ids,
364 const unsigned int n_levels = dof.get_triangulation().n_global_levels();
377template <
int dim,
int spacedim>
380 const unsigned int level,
383 const unsigned int n_levels = dof.get_triangulation().n_global_levels();
387 for (
unsigned int i = 0; i < n_levels; ++i)
396template <
int dim,
int spacedim>
401 const unsigned int first_vector_component)
405 const unsigned int n_components = dof.get_fe_collection().n_components();
412 face = dof.get_triangulation().begin_face(),
413 endf = dof.get_triangulation().end_face();
414 for (; face !=
endf; ++face)
415 if (face->at_boundary() && face->boundary_id() ==
bid)
416 for (
unsigned int d = 0; d < dim; ++d)
422 face->get_manifold().normal_vector(face, face->center());
425 comp_mask.set(d + first_vector_component,
true);
430 "We can currently only support no normal flux conditions "
431 "for a specific boundary id if all faces are normal to the "
432 "x, y, or z axis."));
437 "We can currently only support no normal flux conditions "
438 "for a specific boundary id if all faces are facing in the "
439 "same direction, i.e., a boundary normal to the x-axis must "
440 "have a different boundary id than a boundary normal to the "
441 "y- or z-axis and so on. If the mesh here was produced using "
442 "GridGenerator::..., setting colorize=true during mesh generation "
443 "and calling make_no_normal_flux_constraints() for each no normal "
444 "flux boundary will fulfill the condition."));
452 const unsigned int level,
510 const unsigned int level,
std::vector< IndexSet > refinement_edge_indices
std::vector< AffineConstraints< double > > user_constraints
void make_no_normal_flux_constraints(const DoFHandler< dim, spacedim > &dof, const types::boundary_id bid, const unsigned int first_vector_component)
bool is_interface_matrix_entry(const unsigned int level, const types::global_dof_index i, const types::global_dof_index j) const
std::vector< IndexSet > boundary_indices
void add_boundary_indices(const DoFHandler< dim, spacedim > &dof, const unsigned int level, const IndexSet &boundary_indices)
bool at_refinement_edge(const unsigned int level, const types::global_dof_index index) const
void initialize(const DoFHandler< dim, spacedim > &dof, const MGLevelObject< IndexSet > &level_relevant_dofs=MGLevelObject< IndexSet >())
bool is_boundary_index(const unsigned int level, const types::global_dof_index index) const
void clear_user_constraints()
std::vector< AffineConstraints< double > > level_constraints
bool have_boundary_indices() const
void add_user_constraints(const unsigned int level, const AffineConstraints< double > &constraints_on_level)
const IndexSet & get_refinement_edge_indices(unsigned int level) const
const AffineConstraints< double > & get_user_constraint_matrix(const unsigned int level) const
std::vector< std::set< types::global_dof_index > >::size_type size_dof
void make_zero_boundary_constraints(const DoFHandler< dim, spacedim > &dof, const std::set< types::boundary_id > &boundary_ids, const ComponentMask &component_mask=ComponentMask())
const AffineConstraints< double > & get_level_constraints(const unsigned int level) const
const IndexSet & get_boundary_indices(const unsigned int level) const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcInternalError()
static ::ExceptionBase & ExcMessage(std::string arg1)
typename ActiveSelector::cell_iterator cell_iterator
const types::subdomain_id artificial_subdomain_id
::VectorizedArray< Number, width > abs(const ::VectorizedArray< Number, width > &)