FEAT 3
Finite Element Analysis Toolbox
Loading...
Searching...
No Matches
domain_level.hpp
1// FEAT3: Finite Element Analysis Toolbox, Version 3
2// Copyright (C) 2010 by Stefan Turek & the FEAT group
3// FEAT3 is released under the GNU General Public License version 3,
4// see the file 'copyright.txt' in the top level directory for details.
5
6#pragma once
7
9#include <kernel/geometry/mesh_node.hpp>
10#include <kernel/assembly/domain_assembler.hpp>
11
12namespace FEAT
13{
14 namespace Control
15 {
16 namespace Domain
17 {
18 template<typename Mesh_>
20 {
21 public:
22 typedef Mesh_ MeshType;
23 typedef typename MeshType::ShapeType ShapeType;
27
28 protected:
29 int _level_index;
30 std::unique_ptr<MeshNodeType> _mesh_node;
31
32 public:
33 explicit DomainLevel(int _lvl_idx, std::unique_ptr<MeshNodeType> node) :
34 _level_index(_lvl_idx),
35 _mesh_node(std::move(node))
36 {
37 // note: we have to check _mesh_node instead of node here,
38 // because the unique_ptr has already been moved...
39 XASSERT(_mesh_node.get() != nullptr);
40 }
41
42 DomainLevel(DomainLevel&& other) :
43 _level_index(_level_index),
44 _mesh_node(std::forward<std::unique_ptr<MeshNodeType>>(other._mesh_node))
45 {
46 }
47
48 virtual ~DomainLevel()
49 {
50 }
51
52 std::size_t bytes() const
53 {
54 return _mesh_node->bytes();
55 }
56
57 int get_level_index() const
58 {
59 return _level_index;
60 }
61
62 MeshNodeType* get_mesh_node()
63 {
64 return _mesh_node.get();
65 }
66
67 const MeshNodeType* get_mesh_node() const
68 {
69 return _mesh_node.get();
70 }
71
72 MeshType& get_mesh()
73 {
74 return *_mesh_node->get_mesh();
75 }
76
77 const MeshType& get_mesh() const
78 {
79 return *_mesh_node->get_mesh();
80 }
81
82 const PartType* find_halo_part(int rank) const
83 {
84 return this->_mesh_node->get_halo(rank);
85 }
86
87 const PartType* find_patch_part(int rank) const
88 {
89 return this->_mesh_node->get_patch(rank);
90 }
91
92 protected:
93 template<typename Trafo_>
94 void _add_trafo_mesh_part_charts(Trafo_& trafo)
95 {
96 XASSERT(&trafo.get_mesh() == &this->get_mesh());
97
98 // loop over all mesh-parts in the mesh node and check whether they are attached to a chart
99 const std::deque<String>& mesh_part_names = this->_mesh_node->get_mesh_part_names(true);
100 for(const String& part_name : mesh_part_names)
101 {
102 // chart may be nullptr if the mesh-part is not assigned to a chart at all
103 const ChartType* chart = this->_mesh_node->find_mesh_part_chart(part_name);
104 // mesh_part may be nullptr if this patch does not contain this mesh part
105 PartType* mesh_part = this->_mesh_node->find_mesh_part(part_name);
106 if((chart != nullptr) && (mesh_part != nullptr))
107 trafo.add_meshpart_chart(*mesh_part, *chart);
108 }
109 }
110 }; // class DomainLevel<...>
111
112 template<typename Mesh_, typename Trafo_, typename Space_>
114 public Domain::DomainLevel<Mesh_>
115 {
116 public:
118
119 typedef Mesh_ MeshType;
120 typedef Trafo_ TrafoType;
121 typedef Space_ SpaceType;
122
123 TrafoType trafo;
124 SpaceType space;
125
127
128 public:
129 explicit SimpleDomainLevel(int lvl_idx, std::unique_ptr<Geometry::RootMeshNode<MeshType>> node) :
130 BaseClass(lvl_idx, std::move(node)),
131 trafo(BaseClass::get_mesh()),
132 space(trafo),
133 domain_asm(trafo)
134 {
135 }
136
137 void add_trafo_mesh_part_charts()
138 {
139 this->_add_trafo_mesh_part_charts(trafo);
140 }
141 }; // class SimpleDomainLevel<...>
142
143 template<typename Mesh_, typename Trafo_, typename SpaceVelo_, typename SpacePres_>
145 public Domain::DomainLevel<Mesh_>
146 {
147 public:
149
150 typedef Mesh_ MeshType;
151 typedef Trafo_ TrafoType;
152 typedef SpaceVelo_ SpaceVeloType;
153 typedef SpacePres_ SpacePresType;
154
155 TrafoType trafo;
156 SpaceVeloType space_velo;
157 SpacePresType space_pres;
158
160
161 public:
162 explicit StokesDomainLevel(int lvl_idx, std::unique_ptr<Geometry::RootMeshNode<MeshType>> node) :
163 BaseClass(lvl_idx, std::move(node)),
164 trafo(BaseClass::get_mesh()),
165 space_velo(trafo),
166 space_pres(trafo),
167 domain_asm(trafo)
168 {
169 }
170
171 void add_trafo_mesh_part_charts()
172 {
173 this->_add_trafo_mesh_part_charts(trafo);
174 }
175 }; // class StokesDomainLevel<...>
176
177 template<typename Mesh_, typename Trafo_, typename SpaceVelo_, typename SpacePres_, typename SpaceStress_>
179 public Domain::DomainLevel<Mesh_>
180 {
181 public:
183
184 typedef Mesh_ MeshType;
185 typedef Trafo_ TrafoType;
186 typedef SpaceVelo_ SpaceVeloType;
187 typedef SpacePres_ SpacePresType;
188 typedef SpaceStress_ SpaceStressType;
189
190 TrafoType trafo;
191 SpaceVeloType space_velo;
192 SpacePresType space_pres;
193 SpaceStressType space_stress;
194
196
197 public:
198 explicit Stokes3FieldDomainLevel(int lvl_idx, std::unique_ptr<Geometry::RootMeshNode<MeshType>> node) :
199 BaseClass(lvl_idx, std::move(node)),
200 trafo(BaseClass::get_mesh()),
201 space_velo(trafo),
202 space_pres(trafo),
203 space_stress(trafo),
204 domain_asm(trafo)
205 {
206 }
207
208 void add_trafo_mesh_part_charts()
209 {
210 this->_add_trafo_mesh_part_charts(trafo);
211 }
212 }; // class Stokes3FieldDomainLevel<...>
213 } // namespace Domain
214 } // namespace Control
215} // namespace FEAT
#define XASSERT(expr)
Assertion macro definition.
Definition: assertion.hpp:262
FEAT Kernel base header.
Domain Integral Assembler class template.
MeshType * get_mesh()
Returns the mesh of this node.
Definition: mesh_node.hpp:225
Class template for partial meshes.
Definition: mesh_part.hpp:90
Root mesh node class template.
Definition: mesh_node.hpp:748
String class implementation.
Definition: string.hpp:46
FEAT namespace.
Definition: adjactor.hpp:12