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

Splines: /Users/enrico/Ricerca/develop/PINS/pins-mechatronix/LibSources/submodules/Splines/src/Splines/Splines2D.hxx Source File
Splines
Splines2D.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 Spline2D {
35 protected:
36
37 #ifndef DOXYGEN_SHOULD_SKIP_THIS
38
39 std::string m_name;
40 SplineSurf * m_spline_2D{nullptr};
41
42 void new_spline( SplineType2D tp );
43
44 #endif
45
46 public:
47
50
56 Spline2D( string const & name = "Spline2D" )
57 : m_name(name)
58 {}
59
63 virtual
65 if ( m_spline_2D != nullptr ) {
66 delete m_spline_2D;
67 m_spline_2D = nullptr;
68 }
69 }
70
72
77
81 bool is_x_closed() const { return m_spline_2D->is_x_closed(); }
82
86 void make_x_closed() { m_spline_2D->make_x_closed(); }
87
91 void make_x_opened() { m_spline_2D->make_x_opened(); }
92
96 bool is_y_closed() const { return m_spline_2D->is_y_closed(); }
97
101 void make_y_closed() { m_spline_2D->make_y_closed(); }
102
106 void make_y_opened() { m_spline_2D->make_y_opened(); }
107
113 bool is_x_bounded() const { return m_spline_2D->is_x_bounded(); }
114
118 void make_x_unbounded() { m_spline_2D->make_x_unbounded(); }
119
123 void make_x_bounded() { m_spline_2D->make_x_bounded(); }
124
130 bool is_y_bounded() const { return m_spline_2D->is_y_bounded(); }
131
135 void make_y_unbounded() { m_spline_2D->make_y_unbounded(); }
136
140 void make_y_bounded() { m_spline_2D->make_y_bounded(); }
141
143
148
152 string const & name() const { return m_spline_2D->name(); }
153
157 integer num_point_x() const { return m_spline_2D->num_point_x(); }
158
162 integer num_point_y() const { return m_spline_2D->num_point_y(); }
163
167 real_type x_node( integer i ) const { return m_spline_2D->x_node(i); }
168
172 real_type y_node( integer i ) const { return m_spline_2D->y_node(i); }
173
177 real_type z_node( integer i, integer j ) const { return m_spline_2D->z_node(i,j); }
178
180
184 void clear() { m_spline_2D->clear(); }
185
190
194 real_type x_min() const { return m_spline_2D->x_min(); }
195
199 real_type x_max() const { return m_spline_2D->x_max(); }
200
204 real_type y_min() const { return m_spline_2D->y_min(); }
205
209 real_type y_max() const { return m_spline_2D->y_max(); }
210
214 real_type z_min() const { return m_spline_2D->z_min(); }
215
219 real_type z_max() const { return m_spline_2D->z_max(); }
220
222
227
245 void
247 SplineType2D tp,
248 real_type const x[], integer incx,
249 real_type const y[], integer incy,
250 real_type const z[], integer ldZ,
251 integer nx,
252 integer ny,
253 bool fortran_storage = false,
254 bool transposed = false
255 ) {
256 new_spline( tp );
257 m_spline_2D->build( x, incx, y, incy, z, ldZ, nx, ny, fortran_storage, transposed );
258 }
259
272 void
274 SplineType2D tp,
275 vector<real_type> const & x,
276 vector<real_type> const & y,
277 vector<real_type> const & z,
278 bool fortran_storage = false,
279 bool transposed = false
280 ) {
281 new_spline( tp );
282 m_spline_2D->build( x, y, z, fortran_storage, transposed );
283 }
284
299 void
301 SplineType2D tp,
302 real_type const z[],
303 integer ldZ,
304 integer nx,
305 integer ny,
306 bool fortran_storage = false,
307 bool transposed = false
308 ) {
309 new_spline( tp );
310 m_spline_2D->build( z, ldZ, nx, ny, fortran_storage, transposed );
311 }
312
327 void
329 SplineType2D tp,
330 vector<real_type> const & z,
331 integer nx,
332 integer ny,
333 bool fortran_storage = false,
334 bool transposed = false
335 ) {
336 new_spline( tp );
337 m_spline_2D->build( z, nx, ny, fortran_storage, transposed );
338 }
339
350 void
351 setup( GenericContainer const & gc );
352
356 void
357 build( GenericContainer const & gc )
358 { setup(gc); }
359
361
366
372 { return m_spline_2D->eval( x, y ); }
373
379 { return m_spline_2D->eval( x, y ); }
380
382
392 void
393 D( real_type x, real_type y, real_type d[3] ) const
394 { return m_spline_2D->D( x, y, d ); }
395
401 Dx( real_type x, real_type y ) const
402 { return m_spline_2D->Dx( x, y ); }
403
409 Dy( real_type x, real_type y ) const
410 { return m_spline_2D->Dy( x, y ); }
411
418 { return this->Dx(x,y); }
419
426 { return this->Dy(x,y); }
427
429
444 void
445 DD( real_type x, real_type y, real_type dd[6] ) const
446 { return m_spline_2D->DD( x, y, dd ); }
447
453 Dxx( real_type x, real_type y ) const
454 { return m_spline_2D->Dxx( x, y ); }
455
460 Dxy( real_type x, real_type y ) const
461 { return m_spline_2D->Dxy( x, y ); }
462
468 Dyy( real_type x, real_type y ) const
469 { return m_spline_2D->Dyy( x, y ); }
470
477 { return this->Dxx(x,y); }
478
484 { return this->Dxy(x,y); }
485
492 { return this->Dyy(x,y); }
494
498 void
499 write_to_stream( ostream_type & s ) const
500 { return m_spline_2D->write_to_stream( s ); }
501
505 char const * type_name() const { return m_spline_2D->type_name(); }
506
510 string
511 info() const
512 { return m_spline_2D->info(); }
513
517 void
518 info( ostream_type & stream ) const
519 { m_spline_2D->info( stream ); }
520
524 void
525 dump_data( ostream_type & stream ) const
526 { m_spline_2D->dump_data( stream ); }
527
528 #ifdef SPLINES_BACK_COMPATIBILITY
529 integer numPointX() const { return m_spline_2D->num_point_x(); }
530 integer numPointY() const { return m_spline_2D->num_point_y(); }
531 real_type xNode( integer i ) const { return this->x_node(i); }
532 real_type yNode( integer i ) const { return this->y_node(i); }
533 real_type zNode( integer i, integer j ) const { return this->z_node(i,j); }
534 real_type xMin() const { return this->x_min(); }
535 real_type xMax() const { return this->x_max(); }
536 real_type yMin() const { return this->y_min(); }
537 real_type yMax() const { return this->y_max(); }
538 real_type zMin() const { return this->z_min(); }
539 real_type zMax() const { return this->z_max(); }
540 #endif
541
542 };
543
544}
545
546// EOF Splines2D.hxx
Definition Splines2D.hxx:34
void setup(GenericContainer const &gc)
Definition Splines2D.cc:56
real_type y_max() const
Definition Splines2D.hxx:209
void make_x_bounded()
Definition Splines2D.hxx:123
void make_y_closed()
Definition Splines2D.hxx:101
string const & name() const
Definition Splines2D.hxx:152
real_type eval_D_1_1(real_type x, real_type y) const
Definition Splines2D.hxx:476
real_type operator()(real_type x, real_type y) const
Definition Splines2D.hxx:371
void make_x_unbounded()
Definition Splines2D.hxx:118
bool is_x_closed() const
Definition Splines2D.hxx:81
char const * type_name() const
Definition Splines2D.hxx:505
real_type eval_D_2(real_type x, real_type y) const
Definition Splines2D.hxx:425
real_type Dxy(real_type x, real_type y) const
Definition Splines2D.hxx:460
real_type eval_D_1_2(real_type x, real_type y) const
Definition Splines2D.hxx:483
void build(SplineType2D tp, vector< real_type > const &x, vector< real_type > const &y, vector< real_type > const &z, bool fortran_storage=false, bool transposed=false)
Definition Splines2D.hxx:273
real_type Dx(real_type x, real_type y) const
Definition Splines2D.hxx:401
integer num_point_y() const
Definition Splines2D.hxx:162
real_type z_min() const
Definition Splines2D.hxx:214
Spline2D(string const &name="Spline2D")
Definition Splines2D.hxx:56
real_type y_node(integer i) const
Definition Splines2D.hxx:172
void build(SplineType2D tp, real_type const z[], integer ldZ, integer nx, integer ny, bool fortran_storage=false, bool transposed=false)
Definition Splines2D.hxx:300
real_type eval_D_1(real_type x, real_type y) const
Definition Splines2D.hxx:417
void write_to_stream(ostream_type &s) const
Definition Splines2D.hxx:499
real_type Dy(real_type x, real_type y) const
Definition Splines2D.hxx:409
void build(GenericContainer const &gc)
Definition Splines2D.hxx:357
real_type eval(real_type x, real_type y) const
Definition Splines2D.hxx:378
void make_y_opened()
Definition Splines2D.hxx:106
bool is_y_bounded() const
Definition Splines2D.hxx:130
virtual ~Spline2D()
Definition Splines2D.hxx:64
void make_x_closed()
Definition Splines2D.hxx:86
real_type x_min() const
Definition Splines2D.hxx:194
real_type x_max() const
Definition Splines2D.hxx:199
real_type y_min() const
Definition Splines2D.hxx:204
bool is_y_closed() const
Definition Splines2D.hxx:96
void dump_data(ostream_type &stream) const
Definition Splines2D.hxx:525
void make_y_bounded()
Definition Splines2D.hxx:140
real_type z_node(integer i, integer j) const
Definition Splines2D.hxx:177
integer num_point_x() const
Definition Splines2D.hxx:157
void clear()
Definition Splines2D.hxx:184
real_type x_node(integer i) const
Definition Splines2D.hxx:167
bool is_x_bounded() const
Definition Splines2D.hxx:113
real_type z_max() const
Definition Splines2D.hxx:219
real_type eval_D_2_2(real_type x, real_type y) const
Definition Splines2D.hxx:491
void build(SplineType2D tp, real_type const x[], integer incx, real_type const y[], integer incy, real_type const z[], integer ldZ, integer nx, integer ny, bool fortran_storage=false, bool transposed=false)
Definition Splines2D.hxx:246
string info() const
Definition Splines2D.hxx:511
void build(SplineType2D tp, vector< real_type > const &z, integer nx, integer ny, bool fortran_storage=false, bool transposed=false)
Definition Splines2D.hxx:328
void make_x_opened()
Definition Splines2D.hxx:91
void make_y_unbounded()
Definition Splines2D.hxx:135
void info(ostream_type &stream) const
Definition Splines2D.hxx:518
real_type Dxx(real_type x, real_type y) const
Definition Splines2D.hxx:453
void DD(real_type x, real_type y, real_type dd[6]) const
Definition Splines2D.hxx:445
void D(real_type x, real_type y, real_type d[3]) const
Definition Splines2D.hxx:393
real_type Dyy(real_type x, real_type y) const
Definition Splines2D.hxx:468
Definition Splines.hh:1139
Definition SplineAkima.cc:50
int integer
Signed integer type for splines.
Definition Splines.hh:58
enum class SplineType2D :integer { BILINEAR=0, BICUBIC=1, BIQUINTIC=2, AKIMA2D=3 } SplineType2D
Associate a number for each type of splines implemented.
Definition Splines.hh:87
double real_type
Floating point type for splines.
Definition Splines.hh:57