1 #ifndef BOXCORNER_DOMAIN_H
2 #define BOXCORNER_DOMAIN_H
3 #ifdef HAVE_SAAMG_SOLVER
50 class BoxCornerDomain :
public IrregularDomain {
55 BoxCornerDomain(
double A,
double B,
double C,
double Length,
double L1,
double L2,
Vector_t nr,
Vector_t hr,
60 void getBoundaryStencil(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
61 double &C,
double &scaleFactor);
64 void getBoundaryStencil(
int idx,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
68 void getNeighbours(
int x,
int y,
int z,
int &
W,
int &E,
int &S,
int &N,
int &F,
int &B);
71 void getNeighbours(
int idx,
int &
W,
int &E,
int &S,
int &N,
int &F,
int &B);
74 std::string getType() {
return "BoxCorner";}
78 int getNumXY(
int z) {
return -1;}
82 inline double getB(
double z) {
83 if((z < L1_m) || (z > (L1_m + L2_m)))
90 inline bool isInside(
int x,
int y,
int z) {
91 const double xx = (x - (
nr[0] - 1) / 2.0) * hr[0];
92 const double yy = (y - (
nr[1] - 1) / 2.0) * hr[1];
93 const double b = getB(z * hr[2]);
94 return (xx < A_m && yy < b && z != 0 && z !=
nr[2] - 1);
105 double getXRangeMin() {
return -A_m; }
106 double getXRangeMax() {
return A_m; }
107 double getYRangeMin() {
return -B_m;}
108 double getYRangeMax() {
return B_m; }
109 double getZRangeMin() {
return L1_m;}
110 double getZRangeMax() {
return L1_m+L2_m; }
114 int getStartIdx() {
return 0;}
116 bool hasGeometryChanged() {
return hasGeometryChanged_m; }
125 typedef std::multimap< std::pair<int, int>,
double > BoxCornerPointList;
128 BoxCornerPointList IntersectXDir;
131 BoxCornerPointList IntersectYDir;
134 std::map<int, int> IdxMap;
137 std::map<int, int> CoordMap;
171 int interpolationMethod;
173 bool hasGeometryChanged_m;
182 inline double getXIntersection(
double cx,
int z) {
189 inline double getYIntersection(
double cy,
int z) {
193 return getB(z * hr[2]);
197 inline int toCoordIdx(
int x,
int y,
int z) {
198 return (z *
nr[1] + y) *
nr[0] + x;
203 inline int getIdx(
int x,
int y,
int z) {
204 if(isInside(x, y, z) && x >= 0 && y >= 0 && z >= 0)
205 return IdxMap[toCoordIdx(x, y, z)];
211 inline void getCoord(
int idx,
int &x,
int &y,
int &z) {
213 int idxx = CoordMap[idx];
215 x = idxx % (int)
nr[0];
217 y = idxx % (int)
nr[1];
224 void constantInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
225 void linearInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
226 void quadraticInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
230 #endif //#ifdef HAVE_SAAMG_SOLVER
231 #endif //#ifdef BOXCORNER_DOMAIN_H