BELFEM 0.9.3
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
91//------------------------------------------------------------------------------
92
93 Cell < Facet * > &
94 facets();
95
96//------------------------------------------------------------------------------
97
99 number_of_facets() const;
100
101//------------------------------------------------------------------------------
102
103 void
105
106//------------------------------------------------------------------------------
107
108 void
110
111//------------------------------------------------------------------------------
112
113 void
115
116//------------------------------------------------------------------------------
117
118 void
120
121//------------------------------------------------------------------------------
122
123 void
125
126//------------------------------------------------------------------------------
127
128 void
129 flag_edges();
130
131//------------------------------------------------------------------------------
132
133 void
134 unflag_edges();
135
136//------------------------------------------------------------------------------
137
138 void
139 flag_faces();
140
141//------------------------------------------------------------------------------
142
143 void
144 unflag_faces();
145
146//------------------------------------------------------------------------------
147
148 void
149 collect_nodes() ;
150
151//------------------------------------------------------------------------------
152
158 nodes() ;
159
160//------------------------------------------------------------------------------
161
162 void
164
165//------------------------------------------------------------------------------
166
167 void
169
170//------------------------------------------------------------------------------
171
173 element_type() const ;
174
175//------------------------------------------------------------------------------
176
177 void
178 hide( const bool aSwitch = true );
179
180//------------------------------------------------------------------------------
181
182 bool
183 is_hidden() const ;
184
185//------------------------------------------------------------------------------
186
188 domain_type() const ;
189
190 void
191 set_domain_type( const DomainType aType );
192
193 void
194 set_facet_counter( const index_t aCounter );
195
196 size_t
197 memory() const ;
198
199//------------------------------------------------------------------------------
200 };
201
202//------------------------------------------------------------------------------
203
204 inline id_t
206 {
207 return mID;
208 }
209
210//------------------------------------------------------------------------------
211
212 inline index_t
214 {
215 return mIndex;
216 }
217
218//------------------------------------------------------------------------------
219
220 inline void
222 {
223 mIndex = aIndex ;
224 }
225
226//------------------------------------------------------------------------------
227
228 inline Facet *
230 {
231 BELFEM_ASSERT( aIndex < mFacets.size(),
232 "Invalid Facet index" );
233
234 return mFacets( aIndex );
235 }
236
237//------------------------------------------------------------------------------
238
239 inline index_t
241 {
242 return mFacets.size();
243 }
244
245//------------------------------------------------------------------------------
246
247 inline string &
249 {
250 return mLabel;
251 }
252
253//------------------------------------------------------------------------------
254
255 inline Cell < Facet * > &
257 {
258 return mFacets;
259 }
260
261//------------------------------------------------------------------------------
262
263 inline Cell < Node * > &
265 {
266 return mNodes;
267 }
268
269//------------------------------------------------------------------------------
270
271 inline ElementType
273 {
274 if( mFacets.size() == 0 )
275 {
276 return ElementType::EMPTY ;
277 }
278 else
279 {
280 return mFacets( 0 )->element()->type() ;
281 }
282 }
283
284//------------------------------------------------------------------------------
285
286 inline void
287 SideSet::hide( const bool aSwitch )
288 {
289 mIsHidden = aSwitch ;
290 }
291
292//------------------------------------------------------------------------------
293
294 inline bool
296 {
297 return mIsHidden ;
298 }
299
300//------------------------------------------------------------------------------
301
302 inline DomainType
304 {
305 return mDomainType ;
306 }
307
308//------------------------------------------------------------------------------
309
310 inline
312 {
313 mDomainType = aType ;
314 }
315
316//------------------------------------------------------------------------------
317
318 inline void SideSet::set_facet_counter( const index_t aCounter )
319 {
320 mFacetCounter = aCounter ;
321 }
322
323//------------------------------------------------------------------------------
324
325 inline size_t SideSet::memory() const
326 {
327 return sizeof( SideSet )
328 + mFacets.size() * sizeof( Facet * )
329 + mNodes.size() * sizeof( Node * )
330 + mLabel.capacity() * sizeof( char ) ;
331 }
332
333//------------------------------------------------------------------------------
334 }
335}
336#endif //BELFEM_CL_SIDESET_HPP
#define BELFEM_ASSERT(aCheck,...)
Definition assert.hpp:244
A bounds-checked wrapper around std::vector.
Definition cl_Cell.hpp:45
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:318
DomainType mDomainType
Definition cl_SideSet.hpp:39
index_t mIndex
Definition cl_SideSet.hpp:35
Cell< Facet * > & facets()
Definition cl_SideSet.hpp:256
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:221
id_t id() const
Definition cl_SideSet.hpp:205
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:264
void unflag_faces()
Definition cl_SideSet.cpp:144
size_t memory() const
Definition cl_SideSet.hpp:325
DomainType domain_type() const
Definition cl_SideSet.hpp:303
void hide(const bool aSwitch=true)
Definition cl_SideSet.hpp:287
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:229
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:248
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:213
bool is_hidden() const
Definition cl_SideSet.hpp:295
void collect_nodes()
Definition cl_SideSet.cpp:155
void set_domain_type(const DomainType aType)
Definition cl_SideSet.hpp:311
index_t number_of_facets() const
Definition cl_SideSet.hpp:240
ElementType element_type() const
Definition cl_SideSet.hpp:272
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:24
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