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

Splines: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines/SplineLinear.hxx Source File
Splines
SplineLinear.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 LinearSpline : public Spline {
33 Malloc_real m_mem_linear;
34 bool m_external_alloc{false};
35
36 public:
37
38 #ifndef DOXYGEN_SHOULD_SKIP_THIS
39 using Spline::build;
40 #endif
41
47 LinearSpline( string const & name = "LinearSpline" );
48
52 ~LinearSpline() override {}
53
55 void
57 integer n,
58 real_type *& p_x,
59 real_type *& p_y
60 );
61
62 // --------------------------- VIRTUALS -----------------------------------
63
64 real_type eval( real_type x ) const override;
65 real_type D( real_type x ) const override;
66 real_type DD( real_type ) const override { return 0; }
67 real_type DDD( real_type ) const override { return 0; }
68
69 real_type id_eval( integer ni, real_type x ) const override;
70 real_type id_D( integer, real_type ) const override;
71 real_type id_DD( integer, real_type ) const override { return 0; }
72 real_type id_DDD( integer, real_type ) const override { return 0; }
73
74 void write_to_stream( ostream_type & s ) const override;
75 SplineType1D type() const override { return SplineType1D::LINEAR; }
76
77 // --------------------------- VIRTUALS -----------------------------------
78
79 void reserve( integer npts ) override;
80 void build() override {}
81 void clear() override;
82
83 integer // order
84 coeffs(
85 real_type cfs[],
86 real_type nodes[],
87 bool transpose = false
88 ) const override;
89
90 integer order() const override;
91 void setup( GenericContainer const & gc ) override;
92
93 void
95 integer & i_min_pos,
96 real_type & x_min_pos,
98 integer & i_max_pos,
99 real_type & x_max_pos,
101 ) const override;
102
103 void
104 y_min_max(
105 vector<integer> & i_min_pos,
106 vector<real_type> & x_min_pos,
107 vector<real_type> & y_min,
108 vector<integer> & i_max_pos,
109 vector<real_type> & x_max_pos,
110 vector<real_type> & y_max
111 ) const override;
112
113 };
114
115}
116
117// EOF: SplineLinbear.hxx
Linear spline class.
Definition SplineLinear.hxx:32
void reserve_external(integer n, real_type *&p_x, real_type *&p_y)
Use externally allocated memory for npts points.
Definition SplineLinear.cc:95
void reserve(integer npts) override
Definition SplineLinear.cc:112
void setup(GenericContainer const &gc) override
Definition SplineLinear.cc:184
real_type DDD(real_type) const override
Definition SplineLinear.hxx:67
real_type id_D(integer, real_type) const override
Definition SplineLinear.cc:72
real_type id_DD(integer, real_type) const override
Definition SplineLinear.hxx:71
SplineType1D type() const override
Definition SplineLinear.hxx:75
real_type id_eval(integer ni, real_type x) const override
Definition SplineLinear.cc:51
integer order() const override
Definition SplineLinear.cc:176
LinearSpline(string const &name="LinearSpline")
Definition SplineLinear.cc:41
real_type id_DDD(integer, real_type) const override
Definition SplineLinear.hxx:72
real_type D(real_type x) const override
Definition SplineLinear.cc:82
real_type DD(real_type) const override
Definition SplineLinear.hxx:66
real_type eval(real_type x) const override
Definition SplineLinear.cc:63
void build() override
Definition SplineLinear.hxx:80
~LinearSpline() override
Definition SplineLinear.hxx:52
integer coeffs(real_type cfs[], real_type nodes[], bool transpose=false) const override
Definition SplineLinear.cc:152
void write_to_stream(ostream_type &s) const override
Definition SplineLinear.cc:139
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 SplineLinear.cc:209
void clear() override
Definition SplineLinear.cc:129
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