BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_SideSet.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_SIDESET_HPP
13#define BELFEM_CL_SIDESET_HPP
14
15#include "typedefs.hpp"
16#include "cl_Cell.hpp"
17#include "cl_Element.hpp"
18#include "cl_Facet.hpp"
19#include "cl_Map.hpp"
20#include "en_DomainType.hpp"
21
22namespace belfem
23{
24 namespace mesh
25 {
26 class GmshReader;
27
28 class SideSet
29 {
30//------------------------------------------------------------------------------
31 protected:
32//------------------------------------------------------------------------------
33
36
38
40
41 string mLabel;
42
45
46 friend GmshReader;
47
48 // this flag hides the sideset from exodus
49 bool mIsHidden = false ;
50
51//------------------------------------------------------------------------------
52 public:
53//------------------------------------------------------------------------------
54
55 SideSet( const id_t aID, const index_t aNumElements );
56
57//------------------------------------------------------------------------------
58
59 ~SideSet();
60
61//------------------------------------------------------------------------------
62
63 id_t
64 id() const;
65
66//------------------------------------------------------------------------------
67
69 index() const ;
70
71 void
72 set_index( const index_t aIndex ) ;
73//------------------------------------------------------------------------------
74
75 string &
76 label();
77
78//------------------------------------------------------------------------------
79
80 void
81 insert_facet( Facet * aFacet );
82
83//------------------------------------------------------------------------------
84
85 Facet *
86 facet_by_index( const index_t aIndex );
87
88//------------------------------------------------------------------------------
89
90 //Facet *
91 //facet( const id_t aID );
92
93//------------------------------------------------------------------------------
94
95 Cell < Facet * > &
96 facets();
97
98//------------------------------------------------------------------------------
99
100 index_t
101 number_of_facets() const;
102
103//------------------------------------------------------------------------------
104
105 void
107
108//------------------------------------------------------------------------------
109
110 void
112
113//------------------------------------------------------------------------------
114
115 void
117
118//------------------------------------------------------------------------------
119
120 void
122
123//------------------------------------------------------------------------------
124
125 void
127
128//------------------------------------------------------------------------------
129
130 void
131 flag_edges();
132
133//------------------------------------------------------------------------------
134
135 void
136 unflag_edges();
137
138//------------------------------------------------------------------------------
139
140 void
141 flag_faces();
142
143//------------------------------------------------------------------------------
144
145 void
146 unflag_faces();
147
148//------------------------------------------------------------------------------
149
150 void
151 collect_nodes() ;
152
153//------------------------------------------------------------------------------
154
160 nodes() ;
161
162//------------------------------------------------------------------------------
163
164 void
166
167//------------------------------------------------------------------------------
168
169 void
171
172//------------------------------------------------------------------------------
173
175 element_type() const ;
176
177//------------------------------------------------------------------------------
178
179 void
180 hide( const bool aSwitch = true );
181
182//------------------------------------------------------------------------------
183
184 bool
185 is_hidden() const ;
186
187//------------------------------------------------------------------------------
188
190 domain_type() const ;
191
192 void
193 set_domain_type( const DomainType aType );
194
195 void
196 set_facet_counter( const index_t aCounter );
197
198 size_t
199 memory() const ;
200
201//------------------------------------------------------------------------------
202 };
203
204//------------------------------------------------------------------------------
205
206 inline id_t
208 {
209 return mID;
210 }
211
212//------------------------------------------------------------------------------
213
214 inline index_t
216 {
217 return mIndex;
218 }
219
220//------------------------------------------------------------------------------
221
222 inline void
224 {
225 mIndex = aIndex ;
226 }
227
228//------------------------------------------------------------------------------
229
230 inline Facet *
232 {
233 BELFEM_ASSERT( aIndex < mFacets.size(),
234 "Invalid Facet index" );
235
236 return mFacets( aIndex );
237 }
238
239//------------------------------------------------------------------------------
240
241 inline index_t
243 {
244 return mFacets.size();
245 }
246
247//------------------------------------------------------------------------------
248
249 inline string &
251 {
252 return mLabel;
253 }
254
255//------------------------------------------------------------------------------
256
257 inline Cell < Facet * > &
259 {
260 return mFacets;
261 }
262
263//------------------------------------------------------------------------------
264
265 inline Cell < Node * > &
267 {
268 return mNodes;
269 }
270
271//------------------------------------------------------------------------------
272
273 inline ElementType
275 {
276 if( mFacets.size() == 0 )
277 {
278 return ElementType::EMPTY ;
279 }
280 else
281 {
282 return mFacets( 0 )->element()->type() ;
283 }
284 }
285
286//------------------------------------------------------------------------------
287
288 inline void
289 SideSet::hide( const bool aSwitch )
290 {
291 mIsHidden = aSwitch ;
292 }
293
294//------------------------------------------------------------------------------
295
296 inline bool
298 {
299 return mIsHidden ;
300 }
301
302//------------------------------------------------------------------------------
303
304 inline DomainType
306 {
307 return mDomainType ;
308 }
309
310//------------------------------------------------------------------------------
311
312 inline
314 {
315 mDomainType = aType ;
316 }
317
318//------------------------------------------------------------------------------
319
320 inline void SideSet::set_facet_counter( const index_t aCounter )
321 {
322 mFacetCounter = aCounter ;
323 }
324
325//------------------------------------------------------------------------------
326
327 inline size_t SideSet::memory() const
328 {
329 return sizeof( SideSet )
330 + mFacets.size() * sizeof( Facet * )
331 + mNodes.size() * sizeof( Node * )
332 + mLabel.capacity() * sizeof( char ) ;
333 }
334
335//------------------------------------------------------------------------------
336 }
337}
338#endif //BELFEM_CL_SIDESET_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
Cell is a wrapper around the standard vector.
Definition cl_Cell.hpp:42
Definition cl_Facet.hpp:24
Definition cl_Mesh_GmshReader.hpp:40
Definition cl_Node.hpp:30
void flag_all_nodes()
Definition cl_SideSet.cpp:67
void set_facet_counter(const index_t aCounter)
Definition cl_SideSet.hpp:320
DomainType mDomainType
Definition cl_SideSet.hpp:39
index_t mIndex
Definition cl_SideSet.hpp:35
Cell< Facet * > & facets()
Definition cl_SideSet.hpp:258
void flag_all_facets()
Definition cl_SideSet.cpp:100
Cell< Node * > mNodes
Definition cl_SideSet.hpp:44
void set_index(const index_t aIndex)
Definition cl_SideSet.hpp:223
id_t id() const
Definition cl_SideSet.hpp:207
bool mIsHidden
Definition cl_SideSet.hpp:49
void flag_faces()
Definition cl_SideSet.cpp:133
Cell< Node * > & nodes()
expose list with all nodes on sideset
Definition cl_SideSet.hpp:266
void unflag_faces()
Definition cl_SideSet.cpp:144
size_t memory() const
Definition cl_SideSet.hpp:327
DomainType domain_type() const
Definition cl_SideSet.hpp:305
void hide(const bool aSwitch=true)
Definition cl_SideSet.hpp:289
void unflag_all_nodes()
Definition cl_SideSet.cpp:56
id_t mID
Definition cl_SideSet.hpp:34
Facet * facet_by_index(const index_t aIndex)
Definition cl_SideSet.hpp:231
friend GmshReader
Definition cl_SideSet.hpp:46
SideSet(const id_t aID, const index_t aNumElements)
Definition cl_SideSet.cpp:21
void reset_facet_container()
Definition cl_SideSet.cpp:205
string & label()
Definition cl_SideSet.hpp:250
Cell< Facet * > mFacets
Definition cl_SideSet.hpp:43
void flag_corner_nodes()
Definition cl_SideSet.cpp:78
void reset_node_container()
Definition cl_SideSet.cpp:197
void flag_edges()
Definition cl_SideSet.cpp:111
index_t mFacetCounter
Definition cl_SideSet.hpp:37
void insert_facet(Facet *aFacet)
Definition cl_SideSet.cpp:45
index_t index() const
Definition cl_SideSet.hpp:215
bool is_hidden() const
Definition cl_SideSet.hpp:297
void collect_nodes()
Definition cl_SideSet.cpp:155
void set_domain_type(const DomainType aType)
Definition cl_SideSet.hpp:313
index_t number_of_facets() const
Definition cl_SideSet.hpp:242
ElementType element_type() const
Definition cl_SideSet.hpp:274
void unflag_all_facets()
Definition cl_SideSet.cpp:89
string mLabel
Definition cl_SideSet.hpp:41
void unflag_edges()
Definition cl_SideSet.cpp:122
Definition cl_EF_EdgeFunction.hpp:17
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int id_t
Definition typedefs.hpp:41
ElementType
Element types.
Definition Mesh_Enums.hpp:27
@ EMPTY
Definition Mesh_Enums.hpp:28
constexpr index_t gNoIndex
Definition typedefs.hpp:57
uint32_t index_t
Definition typedefs.hpp:52
DomainType
Definition en_DomainType.hpp:20
@ Default
Definition en_DomainType.hpp:21