diff --git a/src/Solvers/ArbitraryDomain.cpp b/src/Solvers/ArbitraryDomain.cpp index 499f872ebc4315e2529749885bfaed9de3ccc080..25cf1394f7bd962474ecfcd701b3a20da1308834 100644 --- a/src/Solvers/ArbitraryDomain.cpp +++ b/src/Solvers/ArbitraryDomain.cpp @@ -256,19 +256,19 @@ void ArbitraryDomain::constantInterpolation(int idx, int idy, int idz, value.back = -1/(hr_m[2]*hr_m[2]); value.center = 2/(hr_m[0]*hr_m[0]) + 2/(hr_m[1]*hr_m[1]) + 2/(hr_m[2]*hr_m[2]); - if(!isInside(idx-1,idy,idz)) + if (idx == 0 || !isInside(idx - 1, idy, idz)) value.west = 0.0; - if(!isInside(idx+1,idy,idz)) + if (idx == (nr_m[0] - 1) || !isInside(idx + 1, idy, idz)) value.east = 0.0; - if(!isInside(idx,idy+1,idz)) + if (idy == (nr_m[1] - 1) || !isInside(idx, idy + 1, idz)) value.north = 0.0; - if(!isInside(idx,idy-1,idz)) + if (idy == 0 || !isInside(idx, idy - 1, idz)) value.south = 0.0; - if(!isInside(idx,idy,idz-1)) + if (idz == 0 || !isInside(idx, idy, idz - 1)) value.front = 0.0; - if(!isInside(idx,idy,idz+1)) + if (idz == (nr_m[2] - 1) || !isInside(idx, idy, idz + 1)) value.back = 0.0; } diff --git a/src/Solvers/IrregularDomain.cpp b/src/Solvers/IrregularDomain.cpp index 471679aba3b989f965fc7bdb2865c0af5a8fc30a..70868ef59b5ef06ea52e5d1b3533b238c4c90a02 100644 --- a/src/Solvers/IrregularDomain.cpp +++ b/src/Solvers/IrregularDomain.cpp @@ -82,8 +82,8 @@ void IrregularDomain::getNeighbours(int id, StencilIndex_t& index) const { void IrregularDomain::getCoord(int idx, int& x, int& y, int& z) const { int xy = coordAccess(idx); x = xy % nr_m[0]; - y = (xy - x) / nr_m[0]; - z = idx / getNumXY(); + y = ((xy - x) / nr_m[0]) % nr_m[1]; + z = ((xy - x) / nr_m[0] - y) / nr_m[1]; } int IrregularDomain::getIdx(int x, int y, int z) const {