Loading [MathJax]/extensions/TeX/newcommand.js
 deal.II version GIT relicensing-2848-g5241f990fb 2025-03-16 19:30:00+00:00
\newcommand{\dealvcentcolon}{\mathrel{\mathop{:}}} \newcommand{\dealcoloneq}{\dealvcentcolon\mathrel{\mkern-1.2mu}=} \newcommand{\jump}[1]{\left[\!\left[ #1 \right]\!\right]} \newcommand{\average}[1]{\left\{\!\left\{ #1 \right\}\!\right\}}
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages Concepts
mg_constrained_dofs.h
Go to the documentation of this file.
1// ------------------------------------------------------------------------
2//
3// SPDX-License-Identifier: LGPL-2.1-or-later
4// Copyright (C) 2010 - 2023 by the deal.II authors
5//
6// This file is part of the deal.II library.
7//
8// Part of the source code is dual licensed under Apache-2.0 WITH
9// LLVM-exception OR LGPL-2.1-or-later. Detailed license information
10// governing the source code and code contributions can be found in
11// LICENSE.md and CONTRIBUTING.md at the top level directory of deal.II.
12//
13// ------------------------------------------------------------------------
14
15#ifndef dealii_mg_constrained_dofs_h
16#define dealii_mg_constrained_dofs_h
17
18#include <deal.II/base/config.h>
19
22
24
26
27#include <set>
28#include <vector>
29
31
32// Forward declaration
33#ifndef DOXYGEN
34template <int dim, int spacedim>
36class DoFHandler;
37#endif
38
39
47{
48public:
49 using size_dof = std::vector<std::set<types::global_dof_index>>::size_type;
75 template <int dim, int spacedim>
76 void
78 const MGLevelObject<IndexSet> &level_relevant_dofs =
80
91 template <int dim, int spacedim>
92 void
95 const std::set<types::boundary_id> &boundary_ids,
96 const ComponentMask &component_mask = {});
97
104 template <int dim, int spacedim>
105 void
107 const unsigned int level,
109
124 void
125 add_user_constraints(const unsigned int level,
126 const AffineConstraints<double> &constraints_on_level);
127
142 template <int dim, int spacedim>
143 void
145 const types::boundary_id bid,
146 const unsigned int first_vector_component);
147
151 void
153
157 void
158 clear();
159
163 bool
164 is_boundary_index(const unsigned int level,
165 const types::global_dof_index index) const;
166
170 bool
171 at_refinement_edge(const unsigned int level,
172 const types::global_dof_index index) const;
173
174
181 bool
182 is_interface_matrix_entry(const unsigned int level,
184 const types::global_dof_index j) const;
185
192 const IndexSet &
193 get_boundary_indices(const unsigned int level) const;
194
195
200 const IndexSet &
201 get_refinement_edge_indices(unsigned int level) const;
202
203
207 bool
208 have_boundary_indices() const;
209
215 get_level_constraints(const unsigned int level) const;
216
225 get_user_constraint_matrix(const unsigned int level) const;
226
239 template <typename Number>
240 void
242 const unsigned int level,
243 const bool add_boundary_indices,
244 const bool add_refinement_edge_indices,
245 const bool add_level_constraints,
246 const bool add_user_constraints) const;
247
248private:
252 std::vector<IndexSet> boundary_indices;
253
258 std::vector<IndexSet> refinement_edge_indices;
259
264 std::vector<AffineConstraints<double>> level_constraints;
265
269 std::vector<AffineConstraints<double>> user_constraints;
270};
271
272
273
274inline bool
276 const types::global_dof_index index) const
277{
278 if (boundary_indices.empty())
279 return false;
280
282 return boundary_indices[level].is_element(index);
283}
284
285
286
287inline bool
289 const types::global_dof_index index) const
290{
292
293 return refinement_edge_indices[level].is_element(index);
294}
295
296
297
298inline bool
300 const unsigned int level,
302 const types::global_dof_index j) const
303{
304 const IndexSet &interface_dofs_on_level =
305 this->get_refinement_edge_indices(level);
306
307 return interface_dofs_on_level.is_element(i) // at_refinement_edge(i)
308 && !interface_dofs_on_level.is_element(j) // !at_refinement_edge(j)
309 && !this->is_boundary_index(level, i) // !on_boundary(i)
310 && !this->is_boundary_index(level, j); // !on_boundary(j)
311}
312
313
314
315inline const IndexSet &
321
322
323
324inline const IndexSet &
330
331
332
333inline bool
335{
336 return boundary_indices.size() != 0;
337}
338
339
340
341inline const AffineConstraints<double> &
347
348
349
350inline const AffineConstraints<double> &
356
357
358
360
361#endif
bool is_element(const size_type index) const
Definition index_set.h:1905
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
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
#define DEAL_II_NAMESPACE_OPEN
Definition config.h:40
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:245
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:41
unsigned int level
Definition grid_out.cc:4635
#define AssertIndexRange(index, range)