BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Curve.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_CURVE_HPP
13#define CL_CURVE_HPP
14
15#include "typedefs.hpp"
16#include "cl_Cell.hpp"
17
18#include "cl_Segment.hpp"
19#include "cl_SideSet.hpp"
20
21
22namespace belfem
23{
24 namespace mesh
25 {
26 class Curve
27 {
28 const id_t mID ;
29
30 string mLabel = "curve";
31
32 SideSet * mSideSetA ;
33 SideSet * mSideSetB ;
34
35 const ElementType mElementType ;
36
37 Cell< Segment * > mSegments ;
38 Cell< Node * > mNodes;
39 Cell< Edge * > mEdges ;
40
41 // flag telling if this loop is closed
42 bool mIsClosed ;
43
44 // length coordinate associated with each node
46
47 friend class BfmFile ;
48
49 public :
50
51 Curve( const id_t aID, SideSet * aSideSetA, SideSet * aSideSetB );
52
53 Curve( const id_t aID, const ElementType aElementType );
54
55 ~Curve();
56
57 id_t
58 id() const ;
59
61 element_type() const ;
62
64 nodes() ;
65
66 const Cell< Node * > &
67 nodes() const ;
68
69 Node *
70 first() ;
71
72 const Node *
73 first() const ;
74
75 Node *
76 last() ;
77
78 const Node *
79 last() const ;
80
82 segments() ;
83
84 const Cell< Segment * > &
85 segments() const ;
86
87 SideSet *
88 sideset_a() ;
89
90 SideSet *
91 sideset_b() ;
92
93 void
94 sideset_a( SideSet * aSideset) ;
95
96 void
97 sideset_b( SideSet * aSideset) ;
98
99 bool
100 is_closed() const ;
101
102 bool
103 is_terminal() const ;
104
105 void
106 set_closed_flag( const bool aSwitch );
107
108 void
109 save( const std::string & aFileName );
110
112 arclength();
113
114 const Vector< real > &
115 arclength() const ;
116
117 real
118 arclength( const index_t aIndex ) const ;
119
120 real
121 length() const ;
122
123 void
124 reverse();
125
126 string &
127 label() ;
128
129 const string &
130 label() const ;
131
133 edges() ;
134
135 void
136 assign_edges();
137
138 size_t
139 memory() const;
140 };
141
142 inline id_t
143 Curve::id() const
144 {
145 return mID ;
146 }
147
148 inline ElementType
150 {
151 return mElementType ;
152 }
153
154 inline Cell< Node * > &
156 {
157 return mNodes ;
158 }
159
160 inline const Cell< Node * > &
162 {
163 return mNodes ;
164 }
165
166 inline Node *
168 {
169 return mNodes( 0 );
170 }
171
172 inline const Node *
174 {
175 return mNodes( 0 );
176 }
177
178 inline Node *
180 {
181 return mNodes( mNodes.size() -1 );
182 }
183
184 inline const Node *
186 {
187 return mNodes( mNodes.size() -1 );
188 }
189
190 inline Cell< Segment * > &
192 {
193 return mSegments ;
194 }
195
196 inline
197 const Cell< Segment * > &
199 {
200 return mSegments ;
201 }
202
203 inline SideSet *
205 {
206 return mSideSetA ;
207 }
208
209 inline SideSet *
211 {
212 return mSideSetB ;
213 }
214
215 inline bool
217 {
218 return mIsClosed ;
219 }
220
221 inline bool
223 {
224 return mSideSetA != nullptr && mSideSetB != nullptr ;
225 }
226
227 inline void
228 Curve::set_closed_flag( const bool aSwitch )
229 {
230 mIsClosed = aSwitch ;
231 }
232
233 inline Vector< real > &
235 {
236 return mS ;
237 }
238
239 inline const Vector< real > &
241 {
242 return mS ;
243 }
244
245 inline real
246 Curve::arclength( const index_t aIndex ) const
247 {
248 return mS( aIndex );
249 }
250
251 inline real
253 {
254 return mS( mNodes.size() -1 ) - mS( 0 );
255 }
256
257 inline string &
259 {
260 return mLabel ;
261 }
262
263 inline const string &
265 {
266 return mLabel ;
267 }
268
269 inline Cell< Edge * > &
271 {
272 return mEdges ;
273 }
274
275 inline size_t Curve::memory() const
276 {
277 return sizeof( Curve )
278 + mNodes.size() * sizeof( Node * )
279 + mEdges.size() * sizeof( Edge * )
280 + mSegments.size() * sizeof( Segment * )
281 + mS.length() * sizeof( real )
282 + mLabel.capacity() * sizeof( char ) ;
283 }
284
285 }
286}
287#endif //CL_CURVE_HPP
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
Vector< real > & arclength()
Definition cl_Curve.hpp:234
Cell< Edge * > & edges()
Definition cl_Curve.hpp:270
size_t memory() const
Definition cl_Curve.hpp:275
friend class BfmFile
Definition cl_Curve.hpp:47
Node * first()
Definition cl_Curve.hpp:167
SideSet * sideset_a()
Definition cl_Curve.hpp:204
real length() const
Definition cl_Curve.hpp:252
Cell< Node * > & nodes()
Definition cl_Curve.hpp:155
Cell< Segment * > & segments()
Definition cl_Curve.hpp:191
Node * last()
Definition cl_Curve.hpp:179
id_t id() const
Definition cl_Curve.hpp:143
ElementType element_type() const
Definition cl_Curve.hpp:149
SideSet * sideset_b()
Definition cl_Curve.hpp:210
void reverse()
Definition cl_Curve.cpp:125
bool is_closed() const
Definition cl_Curve.hpp:216
void set_closed_flag(const bool aSwitch)
Definition cl_Curve.hpp:228
string & label()
Definition cl_Curve.hpp:258
bool is_terminal() const
Definition cl_Curve.hpp:222
void assign_edges()
Definition cl_Curve.cpp:153
void save(const std::string &aFileName)
Definition cl_Curve.cpp:52
Curve(const id_t aID, SideSet *aSideSetA, SideSet *aSideSetB)
Definition cl_Curve.cpp:23
Special Edge class for NEDELEC-Type elements.
Definition cl_Edge.hpp:30
Definition cl_Node.hpp:30
Definition cl_Segment.hpp:24
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
ElementType
Element types.
Definition Mesh_Enums.hpp:27
uint32_t index_t
Definition typedefs.hpp:52
double real
Definition typedefs.hpp:36