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

Splines: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines/SplineConstant.hxx Source File
Splines
SplineConstant.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
32 class ConstantSpline : public Spline {
33 Malloc_real m_mem_constant;
34 bool m_external_alloc{false};
35
36 public:
37
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 using Spline::build;
40 #endif
41
47 ConstantSpline( string const & name = "ConstantSpline" );
48
52 ~ConstantSpline() override {}
53
55 void
57 integer n,
58 real_type * & p_x,
59 real_type * & p_y
60 );
61
62 // --------------------------- VIRTUALS -----------------------------------
67
71 void build() override {} // nothing to do
72
82 void
83 build(
84 real_type const x[], integer incx,
85 real_type const y[], integer incy,
86 integer n
87 ) override;
89
94 real_type eval( real_type x ) const override;
95 real_type D( real_type ) const override { return 0; }
96 real_type DD( real_type ) const override { return 0; }
97 real_type DDD( real_type ) const override { return 0; }
99
104 real_type id_eval( integer ni, real_type x ) const override;
105 real_type id_D( integer, real_type ) const override { return 0; }
106 real_type id_DD( integer, real_type ) const override { return 0; }
107 real_type id_DDD( integer, real_type ) const override { return 0; }
109
110 void write_to_stream( ostream_type & ) const override;
111 SplineType1D type() const override { return SplineType1D::CONSTANT; }
112
113 // --------------------------- VIRTUALS -----------------------------------
114
115 void reserve( integer npts ) override;
116
117 void clear() override;
118
119 integer // order
120 coeffs(
121 real_type cfs[],
122 real_type nodes[],
123 bool transpose = false
124 ) const override;
125
126 integer order() const override;
127
128 void setup( GenericContainer const & gc ) override;
129
130 void
131 y_min_max(
132 integer & i_min_pos,
133 real_type & x_min_pos,
135 integer & i_max_pos,
136 real_type & x_max_pos,
138 ) const override;
139
140 void
141 y_min_max(
142 vector<integer> & i_min_pos,
143 vector<real_type> & x_min_pos,
144 vector<real_type> & y_min,
145 vector<integer> & i_max_pos,
146 vector<real_type> & x_max_pos,
147 vector<real_type> & y_max
148 ) const override;
149
150 };
151}
152
153// EOF: SplineConstant.hxx
154
Picewise constants spline class.
Definition SplineConstant.hxx:32
SplineType1D type() const override
Definition SplineConstant.hxx:111
void build() override
Definition SplineConstant.hxx:71
~ConstantSpline() override
Definition SplineConstant.hxx:52
real_type DD(real_type) const override
Definition SplineConstant.hxx:96
real_type eval(real_type x) const override
Evalute spline value at x
Definition SplineConstant.cc:84
real_type DDD(real_type) const override
Definition SplineConstant.hxx:97
void reserve_external(integer n, real_type *&p_x, real_type *&p_y)
Use externally allocated memory for npts points.
Definition SplineConstant.cc:49
ConstantSpline(string const &name="ConstantSpline")
Definition SplineConstant.cc:41
void write_to_stream(ostream_type &) const override
Definition SplineConstant.cc:126
real_type id_D(integer, real_type) const override
Definition SplineConstant.hxx:105
integer order() const override
Definition SplineConstant.cc:152
integer coeffs(real_type cfs[], real_type nodes[], bool transpose=false) const override
Definition SplineConstant.cc:138
real_type id_eval(integer ni, real_type x) const override
Evalute spline value at x
Definition SplineConstant.cc:94
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 SplineConstant.cc:186
real_type D(real_type) const override
Definition SplineConstant.hxx:95
void reserve(integer npts) override
Definition SplineConstant.cc:66
void setup(GenericContainer const &gc) override
Definition SplineConstant.cc:161
void clear() override
Definition SplineConstant.cc:116
real_type id_DDD(integer, real_type) const override
Definition SplineConstant.hxx:107
real_type id_DD(integer, real_type) const override
Definition SplineConstant.hxx:106
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