Commit 7e07c05e authored by frey_m's avatar frey_m

SAAMG: remove duplicated variables IdxMap and CoordMap

parent 4feb5575
......@@ -265,8 +265,8 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
startIdx -= numtotal;
// Build up index and coord map
IdxMap.clear();
CoordMap.clear();
idxMap_m.clear();
coordMap_m.clear();
int index = startIdx - numGhostNodesLeft;
INFOMSG(level2 << "* Building up index and coordinate map..." << endl);
......@@ -275,8 +275,8 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
for(int idy = 0; idy < nr_m[1]; idy++) {
for(int idx = 0; idx < nr_m[0]; idx++) {
if(isInside(idx, idy, idz)) {
IdxMap[toCoordIdx(idx, idy, idz)] = index;
CoordMap[index] = toCoordIdx(idx, idy, idz);
idxMap_m[toCoordIdx(idx, idy, idz)] = index;
coordMap_m[index] = toCoordIdx(idx, idy, idz);
index++;
}
}
......@@ -295,14 +295,14 @@ inline int ArbitraryDomain::toCoordIdx(int idx, int idy, int idz) {
int ArbitraryDomain::getIdx(int idx, int idy, int idz) {
if(isInside(idx, idy, idz) && idx >= 0 && idy >= 0 && idz >= 0)
return IdxMap[toCoordIdx(idx, idy, idz)];
return idxMap_m[toCoordIdx(idx, idy, idz)];
else
return -1;
}
// Conversion from a 3D index to (x,y,z)
inline void ArbitraryDomain::getCoord(int idxyz, int &idx, int &idy, int &idz) {
int id = CoordMap[idxyz];
int id = coordMap_m[idxyz];
idx = id % (int)nr_m[0];
id /= nr_m[0];
idy = id % (int)nr_m[1];
......
......@@ -93,13 +93,6 @@ private:
std::map<int, int> numYZ;
std::map<int, int> numXZ;
// Number of nodes in the xy plane (for this case: independent of the z coordinate)
int nxy_m[1000];
// mapping (x,y,z) -> idxyz
std::map<int, int> IdxMap;
// Mapping idxyz -> (x,y,z)
std::map<int, int> CoordMap;
// Mapping all cells that are inside the geometry
std::map<int, bool> IsInsideMap;
......
......@@ -86,8 +86,8 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){
//reset number of points inside domain
// clear previous coordinate maps
IdxMap.clear();
CoordMap.clear();
idxMap_m.clear();
coordMap_m.clear();
//clear previous intersection points
IntersectYDir.clear();
IntersectXDir.clear();
......@@ -99,8 +99,8 @@ void BoxCornerDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){
for(y = 0; y < nr_m[1]; y++) {
for(z = 0; z < nr_m[2]; z++) {
if(isInside(x, y, z)) {
IdxMap[toCoordIdx(x, y, z)] = idx;
CoordMap[idx++] = toCoordIdx(x, y, z);
idxMap_m[toCoordIdx(x, y, z)] = idx;
coordMap_m[idx++] = toCoordIdx(x, y, z);
}
}
}
......
......@@ -130,12 +130,6 @@ private:
/// all intersection points with grid lines in Y direction
BoxCornerPointList IntersectYDir;
/// mapping (x,y,z) -> idx
std::map<int, int> IdxMap;
/// mapping idx -> (x,y,z)
std::map<int, int> CoordMap;
/// because the geometry can change in the y direction
double actBMin_m;
......@@ -169,7 +163,7 @@ private:
/*inline*/
inline int getIdx(int x, int y, int z) {
if(isInside(x, y, z) && x >= 0 && y >= 0 && z >= 0)
return IdxMap[toCoordIdx(x, y, z)];
return idxMap_m[toCoordIdx(x, y, z)];
else
return -1;
}
......@@ -177,7 +171,7 @@ private:
/// conversion from a 3D index to (x,y,z)
inline void getCoord(int idx, int &x, int &y, int &z) {
int idxx = CoordMap[idx];
int idxx = coordMap_m[idx];
x = idxx % (int)nr_m[0];
idxx /= nr_m[0];
......
......@@ -182,6 +182,12 @@ protected:
/// interpolation type
int interpolationMethod_m;
/// mapping (x,y,z) -> idx
std::map<int, int> idxMap_m;
/// mapping idx -> (x,y,z)
std::map<int, int> coordMap_m;
};
......
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