/Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines/SplineQuinticBase.hxx Source FileΒΆ

Splines: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines/SplineQuinticBase.hxx Source File
Splines
SplineQuinticBase.hxx
1/*--------------------------------------------------------------------------*\
2 | |
3 | Copyright (C) 2016 |
4 | |
5 | , __ , __ |
6 | /|/ \ /|/ \ |
7 | | __/ _ ,_ | __/ _ ,_ |
8 | | \|/ / | | | | \|/ / | | | |
9 | |(__/|__/ |_/ \_/|/|(__/|__/ |_/ \_/|/ |
10 | /| /| |
11 | \| \| |
12 | |
13 | Enrico Bertolazzi |
14 | Dipartimento di Ingegneria Industriale |
15 | Universita` degli Studi di Trento |
16 | email: enrico.bertolazzi@unitn.it |
17 | |
18\*--------------------------------------------------------------------------*/
19
20/*\
21 | ___ _ _ _ ____ _ _ ____
22 | / _ \ _ _(_)_ __ | |_(_) ___/ ___| _ __ | (_)_ __ ___| __ ) __ _ ___ ___
23 | | | | | | | | | '_ \| __| |/ __\___ \| '_ \| | | '_ \ / _ \ _ \ / _` / __|/ _ \
24 | | |_| | |_| | | | | | |_| | (__ ___) | |_) | | | | | | __/ |_) | (_| \__ \ __/
25 | \__\_\\__,_|_|_| |_|\__|_|\___|____/| .__/|_|_|_| |_|\___|____/ \__,_|___/\___|
26 | |_|
27\*/
28
29namespace Splines {
30
34 class QuinticSplineBase : public Spline {
35 protected:
36
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38
39 Malloc_real m_base_quintic;
40 real_type * m_Yp{nullptr};
41 real_type * m_Ypp{nullptr};
42 bool m_external_alloc{false};
43
44 #endif
45
46 public:
47
52
53 #ifndef DOXYGEN_SHOULD_SKIP_THIS
54 using Spline::build;
55 #endif
56
62 QuinticSplineBase( string const & name = "QuinticSplineBase" );
63
67 ~QuinticSplineBase() override {}
68
70
74 void copy_spline( QuinticSplineBase const & S );
75
80
84 real_type yp_node( integer i ) const { return m_Yp[size_t(i)]; }
85
89 real_type ypp_node( integer i ) const { return m_Ypp[size_t(i)]; }
90
91 void
93 integer & i_min_pos,
94 real_type & x_min_pos,
96 integer & i_max_pos,
97 real_type & x_max_pos,
99 ) const override;
100
101 void
102 y_min_max(
103 vector<integer> & i_min_pos,
104 vector<real_type> & x_min_pos,
105 vector<real_type> & y_min,
106 vector<integer> & i_max_pos,
107 vector<real_type> & x_max_pos,
108 vector<real_type> & y_max
109 ) const override;
110
111 void write_to_stream( ostream_type & s ) const override;
112
113 SplineType1D type() const override { return SplineType1D::QUINTIC; }
114
116
120 void set_range( real_type xmin, real_type xmax );
121
125 void
127 integer n,
128 real_type * & p_x,
129 real_type * & p_y,
130 real_type * & p_Yp,
131 real_type * & p_Ypp
132 );
133
134 // --------------------------- VIRTUALS -----------------------------------
135
140 real_type eval( real_type x ) const override;
141 real_type D( real_type x ) const override;
142 real_type DD( real_type x ) const override;
143 real_type DDD( real_type x ) const override;
144 real_type DDDD( real_type x ) const override;
145 real_type DDDDD( real_type x ) const override;
147
151 real_type id_eval( integer ni, real_type x ) const override;
152 real_type id_D( integer ni, real_type x ) const override;
153 real_type id_DD( integer ni, real_type x ) const override;
154 real_type id_DDD( integer ni, real_type x ) const override;
155 real_type id_DDDD( integer ni, real_type x ) const override;
156 real_type id_DDDDD( integer ni, real_type x ) const override;
158
159 void reserve( integer npts ) override;
160 void clear() override;
161
165 integer // order
166 coeffs(
167 real_type cfs[],
168 real_type nodes[],
169 bool transpose = false
170 ) const override;
171
172 integer order() const override;
173
174 #ifdef SPLINES_BACK_COMPATIBILITY
175 void copySpline( QuinticSplineBase const & S ) { this->copy_spline(S); }
176 real_type ypNode( integer i ) const { return this->yp_node(i); }
177 real_type yppNode( integer i ) const { return this->ypp_node(i); }
178 void setRange( real_type xmin, real_type xmax ) { this->set_range( xmin, xmax ); }
179 #endif
180 };
181
182}
183
184// EOF: SplineQuinticBase.hxx
Definition SplineQuinticBase.hxx:34
void write_to_stream(ostream_type &s) const override
Definition SplineQuinticBase.cc:302
real_type id_DDDD(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:194
QuinticSplineBase(string const &name="QuinticSplineBase")
real_type id_DD(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:144
void copy_spline(QuinticSplineBase const &S)
Definition SplineQuinticBase.cc:289
~QuinticSplineBase() override
Definition SplineQuinticBase.hxx:67
SplineType1D type() const override
Definition SplineQuinticBase.hxx:113
real_type D(real_type x) const override
Definition SplineQuinticBase.cc:135
real_type DDD(real_type x) const override
Definition SplineQuinticBase.cc:185
integer order() const override
Definition SplineQuinticBase.cc:283
void reserve(integer npts) override
Definition SplineQuinticBase.cc:64
real_type id_eval(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:93
void reserve_external(integer n, real_type *&p_x, real_type *&p_y, real_type *&p_Yp, real_type *&p_Ypp)
Definition SplineQuinticBase.cc:43
real_type ypp_node(integer i) const
Definition SplineQuinticBase.hxx:89
integer coeffs(real_type cfs[], real_type nodes[], bool transpose=false) const override
Definition SplineQuinticBase.cc:244
real_type id_DDDDD(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:219
real_type id_DDD(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:169
real_type eval(real_type x) const override
Definition SplineQuinticBase.cc:110
void y_min_max(integer &i_min_pos, real_type &x_min_pos, real_type &y_min, integer &i_max_pos, real_type &x_max_pos, real_type &y_max) const override
Definition SplineQuinticBase.cc:319
real_type DDDDD(real_type x) const override
Definition SplineQuinticBase.cc:235
real_type DDDD(real_type x) const override
Definition SplineQuinticBase.cc:210
real_type DD(real_type x) const override
Definition SplineQuinticBase.cc:160
real_type id_D(integer ni, real_type x) const override
Definition SplineQuinticBase.cc:119
void clear() override
Definition SplineQuinticBase.cc:83
void set_range(real_type xmin, real_type xmax)
real_type yp_node(integer i) const
Definition SplineQuinticBase.hxx:84
Definition Splines.hh:372
real_type y_max() const
Definition Splines.hh:553
virtual void build()=0
real_type y_min() const
Definition Splines.hh:543
string const & name() const
Definition Splines.hh:438
Definition SplineAkima.cc:50
int integer
Signed integer type for splines.
Definition Splines.hh:58
enum class SplineType1D :integer { CONSTANT=0, LINEAR=1, CUBIC=2, AKIMA=3, BESSEL=4, PCHIP=5, QUINTIC=6, HERMITE=7, SPLINE_SET=8, SPLINE_VEC=9 } SplineType1D
Associate a number for each type of splines implemented.
Definition Splines.hh:71
double real_type
Floating point type for splines.
Definition Splines.hh:57