BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_ThinShell.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 CL_FEM_THINSHELL_HPP
13#define CL_FEM_THINSHELL_HPP
14
15#include "cl_Block.hpp"
16#include "cl_Facet.hpp"
17#include "cl_SideSet.hpp"
18
19
20namespace belfem
21{
22 namespace mesh
23 {
24 class ThinShellFactory ;
25
31 {
32 // facets that are connected to the elements
33 // in the same order as the elements in the blocks
34 // this is needed later to link the air elements
35 // with the shell elements in the FEM kernel
36 // sideset is destroyed by mesh
37 SideSet * mSideSet ;
38
39 SideSet * mGhostSideSet ;
40
41 Cell< Facet * > & mFacets ;
42
43 // blocks that contain the thin shell elements
44 // each block represents one layer
45 // blocks are destroyed by mesh
46 Cell< Block * > mBlocks ;
47
48 Vector< real > mThicknesses ;
49
50 Cell< string > mMaterials;
51
52 // node indices, needed for hanging dofs
53 Cell< index_t > mNodeIndices ;
54
55 // empty cell, needed as dummy output
56 Cell< Facet * > mNull ;
57
58 // Blocks for side connectors
59 Cell< Block * > mSideConnectorBlocks ;
60
61 // additional nodes
62 Cell< Node * > mSideConnectorNodes ;
63
64 // additional edges
65 Cell< Edge * > mSideConnectorEdges ;
66
67 Cell< SideSet * > mSideConnectorSideSets ;
68
69
70 // map: side-connector element id -> adjacent shell facet id.
71 // Currently unpopulated: it has no producer and no consumer in
72 // the tree; kept for the post-processor's perpendicular-H
73 // recovery path.
74 Map< id_t, std::pair< id_t, id_t > > mConnectorFacetMap ;
75
76 friend class ThinShellFactory ;
77
78//------------------------------------------------------------------------------
79 public :
80//------------------------------------------------------------------------------
81
82 ThinShell( SideSet * aSideSet, SideSet * aGhostSideSet ) ;
83
84 ~ThinShell() = default ;
85
86 void
87 set_thicknesses( const Vector < real > & aThicknesses );
88
89 void
90 move_node_indices( Cell< index_t > & aNodeIndices ) ;
91
92 void
93 set_label( const string & aLabel ) ;
94
96 facets() ;
97
99 blocks() ;
100
101 void
102 set_materials( const Cell< string > & aMaterials ) ;
103
104 const Cell< string > &
105 materials() const ;
106
108 element_type() const ;
109
110 const Vector< real > &
111 thicknesses() const ;
112
113 const string &
114 label() const ;
115
116 id_t
117 id() const ;
118
119 id_t
120 ghost_id() const ;
121
122 size_t
123 memory() const ;
124
126 node_indices() ;
127
129 ghost_facets();
130
133
136
139
141 connector_facet_map() const;
142
145
146 const Map< id_t, real > &
148
149 private:
150
151
153 side_connector_nodes();
154
156 side_connector_edges();
157
158//------------------------------------------------------------------------------
159 };
160//------------------------------------------------------------------------------
161
162 inline id_t
164 {
165 if ( mGhostSideSet != nullptr )
166 {
167 return mGhostSideSet->id();
168 }
169 else
170 {
171 return gNoID ;
172 }
173 }
174
175 inline Cell< Facet * > &
177 {
178 return mFacets ;
179 }
180
181//------------------------------------------------------------------------------
182
183 inline Cell< Facet * > &
185 {
186 if ( mGhostSideSet != nullptr )
187 {
188 return mGhostSideSet->facets();
189 }
190 else
191 {
192 return mNull ;
193 }
194 }
195
196//------------------------------------------------------------------------------
197
198 inline Cell< Block * > &
200 {
201 return mBlocks ;
202 }
203
204//------------------------------------------------------------------------------
205
206 inline void
208 {
209 BELFEM_ERROR( aMaterials.size() == mBlocks.size(),
210 "size of materials must match number of blocks (%u vs %u)",
211 ( unsigned int ) aMaterials.size(), ( unsigned int ) mBlocks.size()
212 ) ;
213
214 mMaterials = aMaterials ;
215 }
216
217//------------------------------------------------------------------------------
218
219 inline const Cell< string > &
221 {
222 return mMaterials ;
223 }
224
225 inline ElementType
227 {
228 return mSideSet->element_type() ;
229 }
230
231 inline const Vector< real > &
233 {
234 return mThicknesses ;
235 }
236
237 inline const string &
239 {
240 return mSideSet->label() ;
241 }
242
243 inline id_t
245 {
246 return mSideSet->id() ;
247 }
248
249 inline size_t
251 {
252 size_t aMem = sizeof( ThinShell )
253 + mBlocks.size() * sizeof( Block * )
254 + mThicknesses.length() * sizeof( real ) ;
255
256 // account for material strings
257 for( const string & tMaterial : mMaterials )
258 {
259 aMem += sizeof( string ) + tMaterial.capacity() * sizeof( char );
260 }
261
262 return aMem ;
263 }
264
267 {
268 return mConnectorFacetMap ;
269 }
270
273 {
274 return mConnectorFacetMap ;
275 }
276
277 inline Cell< index_t > &
279 {
280 return mNodeIndices ;
281 }
282
283 inline Cell< Block * > &
285 {
286 return mSideConnectorBlocks ;
287 }
288
289 inline Cell< SideSet * > &
291 {
292 return mSideConnectorSideSets ;
293 }
294
295 inline Cell< Node * > &
296 ThinShell::side_connector_nodes()
297 {
298 return mSideConnectorNodes ;
299 }
300
301 inline Cell< Edge * > &
302 ThinShell::side_connector_edges()
303 {
304 return mSideConnectorEdges ;
305 }
306
307//------------------------------------------------------------------------------
308
309 }
310}
311#endif //CL_FEM_THINSHELL_HPP
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
size_t size() const
return the size of the Cell
Definition cl_Cell.hpp:181
Hash map (unordered key-value).
Definition cl_Map.hpp:75
Definition cl_Block.hpp:27
Definition cl_SideSet.hpp:29
Definition cl_ThinShellFactory.hpp:26
const string & label() const
Definition cl_ThinShell.hpp:238
friend class ThinShellFactory
Definition cl_ThinShell.hpp:76
Cell< index_t > & node_indices()
Definition cl_ThinShell.hpp:278
Cell< Block * > & side_connector_blocks()
Definition cl_ThinShell.hpp:284
Map< id_t, std::pair< id_t, id_t > > & connector_facet_map()
Definition cl_ThinShell.hpp:266
Cell< Block * > & blocks()
Definition cl_ThinShell.hpp:199
Cell< SideSet * > & side_connector_sidesets()
Definition cl_ThinShell.hpp:290
ElementType element_type() const
Definition cl_ThinShell.hpp:226
id_t ghost_id() const
Definition cl_ThinShell.hpp:163
void set_thicknesses(const Vector< real > &aThicknesses)
Definition cl_ThinShell.cpp:39
const Cell< string > & materials() const
Definition cl_ThinShell.hpp:220
size_t memory() const
Definition cl_ThinShell.hpp:250
void set_materials(const Cell< string > &aMaterials)
Definition cl_ThinShell.hpp:207
Map< id_t, real > & connector_thicknesses()
id_t id() const
Definition cl_ThinShell.hpp:244
void move_node_indices(Cell< index_t > &aNodeIndices)
Definition cl_ThinShell.cpp:56
void set_label(const string &aLabel)
Definition cl_ThinShell.cpp:33
ThinShell(SideSet *aSideSet, SideSet *aGhostSideSet)
Definition cl_ThinShell.cpp:17
Cell< Facet * > & facets()
Definition cl_ThinShell.hpp:176
Cell< Facet * > & ghost_facets()
Definition cl_ThinShell.hpp:184
const Map< id_t, real > & connector_thicknesses() const
const Vector< real > & thicknesses() const
Definition cl_ThinShell.hpp:232
Definition cl_EF_EdgeFunction.hpp:17
USER GUIDES:
Definition cl_Capacitor.cpp:16
std::string string
Definition typedefs.hpp:26
constexpr id_t gNoID
Definition typedefs.hpp:58
unsigned int id_t
Definition typedefs.hpp:41
ElementType
Element types.
Definition Mesh_Enums.hpp:27
double real
Definition typedefs.hpp:36