Overture  Version 25
RestrictionMapping.h
Go to the documentation of this file.
1 #ifndef RESTRICTION_H
2 #define RESTRICTION_H "Restriction.h"
3 
4 #include "Mapping.h"
6 
7 //-------------------------------------------------------------
8 // This mapping restricts parameter space to a sub-rectangle
9 //
10 // For example, in 2D it maps [0,1]x[0,1] -> [ra,rb]x[sa,sb]
11 //
12 //-------------------------------------------------------------
14 {
16 
17 private:
19  real ra,rb,sa,sb,ta,tb;
20  int spaceIsPeriodic[3]; // true if the space we are reparameterizing is periodic.
21 
22 public:
23 
24  RestrictionMapping(const real ra=0.,
25  const real rb=1.,
26  const real sa=0.,
27  const real sb=1.,
28  const real ta=0.,
29  const real tb=1.,
30  const int dimension=2,
31  Mapping *restrictedMapping=NULL ); // 2D by default
32 
33  // Copy constructor is deep by default
34  RestrictionMapping( const RestrictionMapping &, const CopyType copyType=DEEP );
35 
37 
39 
42 
45 
46  void mapS( const RealArray & r, RealArray & x, RealArray &xr = Overture::nullRealArray(),
48 
49  void basicInverseS(const RealArray & x,
50  RealArray & r,
53 
54  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
55  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
56 
58  aString getClassName() const { return RestrictionMapping::className; }
59 
60  int update( MappingInformation & mapInfo ) ;
61 
62  // scale the current bounds
63  int scaleBounds(const real ra=0.,
64  const real rb=1.,
65  const real sa=0.,
66  const real sb=1.,
67  const real ta=0.,
68  const real tb=1. );
69  // set absolute bounds
70  int setBounds(const real ra=0.,
71  const real rb=1.,
72  const real sa=0.,
73  const real sb=1.,
74  const real ta=0.,
75  const real tb=1. );
76 
77  int getBounds(real & ra, real & rb, real & sa, real & sb, real & ta, real & tb ) const;
78 
79  // indicate whether the mapping being reparameterized is periodic
80  int setSpaceIsPeriodic( int axis, bool trueOrFalse = true );
81 
82  private:
83 
84  //
85  // Virtual member functions used only through class ReferenceCounting:
86  //
88  { return operator=((RestrictionMapping &)x); }
89  virtual void reference( const ReferenceCounting& x)
90  { reference((RestrictionMapping &)x); } // *** Conversion to this class for the virtual = ****
91  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
92  { return ::new RestrictionMapping(*this, ct); }
93 
94 };
95 
96 
97 #endif // RESTRICTION_H
98 
99