BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_FEM_DofManagerBase.hpp
Go to the documentation of this file.
1/*
2 * BELFEM -- The Berkeley Lab Finite Element Framework
3 * Copyright (c) 2026, The Regents of the University of California,
4 * through Lawrence Berkeley National Laboratory (subject to receipt of any required
5 * approvals from the U.S. Dept. of Energy). All rights reserved.
6 *
7 * Developers: Christian Messe, Gregory Giard
8 *
9 * See the top-level LICENSE file for the complete license and disclaimer.
10 */
11
12#ifndef BELFEM_CL_FEM_DOFMANAGERBASE_HPP
13#define BELFEM_CL_FEM_DOFMANAGERBASE_HPP
14
15#include "typedefs.hpp"
16#include "cl_Vector.hpp"
17#include "cl_Mesh.hpp"
19
20namespace belfem
21{
22 class Mesh ;
23
24 enum class DofManagerType
25 {
28 UNDEFINED
29 };
30
31 namespace fem
32 {
33 class Kernel;
34 class IWG ;
35 class Block ;
36 class SideSet ;
37 class Dof ;
38
44 {
45 const DofManagerType mType ;
46
47//----------------------------------------------------------------------------
48 protected:
49//----------------------------------------------------------------------------
50
52
54
55 IWG * mIWG = nullptr ;
56
58
59//------------------------------------------------------------------------------
60 public:
61//------------------------------------------------------------------------------
62
63 DofManagerBase( const DofManagerType aType,
64 Kernel * aParent ) ;
65
66//------------------------------------------------------------------------------
67
68 virtual ~DofManagerBase() = default ;
69
70//--------------------------------------------------------------------------
71
73 type() const ;
74
75//------------------------------------------------------------------------------
76
80 proc_t
81 rank() const ;
82
83//------------------------------------------------------------------------------
84
85 Mesh *
86 mesh();
87
88//------------------------------------------------------------------------------
89
90 Kernel *
91 parent();
92
93//------------------------------------------------------------------------------
94
95 IWG *
96 iwg();
97
98//------------------------------------------------------------------------------
99
101 field_data( const string & aLabel ) ;
102
103//------------------------------------------------------------------------------
104
108 virtual Dof *
109 dof( const id_t aID );
110
111//------------------------------------------------------------------------------
112
113 virtual id_t
114 calculate_dof_id( const mesh::Node * aNode , const uint aDofType ) const;
115
116//------------------------------------------------------------------------------
117
118 virtual id_t
119 calculate_dof_id( const mesh::Edge * aEdge , const uint aDofType ) const;
120
121//------------------------------------------------------------------------------
122
123 virtual id_t
124 calculate_dof_id( const mesh::Facet * aFacet , const uint aDofType ) const;
125
126//------------------------------------------------------------------------------
127
128 virtual Block *
129 block( const id_t aID );
130
131//------------------------------------------------------------------------------
132
133 virtual SideSet *
134 sideset( const id_t aID ) ;
135
136//------------------------------------------------------------------------------
137
138 virtual uint
140
141//------------------------------------------------------------------------------
142
143 virtual uint
145
146//------------------------------------------------------------------------------
147
148 virtual uint
150
151//------------------------------------------------------------------------------
152
153 virtual uint
155
156//------------------------------------------------------------------------------
157
158 virtual IntegrationScheme
159 integration_scheme() const ;
160
161//------------------------------------------------------------------------------
162
163 virtual bool
164 block_exists( const id_t & aID ) const ;
165
166//------------------------------------------------------------------------------
167
168 virtual bool
169 sideset_exists( const id_t & aID ) const ;
170
171//------------------------------------------------------------------------------
172
173 virtual void
174 collect_fields( const Cell< string > & aFieldLabels ) ;
175
176//------------------------------------------------------------------------------
177
178 virtual void
179 distribute_fields( const Cell< string > & aFieldLabels ) ;
180
181//------------------------------------------------------------------------------
182
187 virtual void
188 synchronize_fields( const Cell< string > & aFieldLabels ) ;
189
190//------------------------------------------------------------------------------
191
192 bool
193 is_master() const ;
194
195//------------------------------------------------------------------------------
196
197 virtual bool
198 dof_exists( const id_t aID ) const ;
199
200//----------------------------------------------------------------------------
201
202 virtual void
204
205//----------------------------------------------------------------------------
206
207 virtual void
209
210//------------------------------------------------------------------------------
211
212 virtual void
213 initialize();
214
215//------------------------------------------------------------------------------
216
223 virtual bool
225 {
226 return false ;
227 }
228
229//------------------------------------------------------------------------------
230 };
231
232//------------------------------------------------------------------------------
233
234 inline DofManagerType
236 {
237 return mType ;
238 }
239
240
241//------------------------------------------------------------------------------
242
243 inline proc_t
245 {
246 return mCommRank;
247 }
248
249//------------------------------------------------------------------------------
250 inline Mesh *
252 {
253 return mMesh ;
254 }
255
256//---------------------------------------------------------------------------
257
258 inline Kernel *
260 {
261 return mParent ;
262 }
263
264//------------------------------------------------------------------------------
265
266 inline IWG *
268 {
269 return mIWG ;
270 }
271
272//---------------------------------------------------------------------------
273
274 inline Vector< real > &
275 DofManagerBase::field_data( const string & aLabel )
276 {
277 return mMesh->field_data( aLabel );
278 }
279
280//---------------------------------------------------------------------------
281 }
282}
283
284#endif //BELFEM_CL_FEM_DOFMANAGERBASE_HPP
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Vector< real > & field_data(const string &aLabel)
Definition cl_Mesh.hpp:1504
Definition cl_FEM_Block.hpp:35
Definition cl_FEM_Dof.hpp:28
IWG * mIWG
Definition cl_FEM_DofManagerBase.hpp:55
virtual bool dof_exists(const id_t aID) const
Definition cl_FEM_DofManagerBase.cpp:193
virtual void synchronize_fields(const Cell< string > &aFieldLabels)
collect and distribute afterwards
Definition cl_FEM_DofManagerBase.cpp:169
virtual bool block_exists(const id_t &aID) const
Definition cl_FEM_DofManagerBase.cpp:135
virtual void initialize()
Definition cl_FEM_DofManagerBase.cpp:210
virtual uint number_of_dofs_per_node() const
Definition cl_FEM_DofManagerBase.cpp:90
Kernel * mParent
Definition cl_FEM_DofManagerBase.hpp:51
Mesh * mesh()
Definition cl_FEM_DofManagerBase.hpp:251
virtual uint number_of_dofs_per_edge() const
Definition cl_FEM_DofManagerBase.cpp:99
virtual uint sideset_integration_order() const
Definition cl_FEM_DofManagerBase.cpp:109
virtual void distribute_fields(const Cell< string > &aFieldLabels)
Definition cl_FEM_DofManagerBase.cpp:161
DofManagerType type() const
Definition cl_FEM_DofManagerBase.hpp:235
DofManagerBase(const DofManagerType aType, Kernel *aParent)
Definition cl_FEM_DofManagerBase.cpp:24
virtual Block * block(const id_t aID)
Definition cl_FEM_DofManagerBase.cpp:72
virtual SideSet * sideset(const id_t aID)
Definition cl_FEM_DofManagerBase.cpp:81
virtual ~DofManagerBase()=default
bool is_master() const
Definition cl_FEM_DofManagerBase.cpp:202
Kernel * parent()
Definition cl_FEM_DofManagerBase.hpp:259
virtual Dof * dof(const id_t aID)
return a specific dof
Definition cl_FEM_DofManagerBase.cpp:36
virtual id_t calculate_dof_id(const mesh::Node *aNode, const uint aDofType) const
Definition cl_FEM_DofManagerBase.cpp:45
virtual IntegrationScheme integration_scheme() const
Definition cl_FEM_DofManagerBase.cpp:126
IWG * iwg()
Definition cl_FEM_DofManagerBase.hpp:267
Vector< real > & field_data(const string &aLabel)
Definition cl_FEM_DofManagerBase.hpp:275
proc_t rank() const
return the rank of this proc ( faster than comm_rank() )
Definition cl_FEM_DofManagerBase.hpp:244
virtual void collect_fields(const Cell< string > &aFieldLabels)
Definition cl_FEM_DofManagerBase.cpp:153
virtual bool sideset_exists(const id_t &aID) const
Definition cl_FEM_DofManagerBase.cpp:144
virtual bool is_initialized() const
true once initialize() has frozen the free/fixed dof split and the matrix graphs; a first fix() of a ...
Definition cl_FEM_DofManagerBase.hpp:224
virtual void write_residuals_to_mesh()
Definition cl_FEM_DofManagerBase.cpp:185
virtual uint block_integration_order() const
Definition cl_FEM_DofManagerBase.cpp:118
virtual void print_worst_dof()
Definition cl_FEM_DofManagerBase.cpp:177
Mesh * mMesh
Definition cl_FEM_DofManagerBase.hpp:53
const proc_t mCommRank
Definition cl_FEM_DofManagerBase.hpp:57
Prototype for Integrator of Weak Form Governing Equation.
Definition cl_IWG.hpp:81
Top-level orchestrator; owns the mesh, materials, boundary conditions and DOF managers.
Definition cl_FEM_Kernel.hpp:50
Definition cl_FEM_SideSet.hpp:60
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Definition cl_Facet.hpp:24
USER GUIDES:
Definition cl_Capacitor.cpp:16
IntegrationScheme
Definition en_IntegrationScheme.hpp:22
unsigned int uint
Definition typedefs.hpp:30
unsigned int id_t
Definition typedefs.hpp:41
DofManagerType
Definition cl_FEM_DofManagerBase.hpp:25
@ NEW
Definition cl_FEM_DofManagerBase.hpp:27
@ OLD
Definition cl_FEM_DofManagerBase.hpp:26
int proc_t
Definition commtypes.hpp:29
Definition Node.py:1
Definition __init__.py:1