16 #ifndef dealii_mg_constrained_dofs_h 17 #define dealii_mg_constrained_dofs_h 19 #include <deal.II/base/config.h> 21 #include <deal.II/base/subscriptor.h> 23 #include <deal.II/lac/affine_constraints.h> 25 #include <deal.II/multigrid/mg_tools.h> 30 DEAL_II_NAMESPACE_OPEN
32 template <
int dim,
int spacedim>
45 using size_dof = std::vector<std::set<types::global_dof_index>>::size_type;
65 template <
int dim,
int spacedim>
79 template <
int dim,
int spacedim>
80 DEAL_II_DEPRECATED
void 96 template <
int dim,
int spacedim>
100 const std::set<types::boundary_id> &boundary_ids,
117 template <
int dim,
int spacedim>
121 const unsigned int first_vector_component);
216 template <
int dim,
int spacedim>
229 for (
unsigned int l = 0; l < nlevels; ++l)
239 for (; cell != endc; ++cell)
242 for (
unsigned int f = 0; f < GeometryInfo<dim>::faces_per_cell; ++f)
243 if (cell->has_periodic_neighbor(f) &&
244 cell->periodic_neighbor(f)->level() == cell->level())
246 if (cell->is_locally_owned_on_level())
249 cell->periodic_neighbor(f)->level_subdomain_id() !=
252 "Periodic neighbor of a locally owned cell must either be owned or ghost."));
256 else if (cell->periodic_neighbor(f)->level_subdomain_id() ==
259 Assert(cell->is_locally_owned_on_level() ==
false,
264 const unsigned int dofs_per_face =
265 cell->face(f)->
get_fe(0).dofs_per_face;
266 std::vector<types::global_dof_index> dofs_1(dofs_per_face);
267 std::vector<types::global_dof_index> dofs_2(dofs_per_face);
269 cell->periodic_neighbor(f)
270 ->face(cell->periodic_neighbor_face_no(f))
271 ->get_mg_dof_indices(l, dofs_1, 0);
272 cell->face(f)->get_mg_dof_indices(l, dofs_2, 0);
278 for (
unsigned int i = 0; i < dofs_per_face; ++i)
301 template <
int dim,
int spacedim>
323 template <
int dim,
int spacedim>
327 const std::set<types::boundary_id> &boundary_ids,
344 template <
int dim,
int spacedim>
349 const unsigned int first_vector_component)
354 Assert(first_vector_component + dim <= n_components,
355 ExcIndexRange(first_vector_component, 0, n_components - dim + 1));
363 for (; face != endf; ++face)
364 if (face->at_boundary() && face->boundary_id() == bid)
365 for (
unsigned int d = 0; d < dim; ++d)
373 if (std::abs(std::abs(unit_vec * normal_vec) - 1.0) < 1e-10)
374 comp_mask.
set(d + first_vector_component,
true);
377 std::abs(unit_vec * normal_vec) < 1e-10,
379 "We can currently only support no normal flux conditions " 380 "for a specific boundary id if all faces are normal to the " 381 "x, y, or z axis."));
386 "We can currently only support no normal flux conditions " 387 "for a specific boundary id if all faces are facing in the " 388 "same direction, i.e., a boundary normal to the x-axis must " 389 "have a different boundary id than a boundary normal to the " 390 "y- or z-axis and so on. If the mesh here was produced using " 391 "GridGenerator::..., setting colorize=true during mesh generation " 392 "and calling make_no_normal_flux_constraints() for each no normal " 393 "flux boundary will fulfill the condition."));
429 const unsigned int level,
433 const IndexSet &interface_dofs_on_level =
487 DEAL_II_NAMESPACE_CLOSE
const Triangulation< dim, spacedim > & get_triangulation() const
cell_iterator begin(const unsigned int level=0) const
bool is_boundary_index(const unsigned int level, const types::global_dof_index index) const
void make_no_normal_flux_constraints(const DoFHandler< dim, spacedim > &dof, const types::boundary_id bid, const unsigned int first_vector_component)
cell_iterator end() const
#define AssertIndexRange(index, range)
std::vector< IndexSet > boundary_indices
const AffineConstraints< double > & get_level_constraints(const unsigned int level) const
void set(const unsigned int index, const bool value)
static ::ExceptionBase & ExcIndexRange(int arg1, int arg2, int arg3)
const FiniteElement< dim, spacedim > & get_fe(const unsigned int index=0) const
const AffineConstraints< double > & get_level_constraint_matrix(const unsigned int level) const
bool is_interface_matrix_entry(const unsigned int level, const types::global_dof_index i, const types::global_dof_index j) const
static ::ExceptionBase & ExcMessage(std::string arg1)
const IndexSet & get_boundary_indices(const unsigned int level) const
#define Assert(cond, exc)
types::global_dof_index n_dofs() const
const IndexSet & get_refinement_edge_indices(unsigned int level) const
void make_zero_boundary_constraints(const DoFHandler< dim, spacedim > &dof, const std::set< types::boundary_id > &boundary_ids, const ComponentMask &component_mask=ComponentMask())
std::vector< IndexSet > refinement_edge_indices
unsigned int global_dof_index
const types::subdomain_id artificial_subdomain_id
bool at_refinement_edge(const unsigned int level, const types::global_dof_index index) const
unsigned int n_selected_components(const unsigned int overall_number_of_components=numbers::invalid_unsigned_int) const
bool is_element(const size_type index) const
virtual Tensor< 1, spacedim > normal_vector(const typename Triangulation< dim, spacedim >::face_iterator &face, const Point< spacedim > &p) const
typename ActiveSelector::cell_iterator cell_iterator
bool have_boundary_indices() const
std::vector< AffineConstraints< double > > level_constraints
const Manifold< dim, spacedim > & get_manifold(const types::manifold_id number) const
static ::ExceptionBase & ExcInternalError()
void initialize(const DoFHandler< dim, spacedim > &dof)