BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_ProtoMesh.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_MESHDATA_HPP
13#define BELFEM_CL_MESHDATA_HPP
14
15#include "typedefs.hpp"
16#include "cl_Cell.hpp"
17#include "cl_Matrix.hpp"
18#include "cl_Map.hpp"
19#include "Mesh_Enums.hpp"
20#include "cl_Node.hpp"
21#include "cl_Edge.hpp"
22#include "cl_Face.hpp"
23#include "cl_Element.hpp"
24#include "cl_Block.hpp"
25#include "cl_SideSet.hpp"
26#include "cl_ThinShell.hpp"
27
28#include "st_ProtoMesh.hpp"
29
30namespace belfem
31{
32 class Mesh ;
33
34 namespace mesh
35 {
36//------------------------------------------------------------------------------
37
39 {
40 Mesh * mMesh = nullptr ;
41
42 proto::MetaData * mMetaData = nullptr ;
43 proto::NodeData * mNodeData = nullptr ;
44 proto::ElementData * mElementData = nullptr ;
45
46 proto::EdgeData * mEdgeData = nullptr ;
47 proto::FaceData * mFaceData = nullptr ;
48 proto::FacetData * mFacetData = nullptr ;
49
50 proto::ElementExtra * mElementExtra = nullptr ;
51 proto::FacetExtra * mFacetExtra = nullptr ;
52
53 proto::ElementData * mVertexData = nullptr ;
54 proto::ControlPointData * mControlPointData = nullptr ;
55 proto::PeriodicityData * mPeriodicityData = nullptr ;
56 proto::TMatrixData * mTMatrixData = nullptr ;
57
58 Cell< proto::GroupData > mBlockData ;
59 Cell< proto::GroupData > mSideSetData ;
60 Cell< proto::ThinShellData > mThinShellData ;
61
62 Map< id_t, Node * > mNodeMap ;
63 Map< id_t, Element * > mElementMap ;
64 Map< id_t, Edge * > mEdgeMap ;
65
66 Map< id_t, Face * > mFaceMap ;
67 Map< id_t, Facet * > mFacetMap ;
68 Map< id_t, Element * > mVertexMap ;
69 Map< id_t, Block * > mBlockMap ;
70 Map< id_t, SideSet * > mSideSetMap ;
71 Map< id_t, ThinShell * > mThinShellMap ;
72 Map< id_t, ControlPoint * > mControlPointMap ;
73
74//------------------------------------------------------------------------------
75 public:
76//------------------------------------------------------------------------------
77
78 ProtoMesh( Mesh * aMesh );
79
80 ~ProtoMesh();
81
83 block_data();
84
86 block_data( const index_t aIndex );
87
90
92 sideset_data( const index_t aIndex );
93
96
98 thin_shell_data( const index_t aIndex );
99
101 meta_data();
102
104 node_data();
105
107 element_data();
108
110 edge_data();
111
113 face_data();
114
116 facet_data();
117
119 vertex_data();
120
123
125 facet_extra();
126
129
132
135
136//------------------------------------------------------------------------------
137
138 void
139 create_nodes();
140
141 void
143
144 void
145 create_edges();
146
147 void
148 create_faces();
149
150 void
152
153 void
155
156 void
158
159 void
161
162 void
164
165 void
166 edge();
167
168 // aKeepEmpty: the distributor drops sidesets with no facets on this proc,
169 // but the BFM loader must keep them ( input domain types are re-applied
170 // by id on reload, and thin-shell source sidesets are empty by design )
171 void
172 create_sidesets( const bool aKeepEmpty = false );
173
174 void
176
177 void
178 create_periodicitiy( const bool aCrosslinkEntities = false );
179
180 void
182
183//------------------------------------------------------------------------------
184
185 void
187
188 void
190
191 void
193
194 void
196
197 void
198 populate_element_data( const bool aPopulateTopology, const bool aPopulateGeo );
199
200 void
201 populate_facet_data( const bool aPopulateElements, const bool aPopulateTopology, const bool aPopulateGeo );
202
203 void
204 populate_edge_data( const bool aPopulateTopology );
205
206 void
207 populate_face_data( const bool aPopulateElements );
208
209 void
210 populate_control_point_data( const bool aPopulateTopology );
211
212//------------------------------------------------------------------------------
213
214 void
216
219 void
221
222 void
224
225//------------------------------------------------------------------------------
226
227 void
229
230 void
232
233 void
235
236 void
238
239 void
241
242 void
244
245 void
247
248//------------------------------------------------------------------------------
249
250 Block *
251 block( const id_t aID );
252
253 SideSet *
254 sideset( const id_t aID );
255
256 Node *
257 node( const id_t aID );
258
259 Edge *
260 edge( const id_t aID );
261
262 Face *
263 face( const id_t aID ) ;
264
265 Facet *
266 facet( const id_t aID ) ;
267
268 Element *
269 element( const id_t aID ) ;
270
272 control_point( const id_t aID );
273
274 Basis *
275 basis( const EntityType aType, const id_t aID );
276
277 };
278
279//------------------------------------------------------------------------------
280
281 inline proto::MetaData *
283 {
284 return mMetaData ;
285 }
286
289 {
290 return mBlockData ;
291 }
292
293 inline proto::GroupData &
295 {
296 return mBlockData( aIndex );
297 }
298
301 {
302 return mSideSetData ;
303 }
304
305 inline proto::GroupData &
307 {
308 return mSideSetData( aIndex );
309 }
310
311 inline Block *
313 {
314 return mBlockMap( aID );
315 }
316
317 inline SideSet *
319 {
320 return mSideSetMap( aID );
321 }
322
325 {
326 return mThinShellData ;
327 }
328
329 inline proto::ThinShellData &
331 {
332 return mThinShellData( aIndex );
333 }
334
335
336 inline proto::NodeData *
338 {
339 return mNodeData ;
340 }
341
342 inline proto::ElementData *
344 {
345 return mElementData ;
346 }
347
348 inline proto::EdgeData *
350 {
351 return mEdgeData ;
352 }
353
354 inline proto::FaceData *
356 {
357 return mFaceData ;
358 }
359
360 inline proto::FacetData *
362 {
363 return mFacetData ;
364 }
365
366 inline proto::ElementExtra *
368 {
369 return mElementExtra ;
370 }
371
372 inline proto::FacetExtra *
374 {
375 return mFacetExtra ;
376 }
377
378 inline proto::ElementData *
380 {
381 return mVertexData ;
382 }
383
386 {
387 return mControlPointData ;
388 }
389
392 {
393 return mPeriodicityData ;
394 }
395
396 inline proto::TMatrixData *
398 {
399 return mTMatrixData ;
400 }
401
402 inline Node *
404 {
405 return mNodeMap( aID );
406 }
407
408 inline Edge *
410 {
411 return mEdgeMap( aID );
412 }
413
414 inline Face *
416 {
417 return mFaceMap( aID );
418 }
419
420 inline Facet *
422 {
423 return mFacetMap( aID );
424 }
425
426 inline Element *
428 {
429 return mElementMap( aID );
430 }
431
432 inline ControlPoint *
434 {
435 return mControlPointMap( aID );
436 }
437
438 inline Basis *
439 ProtoMesh::basis( const EntityType aType, const id_t aID )
440 {
441 switch ( aType )
442 {
443 case EntityType::NODE :
444 {
445 return mNodeMap( aID );
446 }
447 case EntityType::EDGE :
448 {
449 return mEdgeMap( aID );
450 }
451 case EntityType::FACE :
452 {
453 return mFaceMap( aID );
454 }
455 case EntityType::FACET :
456 {
457 return mFacetMap( aID );
458 }
460 {
461 return mElementMap( aID );
462 }
464 {
465 return mControlPointMap( aID );
466 }
467 default:
468 {
469 BELFEM_ERROR( false, "unsupported entity type" );
470 return nullptr ;
471 }
472 }
473 }
474
475 }
476}
477#endif //BELFEM_CL_MESHDATA_HPP
#define BELFEM_ERROR(aCheck,...)
Definition assert.hpp:264
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Hash map (unordered key-value).
Definition cl_Map.hpp:75
Top-level container for all mesh entities.
Definition cl_Mesh.hpp:60
Definition cl_Mesh_Basis.hpp:33
Definition cl_Block.hpp:27
Definition cl_ControlPoint.hpp:27
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Lagrange Element baseclass.
Definition cl_Element.hpp:35
Definition cl_Face.hpp:29
Definition cl_Facet.hpp:24
Definition cl_Node.hpp:30
void create_sidesets(const bool aKeepEmpty=false)
Definition cl_ProtoMesh.cpp:1393
Cell< proto::GroupData > & block_data()
Definition cl_ProtoMesh.hpp:288
void create_facets()
Definition cl_ProtoMesh.cpp:939
void populate_face_data(const bool aPopulateElements)
Definition cl_ProtoMesh.cpp:572
proto::MetaData * meta_data()
Definition cl_ProtoMesh.hpp:282
void reset_edge_data()
Definition cl_ProtoMesh.cpp:699
void populate_block_data()
Definition cl_ProtoMesh.cpp:1255
Cell< proto::ThinShellData > & thin_shell_data()
Definition cl_ProtoMesh.hpp:324
void populate_sideset_data()
Definition cl_ProtoMesh.cpp:1277
void reset_element_data()
Definition cl_ProtoMesh.cpp:684
void create_t_matrices()
Definition cl_ProtoMesh.cpp:1548
void reconstruct_face_connectivity()
Definition cl_ProtoMesh.cpp:1857
Facet * facet(const id_t aID)
Definition cl_ProtoMesh.hpp:421
void populate_control_point_data(const bool aPopulateTopology)
Definition cl_ProtoMesh.cpp:621
void populate_edge_data(const bool aPopulateTopology)
Definition cl_ProtoMesh.cpp:536
void create_control_points()
Definition cl_ProtoMesh.cpp:1087
Cell< proto::GroupData > & sideset_data()
Definition cl_ProtoMesh.hpp:300
proto::FacetExtra * facet_extra()
Definition cl_ProtoMesh.hpp:373
void create_faces()
Definition cl_ProtoMesh.cpp:876
proto::TMatrixData * t_matrix_data()
Definition cl_ProtoMesh.hpp:397
proto::ElementData * vertex_data()
Definition cl_ProtoMesh.hpp:379
void create_elements()
Definition cl_ProtoMesh.cpp:728
proto::FacetData * facet_data()
Definition cl_ProtoMesh.hpp:361
proto::PeriodicityData * periodicity_data()
Definition cl_ProtoMesh.hpp:391
void reset_node_data()
Definition cl_ProtoMesh.cpp:268
Element * element(const id_t aID)
Definition cl_ProtoMesh.hpp:427
proto::ElementExtra * element_extra()
Definition cl_ProtoMesh.hpp:367
Block * block(const id_t aID)
Definition cl_ProtoMesh.hpp:312
proto::ControlPointData * control_point_data()
Definition cl_ProtoMesh.hpp:385
void populate_meta_data()
Definition cl_ProtoMesh.cpp:102
void reset_control_point_data()
Definition cl_ProtoMesh.cpp:713
void create_vertices()
Definition cl_ProtoMesh.cpp:1058
void populate_facet_data(const bool aPopulateElements, const bool aPopulateTopology, const bool aPopulateGeo)
Definition cl_ProtoMesh.cpp:377
Basis * basis(const EntityType aType, const id_t aID)
Definition cl_ProtoMesh.hpp:439
void reset_periodicity_data()
Definition cl_ProtoMesh.cpp:719
proto::FaceData * face_data()
Definition cl_ProtoMesh.hpp:355
void reset_facet_data()
Definition cl_ProtoMesh.cpp:692
Node * node(const id_t aID)
Definition cl_ProtoMesh.hpp:403
proto::EdgeData * edge_data()
Definition cl_ProtoMesh.hpp:349
void normalize_edge_hangs()
Definition cl_ProtoMesh.cpp:1785
void populate_element_data(const bool aPopulateTopology, const bool aPopulateGeo)
Definition cl_ProtoMesh.cpp:278
Face * face(const id_t aID)
Definition cl_ProtoMesh.hpp:415
ControlPoint * control_point(const id_t aID)
Definition cl_ProtoMesh.hpp:433
ProtoMesh(Mesh *aMesh)
Definition cl_ProtoMesh.cpp:23
void populate_node_data()
Definition cl_ProtoMesh.cpp:129
proto::ElementData * element_data()
Definition cl_ProtoMesh.hpp:343
proto::NodeData * node_data()
Definition cl_ProtoMesh.hpp:337
void create_thinshells()
Definition cl_ProtoMesh.cpp:1463
void reconstruct_edge_connectivity()
Definition cl_ProtoMesh.cpp:1656
SideSet * sideset(const id_t aID)
Definition cl_ProtoMesh.hpp:318
void create_element_extra()
Definition cl_ProtoMesh.cpp:1134
void create_periodicitiy(const bool aCrosslinkEntities=false)
Definition cl_ProtoMesh.cpp:1538
void edge()
Definition cl_ProtoMesh.cpp:1297
void create_edges()
Definition cl_ProtoMesh.cpp:818
void create_nodes()
Definition cl_ProtoMesh.cpp:174
void create_facet_extra()
Definition cl_ProtoMesh.cpp:1220
void reset_face_data()
Definition cl_ProtoMesh.cpp:706
Definition cl_SideSet.hpp:29
Definition cl_EF_EdgeFunction.hpp:17
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int id_t
Definition typedefs.hpp:41
EntityType
Definition Mesh_Enums.hpp:116
@ NODE
Definition Mesh_Enums.hpp:117
@ FACE
Definition Mesh_Enums.hpp:119
@ CONTROLPOINT
Definition Mesh_Enums.hpp:123
@ EDGE
Definition Mesh_Enums.hpp:118
@ FACET
Definition Mesh_Enums.hpp:121
@ ELEMENT
Definition Mesh_Enums.hpp:122
uint32_t index_t
Definition typedefs.hpp:52
Definition st_ProtoMesh.hpp:60
Definition st_ProtoMesh.hpp:97
Definition st_ProtoMesh.hpp:78
Definition st_ProtoMesh.hpp:88
Definition st_ProtoMesh.hpp:104
Definition st_ProtoMesh.hpp:115
Definition st_ProtoMesh.hpp:123
Definition st_ProtoMesh.hpp:147
Definition st_ProtoMesh.hpp:29
Definition st_ProtoMesh.hpp:52
Definition st_ProtoMesh.hpp:164
Definition st_ProtoMesh.hpp:68
Definition st_ProtoMesh.hpp:129