Overture  Version 25
SplineMapping.h
Go to the documentation of this file.
1 #ifndef SPLINE_MAPPING_H
2 #define SPLINE_MAPPING_H
3 
4 #include "Mapping.h"
5 
6 //-------------------------------------------------------------
7 // Define a Spline Curve in 1D, 2D or 3D
8 //-------------------------------------------------------------
9 class SplineMapping : public Mapping
10 {
11 
12 public:
13 
15  {
19  };
20 
22  {
26  free // for old spline routines only.
27  };
28 
29  SplineMapping(const int & rangeDimension=2 );
30 
31  // Copy constructor is deep by default
32  SplineMapping( const SplineMapping &, const CopyType copyType=DEEP );
33 
35 
36  SplineMapping & operator =( const SplineMapping & X0 );
37 
38  int getNumberOfKnots() const;
39  const RealArray& getKnotsS() const;
40  const realArray& getKnots() const;
41 
42  // set 'arclength' parameterization parameters
43  int parameterize( const real & arcLengthWeight=1., const real & curvatureWeight=0. );
44 
45  // rotate about a given axis
46  int rotate( const int & axis, const real & theta );
47 
48  // scale
49  int scale(const real & scalex=1.,
50  const real & scaley=1.,
51  const real & scalez=1. );
52 
53  // shift in space
54  int shift(const real & shiftx=0.,
55  const real & shifty=0.,
56  const real & shiftz=0. );
57 
58  // specify end conditions for the spline
59  int setEndConditions( const EndCondition & condition, const RealArray & endValues=Overture::nullRealArray() );
60 
62 
63  // supply a parameterization
64  int setParameterization(const RealArray & s );
65  // get the current parameterization
66  const RealArray & getParameterizationS() const;
67  const realArray & getParameterization() const;
68 
69  // restrict the domain interval:
70  int setDomainInterval(const real & rStart=0., const real & rEnd=1.);
71  // get the current domain interval
72  int getDomainInterval(real & rStart, real & rEnd) const;
73 
74  void setIsPeriodic( const int axis, const periodicType isPeriodic );
75 
76 
77  // supply points for a 1d spline parameterized by index
78  int setPoints( const RealArray & x );
79  // Supply points on the 2D spline (parameterized by arclength)
80  int setPoints( const RealArray & x, const RealArray & y );
81  // Supply points on the 3D spline (parameterized by arclength)
82  int setPoints( const RealArray & x, const RealArray & y, const RealArray & z );
83 
84  #ifdef USE_PPP
85  int setParameterization(const realArray & s );
86  int setPoints( const realArray & x );
87  int setPoints( const realArray & x, const realArray & y );
88  int setPoints( const realArray & x, const realArray & y, const realArray & z );
89  #endif
90 
91  // create a shape preserving (monotone) spline or not
92  int setShapePreserving( const bool trueOrFalse = TRUE );
93 
94  // specify a constant tension
95  int setTension( const real & tension );
96 
97  // use the old spline routines from FMM:
98  int useOldSpline( const bool & trueOrFalse = TRUE );
99 
102 
103  virtual void mapS( const RealArray & r, RealArray & x, RealArray &xr = Overture::nullRealArray(),
105 
106  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
107  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
108 
109  Mapping *make( const aString & mappingClassName );
111 
112  int update( MappingInformation & mapInfo ) ;
113 
114  protected:
115  void initialize();
116 
126  RealArray bcValue; // values for derivative boundary conditions.
127 
128  periodicType splineIsPeriodic; // periodicity of underlying spline, independent of the reparameterization.
131 
132  private:
133 
134  //
135  // Virtual member functions used only through class ReferenceCounting:
136  //
138  { return operator=((SplineMapping &)x); }
139  virtual void reference( const ReferenceCounting& x)
140  { reference((SplineMapping &)x); } // *** Conversion to this class for the virtual = ****
141  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
142  { return ::new SplineMapping(*this, ct); }
143 
144 };
145 
146 
147 #endif