BELFEM 0.9.0
Berkeley Lab Finite Element Framework
Loading...
Searching...
No Matches
cl_Bezier.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_BEZIER_HPP
13#define BELFEM_CL_BEZIER_HPP
14#include "typedefs.hpp"
15#include "cl_Vector.hpp"
16
17namespace belfem
18{
19//------------------------------------------------------------------------------
20
21 enum class BezierType
22 {
25 };
26
27//------------------------------------------------------------------------------
28
29 class Bezier
30 {
31 // X-coordinates
33
34 // Y-Coordinates
36
37 // Work vector
38 mutable Vector< real > mWork ;
39
40
41//------------------------------------------------------------------------------
42 public:
43//------------------------------------------------------------------------------
44
45 Bezier( const real aX0=0.0, const real aY0=0.0, const real adYdx0=0.0,
46 const real aX1=1.0, const real aY1=1.0, const real adYdx1=0.0,
47 const BezierType aType = BezierType::Horizontal );
48
49 Bezier( const Vector< real > & aX,
50 const Vector< real > & aY,
51 const BezierType aType = BezierType::Horizontal );
52
53//------------------------------------------------------------------------------
54
55 ~Bezier() = default;
56
57//------------------------------------------------------------------------------
58
63 basis_x();
64
65 const Vector< real > &
66 basis_x() const ;
67
68//------------------------------------------------------------------------------
69
74 basis_y();
75
76 const Vector< real > &
77 basis_y() const ;
78
79//------------------------------------------------------------------------------
80
87 real
88 x_by_xi( const real aXi ) const ;
89
90//------------------------------------------------------------------------------
91
98 real
99 y_by_xi( const real aXi ) const ;
100
101//------------------------------------------------------------------------------
102
108 real
109 xi_by_x( const real aX ) const ;
110
111//------------------------------------------------------------------------------
112
118 real
119 xi_by_y( const real aY ) const ;
120
121//------------------------------------------------------------------------------
122
128 real
129 x( const real aY ) const ;
130
131//------------------------------------------------------------------------------
132
138 real
139 y( const real aX ) const ;
140
141//------------------------------------------------------------------------------
142
149 void
150 point( const real aXi, real & aX, real & aY ) const ;
151
152//------------------------------------------------------------------------------
153
160 void
161 dpoint( const real aXi, real & adXdXi, real & adYdXi ) const ;
162
163//------------------------------------------------------------------------------
164
171 void
172 ddpoint( const real aXi, real & ad2XdXi2, real & ad2YdXi2 ) const ;
173
174//------------------------------------------------------------------------------
175
181 void
182 dddpoint( real & ad3XdXi3, real & ad3YdXi3 ) const ;
183
184
185//------------------------------------------------------------------------------
186
192 real
193 dydx( const real aX ) const ;
194
195//------------------------------------------------------------------------------
196
202 real
203 dxdy( const real aY ) const ;
204
205//------------------------------------------------------------------------------
206
212 real
213 d2ydx2( const real aX ) const ;
214
215//------------------------------------------------------------------------------
216
222 real
223 d2xdy2( const real aY ) const ;
224
225//------------------------------------------------------------------------------
226
232 real
233 d3ydx3( const real aX ) const ;
234
235//------------------------------------------------------------------------------
236
242 real
243 d3xdy3( const real aY ) const ;
244
245//------------------------------------------------------------------------------
246
250 real
251 compute_length( const uint aNumIntegrationPoints=21 ) const ;
252
253//------------------------------------------------------------------------------
254
259 real
261 const Vector< double > & aW,
262 const Vector< double > & aXi ) const ;
263
264//------------------------------------------------------------------------------
265
266
267 void
269 const real aX0, const real aY0,const real adYdx0,
270 const real aX1, const real aY1, const real adYdx1 ) ;
271
272//------------------------------------------------------------------------------
273
274 void
276 const real aX0, const real aY0,const real adYdx0,
277 const real aX1, const real aY1, const real adYdx1 ) ;
278//------------------------------------------------------------------------------
279 private:
280//------------------------------------------------------------------------------
281
282//------------------------------------------------------------------------------
283
284 // the Bezier type has a simple shape function
285 void
286 compute_N( const real aXi ) const ;
287
288//------------------------------------------------------------------------------
289
290 // first derivative of the shape function
291 void
292 compute_dNdXi( const real aXi ) const ;
293
294//------------------------------------------------------------------------------
295
296 // second derivative of the shape functionon
297 void
298 compute_d2NdXi2( const real aXi ) const ;
299
300//------------------------------------------------------------------------------
301
302 };
303
304//------------------------------------------------------------------------------
305
306 inline Vector< real > &
308 {
309 return mX ;
310 }
311
312 inline const Vector< real > &
314 {
315 return mX ;
316 }
317
318
319//------------------------------------------------------------------------------
320
321 inline Vector< real > &
323 {
324 return mY ;
325 }
326
327 inline const Vector< real > &
329 {
330 return mY ;
331 }
332
333//------------------------------------------------------------------------------
334}
335#endif //BELFEM_CL_BEZIER_HPP
real x(const real aY) const
x-coordinate as funciton of the y-coordinate
Definition cl_Bezier.cpp:183
void point(const real aXi, real &aX, real &aY) const
point as function of parameter coordinate
Definition cl_Bezier.cpp:199
real dxdy(const real aY) const
derivative of X with respect to Y
Definition cl_Bezier.cpp:256
real dydx(const real aX) const
derivative of Y with respect to X
Definition cl_Bezier.cpp:245
real compute_length(const uint aNumIntegrationPoints=21) const
computes the length of the curve
Definition cl_Bezier.cpp:459
real d3ydx3(const real aX) const
third derivative of Y with respect to X
Definition cl_Bezier.cpp:312
void dddpoint(real &ad3XdXi3, real &ad3YdXi3) const
aberrancy vector as function of parameter coordinate
Definition cl_Bezier.cpp:232
real x_by_xi(const real aXi) const
The parameter coordinate goes from -1 <= xi <= 1.
Definition cl_Bezier.cpp:64
~Bezier()=default
void dpoint(const real aXi, real &adXdXi, real &adYdXi) const
tangent vector as function of parameter coordinate
Definition cl_Bezier.cpp:210
real xi_by_x(const real aX) const
Inverts the function x_by_xi.
Definition cl_Bezier.cpp:88
real d2xdy2(const real aY) const
second derivative of X with respect to Y
Definition cl_Bezier.cpp:292
void compute_basis_ywise(const real aX0, const real aY0, const real adYdx0, const real aX1, const real aY1, const real adYdx1)
Definition cl_Bezier.cpp:397
void compute_basis_xwise(const real aX0, const real aY0, const real adYdx0, const real aX1, const real aY1, const real adYdx1)
Definition cl_Bezier.cpp:377
real y_by_xi(const real aXi) const
The parameter coordinate goes from -1 <= xi <= 1.
Definition cl_Bezier.cpp:76
real xi_by_y(const real aY) const
Inverts the function y_by_xi.
Definition cl_Bezier.cpp:139
real d2ydx2(const real aX) const
second derivative of Y with respect to X
Definition cl_Bezier.cpp:268
void ddpoint(const real aXi, real &ad2XdXi2, real &ad2YdXi2) const
curvature vector as function of parameter coordinate
Definition cl_Bezier.cpp:221
real y(const real aX) const
y-coordinate as funciton of the x-coordinate
Definition cl_Bezier.cpp:191
real d3xdy3(const real aY) const
third derivative of X with respect to Y
Definition cl_Bezier.cpp:346
Vector< real > & basis_x()
expose the x-coordinates of the basis
Definition cl_Bezier.hpp:307
Vector< real > & basis_y()
expose the y-coordinates of the basis
Definition cl_Bezier.hpp:322
Bezier(const real aX0=0.0, const real aY0=0.0, const real adYdx0=0.0, const real aX1=1.0, const real aY1=1.0, const real adYdx1=0.0, const BezierType aType=BezierType::Horizontal)
Definition cl_Bezier.cpp:20
USER GUIDES:
Definition cl_Capacitor.cpp:16
unsigned int uint
Definition typedefs.hpp:30
double real
Definition typedefs.hpp:36
BezierType
Definition cl_Bezier.hpp:22
@ Vertical
Definition cl_Bezier.hpp:24
@ Horizontal
Definition cl_Bezier.hpp:23