16 #ifndef dealii_mg_constrained_dofs_h
17 #define dealii_mg_constrained_dofs_h
35 template <
int dim,
int spacedim>
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);
240 template <
typename Number>
243 const unsigned int level,
245 const bool add_refinement_edge_indices,
246 const bool add_level_constraints,
274 template <
int dim,
int spacedim>
286 const unsigned int min_level = level_relevant_dofs.
min_level();
287 const unsigned int max_level = (level_relevant_dofs.
max_level() == 0) ?
290 const bool user_level_dofs =
291 (level_relevant_dofs.
max_level() == 0) ?
false :
true;
297 for (
unsigned int l = min_level;
l <= max_level; ++
l)
302 level_relevant_dofs[
l]);
316 for (; cell != endc; ++cell)
319 for (
auto f : cell->face_indices())
320 if (cell->has_periodic_neighbor(f) &&
321 cell->periodic_neighbor(f)->level() == cell->level())
323 if (cell->is_locally_owned_on_level())
326 cell->periodic_neighbor(f)->level_subdomain_id() !=
329 "Periodic neighbor of a locally owned cell must either be owned or ghost."));
333 else if (cell->periodic_neighbor(f)->level_subdomain_id() ==
336 Assert(cell->is_locally_owned_on_level() ==
false,
341 const unsigned int dofs_per_face =
343 std::vector<types::global_dof_index> dofs_1(dofs_per_face);
344 std::vector<types::global_dof_index> dofs_2(dofs_per_face);
346 cell->periodic_neighbor(f)
347 ->face(cell->periodic_neighbor_face_no(f))
348 ->get_mg_dof_indices(
l, dofs_1, 0);
349 cell->face(f)->get_mg_dof_indices(
l, dofs_2, 0);
355 for (
unsigned int i = 0; i < dofs_per_face; ++i)
378 template <
int dim,
int spacedim>
382 const std::set<types::boundary_id> &boundary_ids,
400 template <
int dim,
int spacedim>
403 const unsigned int level,
404 const IndexSet &level_boundary_indices)
410 for (
unsigned int i = 0; i < n_levels; ++i)
419 template <
int dim,
int spacedim>
424 const unsigned int first_vector_component)
437 for (; face != endf; ++face)
438 if (face->at_boundary() && face->boundary_id() == bid)
439 for (
unsigned int d = 0;
d < dim; ++
d)
445 face->get_manifold().normal_vector(face, face->center());
447 if (std::abs(std::abs(unit_vec * normal_vec) - 1.0) < 1
e-10)
448 comp_mask.
set(
d + first_vector_component,
true);
451 std::abs(unit_vec * normal_vec) < 1
e-10,
453 "We can currently only support no normal flux conditions "
454 "for a specific boundary id if all faces are normal to the "
455 "x, y, or z axis."));
460 "We can currently only support no normal flux conditions "
461 "for a specific boundary id if all faces are facing in the "
462 "same direction, i.e., a boundary normal to the x-axis must "
463 "have a different boundary id than a boundary normal to the "
464 "y- or z-axis and so on. If the mesh here was produced using "
465 "GridGenerator::..., setting colorize=true during mesh generation "
466 "and calling make_no_normal_flux_constraints() for each no normal "
467 "flux boundary will fulfill the condition."));
475 const unsigned int level,
488 constraints_on_level,
535 const unsigned int level,
539 const IndexSet &interface_dofs_on_level =
593 template <
typename Number>
596 const unsigned int level,
597 const bool add_boundary_indices,
598 const bool add_refinement_edge_indices,
599 const bool add_level_constraints,
600 const bool add_user_constraints)
const
610 if (add_refinement_edge_indices)
613 if (add_level_constraints)
627 if (add_refinement_edge_indices)
630 if (add_level_constraints)
void merge(const AffineConstraints< other_number > &other_constraints, const MergeConflictBehavior merge_conflict_behavior=no_conflicts_allowed, const bool allow_different_local_lines=false)
void add_lines(const std::vector< bool > &lines)
void set(const unsigned int index, const bool value)
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
cell_iterator end() const
const Triangulation< dim, spacedim > & get_triangulation() const
types::global_dof_index n_dofs() const
const IndexSet & locally_owned_mg_dofs(const unsigned int level) const
const FiniteElement< dim, spacedim > & get_fe(const types::fe_index index=0) const
cell_iterator begin(const unsigned int level=0) const
const hp::FECollection< dim, spacedim > & get_fe_collection() const
unsigned int n_dofs_per_face(unsigned int face_no=0, unsigned int child=0) const
bool is_element(const size_type index) const
void add_indices(const ForwardIterator &begin, const ForwardIterator &end)
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
void make_zero_boundary_constraints(const DoFHandler< dim, spacedim > &dof, const std::set< types::boundary_id > &boundary_ids, const ComponentMask &component_mask={})
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 merge_constraints(AffineConstraints< Number > &constraints, const unsigned int level, const bool add_boundary_indices, const bool add_refinement_edge_indices, const bool add_level_constraints, const bool add_user_constraints) 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
const AffineConstraints< double > & get_level_constraints(const unsigned int level) const
const IndexSet & get_boundary_indices(const unsigned int level) const
unsigned int max_level() const
unsigned int min_level() const
face_iterator end_face() const
virtual unsigned int n_global_levels() const
face_iterator begin_face() const
unsigned int n_components() const
#define DEAL_II_NAMESPACE_OPEN
#define DEAL_II_CXX20_REQUIRES(condition)
#define DEAL_II_NAMESPACE_CLOSE
static ::ExceptionBase & ExcInternalError()
#define Assert(cond, exc)
#define AssertDimension(dim1, dim2)
#define AssertIndexRange(index, range)
static ::ExceptionBase & ExcMessage(std::string arg1)
types::global_dof_index size_type
SymmetricTensor< 2, dim, Number > d(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
SymmetricTensor< 2, dim, Number > e(const Tensor< 2, dim, Number > &F)
Tensor< 2, dim, Number > l(const Tensor< 2, dim, Number > &F, const Tensor< 2, dim, Number > &dF_dt)
const types::subdomain_id artificial_subdomain_id
unsigned int global_dof_index