Overture  Version 25
DataPointMapping.h
Go to the documentation of this file.
1 #ifndef DATAPOINTMAPPING_H
2 #define DATAPOINTMAPPING_H "DataPointMapping.h"
3 
4 #include "MappingRC.h"
5 
8 
9 //-------------------------------------------------------------------------
10 // Here is a class derived from Mapping to define a DataPointMapping in 2D
11 //-------------------------------------------------------------------------
12 class DataPointMapping : public Mapping
13 {
14 
15 public:
16 
18 
19  // Copy constructor is deep by default
20  DataPointMapping( const DataPointMapping &, const CopyType copyType=DEEP );
21 
23 
24  // supply data points as xd(0:d,I,J[,K]) or xd(I,J,K,0:d-1) or xd(I,J,0:d-1) etc, d=number of dimensions
25  int setDataPoints(const realArray & xd,
26  const int positionOfCoordinates = 3,
27  const int domainDimension = -1,
28  const int numberOfGhostLinesInData = 0,
29  const IntegerArray & xGridIndexRange = Overture::nullIntArray() );
30  int setDataPoints(const realArray & xd,
31  const int positionOfCoordinates,
32  const int domainDimension,
33  const int numberOfGhostLinesInData[2][3],
34  const IntegerArray & xGridIndexRange = Overture::nullIntArray() );
35  int setDataPoints(const aString & fileName ); // set data points from a file of data
36  int setMapping( Mapping & map ); // acquire data points from this mapping.
37 
38  const realArray& getDataPoints(); // return the array of data points
39  const IntegerArray & getGridIndexRange(); // return the gridIndexRange(0;1,0:2) for the data points
40  const IntegerArray & getDimension(); // return the dimension(0;1,0:2) array for the data points
41 
42  void setOrderOfInterpolation( const int order ); // 2 or 4
44  void useScalarArrayIndexing(const bool & trueOrFalse = FALSE);
45 
46  // these next two should be in the base class.
48  virtual int setTopologyMask(real cGridTolerance=-1.);
49 
50  int update( MappingInformation & mapInfo );
51 
53 
56 
57  // we define a fast inverse for linear interpolation
58  virtual void basicInverse(const realArray & x,
59  realArray & r,
62 
63  virtual void mapS( const RealArray & r, RealArray & x, RealArray &xr = Overture::nullRealArray(),
65 
66  virtual void basicInverseS(const RealArray & x,
67  RealArray & r,
70 
71  virtual int get( const GenericDataBase & dir, const aString & name); // get from a database file
72  virtual int put( GenericDataBase & dir, const aString & name) const; // put to a database file
73 
75  aString getClassName() const { return DataPointMapping::className; }
76 
78  bool includeGhost=false); // grid for plotting
79 
80  virtual int setNumberOfGhostLines( IndexRangeType & numberOfGhostLinesNew ); // set the number of ghost lines.
81 
82  int projectGhostPoints(MappingInformation & mappingInfo);
83 
84  virtual real sizeOf(FILE *file = NULL ) const;
85 
86  protected:
87  void mapScalar(const RealArray & r, RealArray & x, RealArray & xr, MappingParameters & params,
88  int base, int bound, bool computeMap, bool computeMapDerivative );
89 
90 // void mapVector(const realArray & r, realArray & x, realArray & xr, MappingParameters & params,
91 // const Index & I);
92 
93  int computeGhostPoints( IndexRangeType & numberOfGhostLinesOld, IndexRangeType & numberOfGhostLinesNew );
94 
95 private:
96  aString className;
97  int orderOfInterpolation;
98  friend class HyperbolicMapping;
99  realArray xy; // data points defining the mapping
100  real delta[3],deltaByTwo[3];
102 
103  // local variables (these do not have to be saved with get/put)
104  bool mappingInitialized;
105  bool useScalarIndexing;
106 
107  private:
108 
109  //
110  // Virtual member functions used only through class ReferenceCounting:
111  //
113  { return operator=( (DataPointMapping &) x); }
114  virtual void reference( const ReferenceCounting& x)
115  { reference((DataPointMapping &)x); } // *** Conversion to this class for the virtual = ****
116  virtual ReferenceCounting* virtualConstructor( const CopyType ct = DEEP ) const
117  { return ::new DataPointMapping(*this, ct); }
118 };
119 
120 
121 #endif // DATAPOINTMAPPING_H