Reference documentation for deal.II version GIT relicensing-462-g03c82a14bd 2024-04-21 16:20:02+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\}}\)
Loading...
Searching...
No Matches
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
25#include <set>
26#include <vector>
27
29
30// Forward declaration
31#ifndef DOXYGEN
32template <int dim, int spacedim>
34class DoFHandler;
35#endif
36
37
45{
46public:
47 using size_dof = std::vector<std::set<types::global_dof_index>>::size_type;
73 template <int dim, int spacedim>
74 void
76 const MGLevelObject<IndexSet> &level_relevant_dofs =
78
89 template <int dim, int spacedim>
90 void
93 const std::set<types::boundary_id> &boundary_ids,
94 const ComponentMask &component_mask = {});
95
102 template <int dim, int spacedim>
103 void
105 const unsigned int level,
107
122 void
123 add_user_constraints(const unsigned int level,
124 const AffineConstraints<double> &constraints_on_level);
125
140 template <int dim, int spacedim>
141 void
143 const types::boundary_id bid,
144 const unsigned int first_vector_component);
145
149 void
151
155 void
156 clear();
157
161 bool
162 is_boundary_index(const unsigned int level,
163 const types::global_dof_index index) const;
164
168 bool
169 at_refinement_edge(const unsigned int level,
170 const types::global_dof_index index) const;
171
172
179 bool
180 is_interface_matrix_entry(const unsigned int level,
182 const types::global_dof_index j) const;
183
190 const IndexSet &
191 get_boundary_indices(const unsigned int level) const;
192
193
198 const IndexSet &
199 get_refinement_edge_indices(unsigned int level) const;
200
201
205 bool
206 have_boundary_indices() const;
207
213 get_level_constraints(const unsigned int level) const;
214
223 get_user_constraint_matrix(const unsigned int level) const;
224
237 template <typename Number>
238 void
240 const unsigned int level,
241 const bool add_boundary_indices,
242 const bool add_refinement_edge_indices,
243 const bool add_level_constraints,
244 const bool add_user_constraints) const;
245
246private:
250 std::vector<IndexSet> boundary_indices;
251
256 std::vector<IndexSet> refinement_edge_indices;
257
262 std::vector<AffineConstraints<double>> level_constraints;
263
267 std::vector<AffineConstraints<double>> user_constraints;
268};
269
270
271
272inline bool
274 const types::global_dof_index index) const
275{
276 if (boundary_indices.empty())
277 return false;
278
280 return boundary_indices[level].is_element(index);
281}
282
283
284
285inline bool
287 const types::global_dof_index index) const
288{
290
291 return refinement_edge_indices[level].is_element(index);
292}
293
294
295
296inline bool
298 const unsigned int level,
300 const types::global_dof_index j) const
301{
302 const IndexSet &interface_dofs_on_level =
303 this->get_refinement_edge_indices(level);
304
305 return interface_dofs_on_level.is_element(i) // at_refinement_edge(i)
306 && !interface_dofs_on_level.is_element(j) // !at_refinement_edge(j)
307 && !this->is_boundary_index(level, i) // !on_boundary(i)
308 && !this->is_boundary_index(level, j); // !on_boundary(j)
309}
310
311
312
313inline const IndexSet &
319
320
321
322inline const IndexSet &
328
329
330
331inline bool
333{
334 return boundary_indices.size() != 0;
335}
336
337
338
339inline const AffineConstraints<double> &
345
346
347
348inline const AffineConstraints<double> &
354
355
356
358
359#endif
bool is_element(const size_type index) const
Definition index_set.h:1883
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:502
#define DEAL_II_CXX20_REQUIRES(condition)
Definition config.h:177
#define DEAL_II_NAMESPACE_CLOSE
Definition config.h:503
unsigned int level
Definition grid_out.cc:4626
#define AssertIndexRange(index, range)