1 #ifndef ELLIPTICAL_DOMAIN_H
2 #define ELLIPTICAL_DOMAIN_H
3 #ifdef HAVE_SAAMG_SOLVER
12 class EllipticDomain :
public IrregularDomain {
17 EllipticDomain(
double semimajor,
double semiminor,
Vector_t nr,
Vector_t hr, std::string interpl);
24 void getBoundaryStencil(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
26 void getBoundaryStencil(
int idx,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
28 void getNeighbours(
int x,
int y,
int z,
int &
W,
int &E,
int &S,
int &N,
int &F,
int &B);
30 void getNeighbours(
int idx,
int &
W,
int &E,
int &S,
int &N,
int &F,
int &B);
32 std::string getType() {
return "Elliptic";}
34 inline bool isInside(
int x,
int y,
int z) {
35 double xx = (x - (
nr[0] - 1) / 2.0) * hr[0];
36 double yy = (y - (
nr[1] - 1) / 2.0) * hr[1];
37 return ((xx * xx / (SemiMajor * SemiMajor) + yy * yy / (SemiMinor * SemiMinor) < 1) && z != 0 && z !=
nr[2] - 1);
40 int getNumXY(
int z) {
return nxy_m; }
42 void setSemiMinor(
double sm) {SemiMinor = sm;}
44 void setSemiMajor(
double sm) {SemiMajor = sm;}
50 double getXRangeMin() {
return -SemiMajor; }
51 double getXRangeMax() {
return SemiMajor; }
52 double getYRangeMin() {
return -SemiMinor; }
53 double getYRangeMax() {
return SemiMinor; }
54 double getZRangeMin() {
return zMin_m; }
55 double getZRangeMax() {
return zMax_m; }
59 int getStartIdx() {
return 0;}
61 bool hasGeometryChanged() {
return hasGeometryChanged_m; }
67 typedef std::multimap<int, double> EllipticPointList;
70 EllipticPointList IntersectXDir;
73 EllipticPointList IntersectYDir;
76 std::map<int, int> IdxMap;
79 std::map<int, int> CoordMap;
88 int interpolationMethod;
90 bool hasGeometryChanged_m;
93 inline int toCoordIdx(
int x,
int y) {
return y *
nr[0] + x; }
95 inline int getIdx(
int x,
int y,
int z) {
96 if(isInside(x, y, z) && x >= 0 && y >= 0 && z >= 0)
97 return IdxMap[toCoordIdx(x, y)] + (z - 1) * nxy_m;
102 inline void getCoord(
int idx,
int &x,
int &y,
int &z) {
103 int ixy = idx % nxy_m;
104 int xy = CoordMap[ixy];
105 int inr = (int)
nr[0];
107 y = (xy - x) /
nr[0];
108 z = (idx - ixy) / nxy_m + 1;
112 void constantInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
113 void linearInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
114 void quadraticInterpolation(
int x,
int y,
int z,
double &
W,
double &E,
double &S,
double &N,
double &F,
double &B,
double &C,
double &scaleFactor);
118 #endif //#ifdef HAVE_SAAMG_SOLVER
119 #endif //#ifdef ELLIPTICAL_DOMAIN_H