ExaDG
Toggle main menu visibility
Loading...
Searching...
No Matches
include
exadg
operators
constraints.h
1
/* ______________________________________________________________________
2
*
3
* ExaDG - High-Order Discontinuous Galerkin for the Exa-Scale
4
*
5
* Copyright (C) 2023 by the ExaDG authors
6
*
7
* This program is free software: you can redistribute it and/or modify
8
* it under the terms of the GNU General Public License as published by
9
* the Free Software Foundation, either version 3 of the License, or
10
* (at your option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful,
13
* but WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
* GNU General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License
18
* along with this program. If not, see <https://www.gnu.org/licenses/>.
19
* ______________________________________________________________________
20
*/
21
22
#ifndef EXADG_OPERATORS_CONSTRAINTS_H_
23
#define EXADG_OPERATORS_CONSTRAINTS_H_
24
25
// deal.II
26
#include <deal.II/dofs/dof_tools.h>
27
28
// ExaDG
29
#include <exadg/grid/grid_utilities.h>
30
31
namespace
ExaDG
32
{
37
template
<
int
dim,
typename
Number>
38
void
39
add_hanging_node_and_periodicity_constraints
(dealii::AffineConstraints<Number> & affine_constraints,
40
Grid<dim>
const
& grid,
41
dealii::DoFHandler<dim>
const
& dof_handler)
42
{
43
dealii::IndexSet
const
locally_relevant_dofs =
44
dealii::DoFTools::extract_locally_relevant_dofs(dof_handler);
45
affine_constraints.reinit(dof_handler.locally_owned_dofs(), locally_relevant_dofs);
46
47
// hanging nodes (needs to be done before imposing periodicity constraints
48
if
(grid.
triangulation
->has_hanging_nodes())
49
{
50
dealii::DoFTools::make_hanging_node_constraints(dof_handler, affine_constraints);
51
}
52
53
// constraints from periodic boundary conditions
54
if
(not(grid.
periodic_face_pairs
.empty()))
55
{
56
auto
periodic_faces_dof =
57
GridUtilities::transform_periodic_face_pairs_to_dof_cell_iterator(grid.
periodic_face_pairs
,
58
dof_handler);
59
60
dealii::DoFTools::make_periodicity_constraints<dim, dim, Number>(periodic_faces_dof,
61
affine_constraints);
62
}
63
}
64
69
template
<
typename
Key,
typename
Data>
70
inline
void
71
fill_keys_of_map_into_set
(std::set<Key> & set, std::map<Key, Data>
const
& map)
72
{
73
for
(
auto
iter : map)
74
{
75
set.insert(iter.first);
76
}
77
}
78
83
inline
void
84
fill_map_bid_to_mask_with_default_mask
(
85
std::map<dealii::types::boundary_id, dealii::ComponentMask> & map_bid_to_mask,
86
std::set<dealii::types::boundary_id>
const
& set_boundary_ids)
87
{
88
for
(
auto
const
& it : set_boundary_ids)
89
{
90
// use default mask if no maks has been defined
91
if
(map_bid_to_mask.find(it) == map_bid_to_mask.end())
92
map_bid_to_mask.insert({it, dealii::ComponentMask()});
93
}
94
}
95
102
template
<
int
dim,
typename
Number>
103
void
104
add_homogeneous_dirichlet_constraints
(
105
dealii::AffineConstraints<Number> & affine_constraints,
106
dealii::DoFHandler<dim>
const
& dof_handler,
107
std::map<dealii::types::boundary_id, dealii::ComponentMask>
const
&
108
map_boundary_id_to_component_mask)
109
{
110
for
(
auto
const
& it : map_boundary_id_to_component_mask)
111
{
112
dealii::DoFTools::make_zero_boundary_constraints(dof_handler,
113
it.first,
114
affine_constraints,
115
it.second);
116
}
117
}
118
119
}
// namespace ExaDG
120
121
#endif
/* EXADG_OPERATORS_CONSTRAINTS_H_ */
ExaDG::Grid
Definition
grid.h:40
ExaDG::Grid::periodic_face_pairs
PeriodicFacePairs periodic_face_pairs
Definition
grid.h:54
ExaDG::Grid::triangulation
std::shared_ptr< dealii::Triangulation< dim > > triangulation
Definition
grid.h:49
ExaDG
Definition
driver.cpp:33
ExaDG::add_hanging_node_and_periodicity_constraints
void add_hanging_node_and_periodicity_constraints(dealii::AffineConstraints< Number > &affine_constraints, Grid< dim > const &grid, dealii::DoFHandler< dim > const &dof_handler)
Definition
constraints.h:39
ExaDG::add_homogeneous_dirichlet_constraints
void add_homogeneous_dirichlet_constraints(dealii::AffineConstraints< Number > &affine_constraints, dealii::DoFHandler< dim > const &dof_handler, std::map< dealii::types::boundary_id, dealii::ComponentMask > const &map_boundary_id_to_component_mask)
Definition
constraints.h:104
ExaDG::fill_map_bid_to_mask_with_default_mask
void fill_map_bid_to_mask_with_default_mask(std::map< dealii::types::boundary_id, dealii::ComponentMask > &map_bid_to_mask, std::set< dealii::types::boundary_id > const &set_boundary_ids)
Definition
constraints.h:84
ExaDG::fill_keys_of_map_into_set
void fill_keys_of_map_into_set(std::set< Key > &set, std::map< Key, Data > const &map)
Definition
constraints.h:71
Generated by
1.17.0