C++ main module for emicrom Package  1.0
EMM_DistanceFunction.h
Go to the documentation of this file.
1 #ifndef EMM_DistanceFunction_H
2 #define EMM_DistanceFunction_H
3 
5 
6 
15 
17 
18 
20 
21  // ATTRIBUTES
22 
23 private:
24 
25 
26  //distance
31 
32 protected:
33  // METHODS
34 
35  // CONSTRUCTORS
36 
40 
41  mDistance=null;
42  mIsPrivateDistanceAllocated=false;
43 
44  mH=null;
45  mIsPrivateHAllocated=false;
46  }
47 
48 
49 
50  // DESTRUCTORS
51 
52 
55  virtual ~EMM_DistanceFunction(void) {
58  }
59 
60 
61 private:
62 
63  // CONSTRUCTORS
64 
65 private:
69  if (!mIsPrivateDistanceAllocated) {
70  //the distance is by reference
71  //dereference it and create a new array of size 4
72  //allocate the new distnace
73  mDistance=new tIndex[3];
74  mIsPrivateDistanceAllocated=true;
75  }
76  }
80  if (mIsPrivateDistanceAllocated) {
81  delete[] mDistance;
82  }
83  mDistance=null;
84  mIsPrivateDistanceAllocated=false;
85  }
89  if (!mIsPrivateHAllocated) {
90  //the distance is by reference
91  //dereference it and create a new array of size 4
92  //allocate the new distnace
93  mH=new tReal[3];
94  mIsPrivateHAllocated=true;
95  }
96  }
100  if (mIsPrivateHAllocated) {
101  delete[] mH;
102  }
103  mH=null;
104  mIsPrivateHAllocated=false;
105  }
106 
107 public:
108 
109 
114  inline void setDistance(const tIndex d[]) {
115  setDistance(d[0],d[1],d[2]);
116  }
122  virtual void setDistance(const tIndex& dx,const tIndex& dy,const tIndex& dz) {
124  mDistance[0]=dx;
125  mDistance[1]=dy;
126  mDistance[2]=dz;
127  }
128 
132  inline void setDistanceByReference(tIndex d[]) {
134  mDistance=d;
135  mIsPrivateDistanceAllocated=false;
136  }
137 
138 
142  inline const tIndex* getDistance() const {
143  return mDistance;
144  }
148  inline tIndex* getDistance() {
149  return mDistance;
150  }
155  inline void setMeshSize(const tReal h[]) {
156  setMeshSize(h[0],h[1],h[2]);
157  }
163  virtual void setMeshSize(const tReal& hx,const tReal& hy,const tReal& hz) {
165  mH[0]=hx;
166  mH[1]=hy;
167  mH[2]=hz;
168  }
169 
173  inline void setMeshSizeByReference(tReal h[]) {
175  mH=h;
176  mIsPrivateHAllocated=false;
177  }
178 
179 
180 
186  inline void getMeshSize(tReal& hx,tReal& hy,tReal& hz) const {
187  hx=mH[0];
188  hy=mH[1];
189  hz=mH[2];
190  }
194  inline const tReal* getMeshSize() const {
195  return mH;
196  }
197 
198 
199 
200 };
201 
202 #endif
void setMeshSizeByReference(tReal h[])
set the mesh size by reference from both interative cells by reference
Definition: EMM_DistanceFunction.h:173
tIndex * mDistance
Definition: EMM_DistanceFunction.h:28
SP_OBJECT(EMM_DistanceFunction)
EMM_DistanceFunction(void)
create the class
Definition: EMM_DistanceFunction.h:39
const tIndex * getDistance() const
get the distance from both interative cells
Definition: EMM_DistanceFunction.h:142
void allocateDistance()
allocate the distance array
Definition: EMM_DistanceFunction.h:68
#define tBoolean
Definition: types.h:139
tReal * mH
Definition: EMM_DistanceFunction.h:27
tIndex * getDistance()
get the distance from both interative cells
Definition: EMM_DistanceFunction.h:148
#define null
Definition: types.h:144
tBoolean mIsPrivateDistanceAllocated
Definition: EMM_DistanceFunction.h:29
void desallocateDistance()
deasollocate the distance array
Definition: EMM_DistanceFunction.h:79
DEFINE_SPTR(EMM_DistanceFunction)
#define tIndex
Definition: types.h:129
void setDistance(const tIndex d[])
set the distance from both interative cells
Definition: EMM_DistanceFunction.h:114
This class create a distance function.
Definition: EMM_DistanceFunction.h:16
void setDistanceByReference(tIndex d[])
set the distance from both interative cells by reference
Definition: EMM_DistanceFunction.h:132
const tReal * getMeshSize() const
get the mesh size
Definition: EMM_DistanceFunction.h:194
void desallocateMeshSize()
deasollocate the mesh size array
Definition: EMM_DistanceFunction.h:99
void allocateMeshSize()
allocate the mesh size array
Definition: EMM_DistanceFunction.h:88
virtual ~EMM_DistanceFunction(void)
destroy the class
Definition: EMM_DistanceFunction.h:55
virtual void setDistance(const tIndex &dx, const tIndex &dy, const tIndex &dz)
set the distance from both interative cells
Definition: EMM_DistanceFunction.h:122
tBoolean mIsPrivateHAllocated
Definition: EMM_DistanceFunction.h:30
void setMeshSize(const tReal h[])
set the mesh size
Definition: EMM_DistanceFunction.h:155
This class describes a function to integrate. the method computeFunction() has to be defined...
Definition: MATH_IntegrandFunction.h:16
void getMeshSize(tReal &hx, tReal &hy, tReal &hz) const
get the mesh size
Definition: EMM_DistanceFunction.h:186
#define tReal
Definition: types.h:118
virtual void setMeshSize(const tReal &hx, const tReal &hy, const tReal &hz)
set the mesh size
Definition: EMM_DistanceFunction.h:163