Commit cf1b8bfb authored by frey_m's avatar frey_m
Browse files

SAAMG: clean up use of interpolationMethod variable

parent 382323d7
...@@ -41,7 +41,7 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom, ...@@ -41,7 +41,7 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom,
Vector_t nr, Vector_t nr,
Vector_t hr, Vector_t hr,
std::string interpl) std::string interpl)
: IrregularDomain(nr, hr) : IrregularDomain(nr, hr, interpl)
{ {
bgeom_m = bgeom; bgeom_m = bgeom;
...@@ -58,13 +58,6 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom, ...@@ -58,13 +58,6 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom,
} }
startId = 0; startId = 0;
if (interpl == "CONSTANT")
interpolationMethod = CONSTANT;
else if(interpl == "LINEAR")
interpolationMethod = LINEAR;
else if(interpl == "QUADRATIC")
interpolationMethod = QUADRATIC;
} }
ArbitraryDomain::~ArbitraryDomain() { ArbitraryDomain::~ArbitraryDomain() {
...@@ -388,7 +381,7 @@ void ArbitraryDomain::getBoundaryStencil(int idx, int idy, int idz, ...@@ -388,7 +381,7 @@ void ArbitraryDomain::getBoundaryStencil(int idx, int idy, int idz,
{ {
scaleFactor = 1.0; scaleFactor = 1.0;
// determine which interpolation method we use for points near the boundary // determine which interpolation method we use for points near the boundary
switch(interpolationMethod){ switch(interpolationMethod_m){
case CONSTANT: case CONSTANT:
constantInterpolation(idx,idy,idz,value,scaleFactor); constantInterpolation(idx,idy,idz,value,scaleFactor);
break; break;
......
...@@ -107,9 +107,6 @@ private: ...@@ -107,9 +107,6 @@ private:
// Mapping all cells that are inside the geometry // Mapping all cells that are inside the geometry
std::map<int, bool> IsInsideMap; std::map<int, bool> IsInsideMap;
// Interpolation type
int interpolationMethod;
Vector_t geomCentroid_m; Vector_t geomCentroid_m;
Vector_t minCoords_m; Vector_t minCoords_m;
Vector_t maxCoords_m; Vector_t maxCoords_m;
......
...@@ -38,20 +38,13 @@ extern Inform *gmsg; ...@@ -38,20 +38,13 @@ extern Inform *gmsg;
BoxCornerDomain::BoxCornerDomain(double A, double B, double C, double length, BoxCornerDomain::BoxCornerDomain(double A, double B, double C, double length,
double L1, double L2, Vector_t nr, Vector_t hr, double L1, double L2, Vector_t nr, Vector_t hr,
std::string interpl) std::string interpl)
: IrregularDomain(nr, hr) : IrregularDomain(nr, hr, interpl)
{ {
setRangeMin(Vector_t(-A, -B, L1)); setRangeMin(Vector_t(-A, -B, L1));
setRangeMax(Vector_t( A, B, L1 + L2)); setRangeMax(Vector_t( A, B, L1 + L2));
C_m = C; C_m = C;
length_m = length; length_m = length;
if(interpl == "CONSTANT")
interpolationMethod = CONSTANT;
else if(interpl == "LINEAR")
interpolationMethod = LINEAR;
else if(interpl == "QUADRATIC")
interpolationMethod = QUADRATIC;
if(Ippl::getNodes() == 1) { if(Ippl::getNodes() == 1) {
*gmsg << " Write BoxCorner data to file boxcorner.dat" << endl; *gmsg << " Write BoxCorner data to file boxcorner.dat" << endl;
std::string file("boxcorner.dat"); std::string file("boxcorner.dat");
...@@ -115,7 +108,7 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){ ...@@ -115,7 +108,7 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){
//XXX: calculate intersection on the fly //XXX: calculate intersection on the fly
/* /*
switch(interpolationMethod) { switch(interpolationMethod_m) {
case CONSTANT: case CONSTANT:
break; break;
...@@ -149,7 +142,7 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){ ...@@ -149,7 +142,7 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){
void BoxCornerDomain::getBoundaryStencil(int x, int y, int z, StencilValue_t& value, double &scaleFactor) { void BoxCornerDomain::getBoundaryStencil(int x, int y, int z, StencilValue_t& value, double &scaleFactor) {
// determine which interpolation method we use for points near the boundary // determine which interpolation method we use for points near the boundary
switch(interpolationMethod) { switch(interpolationMethod_m) {
case CONSTANT: case CONSTANT:
constantInterpolation(x, y, z, value, scaleFactor); constantInterpolation(x, y, z, value, scaleFactor);
break; break;
......
...@@ -147,9 +147,6 @@ private: ...@@ -147,9 +147,6 @@ private:
/// length of the structure /// length of the structure
double length_m; double length_m;
/// interpolation type
int interpolationMethod;
/// for debug reasons /// for debug reasons
std::ofstream os_m; std::ofstream os_m;
......
...@@ -37,20 +37,13 @@ ...@@ -37,20 +37,13 @@
EllipticDomain::EllipticDomain(BoundaryGeometry *bgeom, Vector_t nr, Vector_t hr, EllipticDomain::EllipticDomain(BoundaryGeometry *bgeom, Vector_t nr, Vector_t hr,
std::string interpl) std::string interpl)
: IrregularDomain(nr, hr) : IrregularDomain(nr, hr, interpl)
{ {
Vector_t min(-bgeom->getA(), -bgeom->getB(), bgeom->getS()); Vector_t min(-bgeom->getA(), -bgeom->getB(), bgeom->getS());
Vector_t max( bgeom->getA(), bgeom->getB(), bgeom->getS() + bgeom->getLength()); Vector_t max( bgeom->getA(), bgeom->getB(), bgeom->getS() + bgeom->getLength());
setRangeMin(min); setRangeMin(min);
setRangeMax(max); setRangeMax(max);
setMinMaxZ(min[2], max[2]); setMinMaxZ(min[2], max[2]);
if (interpl == "CONSTANT")
interpolationMethod_m = CONSTANT;
else if (interpl == "LINEAR")
interpolationMethod_m = LINEAR;
else if (interpl == "QUADRATIC")
interpolationMethod_m = QUADRATIC;
} }
EllipticDomain::~EllipticDomain() { EllipticDomain::~EllipticDomain() {
......
...@@ -92,9 +92,6 @@ private: ...@@ -92,9 +92,6 @@ private:
/// number of nodes in the xy plane (for this case: independent of the z coordinate) /// number of nodes in the xy plane (for this case: independent of the z coordinate)
int nxy_m; int nxy_m;
/// interpolation type
int interpolationMethod_m;
/// conversion from (x,y) to index in xy plane /// conversion from (x,y) to index in xy plane
inline int toCoordIdx(int x, int y) { return y * nr_m[0] + x; } inline int toCoordIdx(int x, int y) { return y * nr_m[0] + x; }
......
...@@ -25,11 +25,23 @@ ...@@ -25,11 +25,23 @@
// //
#include "Solvers/IrregularDomain.h" #include "Solvers/IrregularDomain.h"
#include "Utilities/OpalException.h"
IrregularDomain::IrregularDomain(const Vector_t& nr, const Vector_t& hr) IrregularDomain::IrregularDomain(const Vector_t& nr, const Vector_t& hr,
const std::string& interpl)
: nr_m(nr) : nr_m(nr)
, hr_m(hr) , hr_m(hr)
{ } {
if (interpl == "CONSTANT")
interpolationMethod_m = CONSTANT;
else if (interpl == "LINEAR")
interpolationMethod_m = LINEAR;
else if (interpl == "QUADRATIC")
interpolationMethod_m = QUADRATIC;
else
throw OpalException("IrregularDomain::IrregularDomain",
"No interpolation method '" + interpl + "' available.");
}
void IrregularDomain::getNeighbours(int x, int y, int z, StencilIndex_t& index) void IrregularDomain::getNeighbours(int x, int y, int z, StencilIndex_t& index)
......
...@@ -58,7 +58,8 @@ public: ...@@ -58,7 +58,8 @@ public:
typedef Stencil<double> StencilValue_t; typedef Stencil<double> StencilValue_t;
IrregularDomain(const Vector_t& nr, IrregularDomain(const Vector_t& nr,
const Vector_t& hr); const Vector_t& hr,
const std::string& interpl);
/** method to compute the intersection points with the boundary geometry /** method to compute the intersection points with the boundary geometry
...@@ -167,6 +168,9 @@ protected: ...@@ -167,6 +168,9 @@ protected:
/// flag indicating if geometry has changed for the current time-step /// flag indicating if geometry has changed for the current time-step
bool hasGeometryChanged_m; bool hasGeometryChanged_m;
/// interpolation type
int interpolationMethod_m;
}; };
......
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
#include "Utilities/OpalException.h" #include "Utilities/OpalException.h"
RectangularDomain::RectangularDomain(double a, double b, Vector_t nr, Vector_t hr) RectangularDomain::RectangularDomain(double a, double b, Vector_t nr, Vector_t hr)
: IrregularDomain(nr, hr) : IrregularDomain(nr, hr, "CONSTANT")
{ {
setRangeMin(Vector_t(-a, -b, getMinZ())); setRangeMin(Vector_t(-a, -b, getMinZ()));
setRangeMax(Vector_t( a, b, getMaxZ())); setRangeMax(Vector_t( a, b, getMaxZ()));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment