Commit 382323d7 authored by frey_m's avatar frey_m

SAAMG: nr --> nr_m and hr --> hr_m

parent 8e0d416c
......@@ -39,8 +39,10 @@
ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom,
Vector_t nr,
Vector_t /*hr*/,
std::string interpl){
Vector_t hr,
std::string interpl)
: IrregularDomain(nr, hr)
{
bgeom_m = bgeom;
setRangeMin(bgeom->getmincoords());
......@@ -54,10 +56,6 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom,
"ArbitraryDomain::ArbitraryDomain()",
"No point inside geometry found/set!");
}
setNr(nr);
for(int i=0; i<3; i++)
Geo_hr_m[i] = (max_m[i] - min_m[i])/nr[i];
setHr(Geo_hr_m);
startId = 0;
......@@ -87,11 +85,11 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
localToGlobalQuaternion_m[i] = -globalToLocalQuaternion_m[i];
int zGhostOffsetLeft = (localId[2].first()== 0) ? 0 : 1;
int zGhostOffsetRight = (localId[2].last() == nr[2] - 1) ? 0 : 1;
int zGhostOffsetRight = (localId[2].last() == nr_m[2] - 1) ? 0 : 1;
int yGhostOffsetLeft = (localId[1].first()== 0) ? 0 : 1;
int yGhostOffsetRight = (localId[1].last() == nr[1] - 1) ? 0 : 1;
int yGhostOffsetRight = (localId[1].last() == nr_m[1] - 1) ? 0 : 1;
int xGhostOffsetLeft = (localId[0].first()== 0) ? 0 : 1;
int xGhostOffsetRight = (localId[0].last() == nr[0] - 1) ? 0 : 1;
int xGhostOffsetRight = (localId[0].last() == nr_m[0] - 1) ? 0 : 1;
hasGeometryChanged_m = true;
......@@ -112,17 +110,17 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
// example (-0.13 to +0.025). -DW
for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
//saveP_old[2] = (idz - (nr[2]-1)/2.0)*hr[2];
//saveP_old[2] = (idz - (nr_m[2]-1)/2.0)*hr[2];
P[2] = min_m[2] + (idz + 0.5) * hr[2];
for (int idy = localId[1].first()-yGhostOffsetLeft; idy <= localId[1].last()+yGhostOffsetRight; idy++) {
//saveP_old[1] = (idy - (nr[1]-1)/2.0)*hr[1];
//saveP_old[1] = (idy - (nr_m[1]-1)/2.0)*hr[1];
P[1] = min_m[1] + (idy + 0.5) * hr[1];
for (int idx = localId[0].first()-xGhostOffsetLeft; idx <= localId[0].last()+xGhostOffsetRight; idx++) {
//saveP_old[0] = (idx - (nr[0]-1)/2.0)*hr[0];
//saveP_old[0] = (idx - (nr_m[0]-1)/2.0)*hr[0];
P[0] = min_m[0] + (idx + 0.5) * hr[0];
// *gmsg << "Now working on point " << saveP << " (original was " << saveP_old << ")" << endl;
......@@ -244,8 +242,8 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
//number of ghost nodes to the left
int numGhostNodesLeft = 0;
if(localId[2].first() != 0) {
for(int idx = 0; idx < nr[0]; idx++) {
for(int idy = 0; idy < nr[1]; idy++) {
for(int idx = 0; idx < nr_m[0]; idx++) {
for(int idy = 0; idy < nr_m[1]; idy++) {
if(isInside(idx, idy, localId[2].first() - zGhostOffsetLeft))
numGhostNodesLeft++;
}
......@@ -259,8 +257,8 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
numXY.clear();
for(int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
int numxy = 0;
for(int idx = 0; idx < nr[0]; idx++) {
for(int idy = 0; idy < nr[1]; idy++) {
for(int idx = 0; idx < nr_m[0]; idx++) {
for(int idy = 0; idy < nr_m[1]; idy++) {
if(isInside(idx, idy, idz))
numxy++;
}
......@@ -281,8 +279,8 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
INFOMSG(level2 << "* Building up index and coordinate map..." << endl);
for(int idz = localId[2].first() - zGhostOffsetLeft; idz <= localId[2].last() + zGhostOffsetRight; idz++) {
for(int idy = 0; idy < nr[1]; idy++) {
for(int idx = 0; idx < nr[0]; idx++) {
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);
......@@ -297,7 +295,7 @@ void ArbitraryDomain::compute(Vector_t hr, NDIndex<3> localId){
// Conversion from (x,y,z) to index in xyz plane
inline int ArbitraryDomain::toCoordIdx(int idx, int idy, int idz) {
return (idz * nr[1] + idy) * nr[0] + idx;
return (idz * nr_m[1] + idy) * nr_m[0] + idx;
}
// Conversion from (x,y,z) to index on the 3D grid
......@@ -312,10 +310,10 @@ int ArbitraryDomain::getIdx(int idx, int idy, int idz) {
// 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];
idx = id % (int)nr[0];
id /= nr[0];
idy = id % (int)nr[1];
id /= nr[1];
idx = id % (int)nr_m[0];
id /= nr_m[0];
idy = id % (int)nr_m[1];
id /= nr_m[1];
idz = id;
}
......@@ -328,9 +326,9 @@ inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
Vector_t P;
P[0] = min_m[0] + (idx + 0.5) * hr[0];
P[1] = min_m[1] + (idy + 0.5) * hr[1];
P[2] = min_m[2] + (idz + 0.5) * hr[2];
P[0] = min_m[0] + (idx + 0.5) * hr_m[0];
P[1] = min_m[1] + (idy + 0.5) * hr_m[1];
P[2] = min_m[2] + (idz + 0.5) * hr_m[2];
return (bgeom_m->fastIsInside(globalInsideP0_m, P) % 2 == 0);
}
......@@ -340,9 +338,9 @@ inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
inline bool ArbitraryDomain::isInside(int idx, int idy, int idz) {
Vector_t P;
P[0] = (idx - (nr[0]-1)/2.0) * hr[0];
P[1] = (idy - (nr[1]-1)/2.0) * hr[1];
P[2] = (idz - (nr[2]-1)/2.0) * hr[2];
P[0] = (idx - (nr_m[0]-1)/2.0) * hr_m[0];
P[1] = (idy - (nr_m[1]-1)/2.0) * hr_m[1];
P[2] = (idz - (nr_m[2]-1)/2.0) * hr_m[2];
bool ret = false;
int countH, countL;
......@@ -409,13 +407,13 @@ void ArbitraryDomain::getBoundaryStencil(int idx, int idy, int idz,
void ArbitraryDomain::constantInterpolation(int idx, int idy, int idz,
StencilValue_t& value, double& /*scaleFactor*/)
{
value.west = -1/(hr[0]*hr[0]);
value.east = -1/(hr[0]*hr[0]);
value.north = -1/(hr[1]*hr[1]);
value.south = -1/(hr[1]*hr[1]);
value.front = -1/(hr[2]*hr[2]);
value.back = -1/(hr[2]*hr[2]);
value.center = 2/(hr[0]*hr[0]) + 2/(hr[1]*hr[1]) + 2/(hr[2]*hr[2]);
value.west = -1/(hr_m[0]*hr_m[0]);
value.east = -1/(hr_m[0]*hr_m[0]);
value.north = -1/(hr_m[1]*hr_m[1]);
value.south = -1/(hr_m[1]*hr_m[1]);
value.front = -1/(hr_m[2]*hr_m[2]);
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))
value.west = 0.0;
......@@ -438,29 +436,29 @@ void ArbitraryDomain::linearInterpolation(int idx, int idy, int idz,
{
scaleFactor = 1;
double cx = (idx - (nr[0]-1)/2.0)*hr[0];
double cy = (idy - (nr[1]-1)/2.0)*hr[1];
double cz = (idz - (nr[2]-1)/2.0)*hr[2];
double cx = (idx - (nr_m[0]-1)/2.0)*hr_m[0];
double cy = (idy - (nr_m[1]-1)/2.0)*hr_m[1];
double cz = (idz - (nr_m[2]-1)/2.0)*hr_m[2];
double dx_w=hr[0];
double dx_e=hr[0];
double dy_n=hr[1];
double dy_s=hr[1];
double dz_f=hr[2];
double dz_b=hr[2];
double dx_w=hr_m[0];
double dx_e=hr_m[0];
double dy_n=hr_m[1];
double dy_s=hr_m[1];
double dz_f=hr_m[2];
double dz_b=hr_m[2];
value.center = 0.0;
std::tuple<int, int, int> coordxyz(idx, idy, idz);
if (idx == nr[0]-1)
if (idx == nr_m[0]-1)
dx_e = std::abs(IntersectHiX.find(coordxyz)->second - cx);
if (idx == 0)
dx_w = std::abs(IntersectLoX.find(coordxyz)->second - cx);
if (idy == nr[1]-1)
if (idy == nr_m[1]-1)
dy_n = std::abs(IntersectHiY.find(coordxyz)->second - cy);
if (idy == 0)
dy_s = std::abs(IntersectLoY.find(coordxyz)->second - cy);
if (idz == nr[2]-1)
if (idz == nr_m[2]-1)
dz_b = std::abs(IntersectHiZ.find(coordxyz)->second - cz);
if (idz == 0)
dz_f = std::abs(IntersectLoZ.find(coordxyz)->second - cz);
......@@ -513,7 +511,7 @@ void ArbitraryDomain::linearInterpolation(int idx, int idy, int idz,
if(dy_s == 0)
m2 = dy_n;
value.center = 2 / hr[2];
value.center = 2 / hr_m[2];
if(dx_w != 0 || dx_e != 0)
value.center *= (dx_w + dx_e);
if(dy_n != 0 || dy_s != 0)
......
......@@ -110,8 +110,6 @@ private:
// Interpolation type
int interpolationMethod;
Vector_t Geo_nr_m;
Vector_t Geo_hr_m;
Vector_t geomCentroid_m;
Vector_t minCoords_m;
Vector_t maxCoords_m;
......
This diff is collapsed.
......@@ -107,10 +107,10 @@ public:
/// queries if a given (x,y,z) coordinate lies inside the domain
inline bool isInside(int x, int y, int z) {
const double xx = (x - (nr[0] - 1) / 2.0) * hr[0];
const double yy = (y - (nr[1] - 1) / 2.0) * hr[1];
const double b = getB(z * hr[2]);
return (xx < getXRangeMax() && yy < b && z != 0 && z != nr[2] - 1);
const double xx = (x - (nr_m[0] - 1) / 2.0) * hr_m[0];
const double yy = (y - (nr_m[1] - 1) / 2.0) * hr_m[1];
const double b = getB(z * hr_m[2]);
return (xx < getXRangeMax() && yy < b && z != 0 && z != nr_m[2] - 1);
}
void compute(Vector_t hr, NDIndex<3> localId);
......@@ -163,12 +163,12 @@ private:
}
inline double getYIntersection(double cy, int z) {
return (cy < 0) ? min_m(1) : getB(z * hr[2]);
return (cy < 0) ? min_m(1) : getB(z * hr_m[2]);
}
/// conversion from (x,y,z) to index in xyz plane
inline int toCoordIdx(int x, int y, int z) {
return (z * nr[1] + y) * nr[0] + x;
return (z * nr_m[1] + y) * nr_m[0] + x;
}
/// conversion from (x,y,z) to index on the 3D grid
......@@ -185,10 +185,10 @@ private:
int idxx = CoordMap[idx];
x = idxx % (int)nr[0];
idxx /= nr[0];
y = idxx % (int)nr[1];
idxx /= nr[1];
x = idxx % (int)nr_m[0];
idxx /= nr_m[0];
y = idxx % (int)nr_m[1];
idxx /= nr_m[1];
z = idxx;
}
......
......@@ -37,14 +37,13 @@
EllipticDomain::EllipticDomain(BoundaryGeometry *bgeom, Vector_t nr, Vector_t hr,
std::string interpl)
: IrregularDomain(nr, hr)
{
Vector_t min(-bgeom->getA(), -bgeom->getB(), bgeom->getS());
Vector_t max( bgeom->getA(), bgeom->getB(), bgeom->getS() + bgeom->getLength());
setRangeMin(min);
setRangeMax(max);
setMinMaxZ(min[2], max[2]);
setNr(nr);
setHr(hr);
if (interpl == "CONSTANT")
interpolationMethod_m = CONSTANT;
......@@ -92,8 +91,8 @@ void EllipticDomain::compute(Vector_t hr, NDIndex<3> localId){
* grid points per plane --> otherwise we might
* get not unique global indices in the Tpetra::CrsMatrix
*/
for (x = 0; x < nr[0]; ++x) {
for (y = 0; y < nr[1]; ++y) {
for (x = 0; x < nr_m[0]; ++x) {
for (y = 0; y < nr_m[1]; ++y) {
if (isInside(x, y, 1)) {
idxMap_m[toCoordIdx(x, y)] = idx;
coordMap_m[idx++] = toCoordIdx(x, y);
......@@ -116,7 +115,7 @@ void EllipticDomain::compute(Vector_t hr, NDIndex<3> localId){
// calculate intersection with the ellipse
for (x = localId[0].first(); x <= localId[0].last(); x++) {
pos = getXRangeMin() + hr[0] * (x + 0.5);
pos = getXRangeMin() + hr_m[0] * (x + 0.5);
if (std::abs(pos) >= getXRangeMax())
{
intersectYDir_m.insert(std::pair<int, double>(x, 0));
......@@ -130,7 +129,7 @@ void EllipticDomain::compute(Vector_t hr, NDIndex<3> localId){
}
for (y = localId[0].first(); y < localId[1].last(); y++) {
pos = getYRangeMin() + hr[1] * (y + 0.5);
pos = getYRangeMin() + hr_m[1] * (y + 0.5);
if (std::abs(pos) >= getYRangeMax())
{
intersectXDir_m.insert(std::pair<int, double>(y, 0));
......@@ -159,7 +158,7 @@ void EllipticDomain::resizeMesh(Vector_t& origin, Vector_t& hr, const Vector_t&
mymax = Vector_t(getXRangeMax(), getYRangeMax(), getMaxZ());
for (int i = 0; i < 3; ++i)
hr[i] = (mymax[i] - origin[i]) / nr[i];
hr[i] = (mymax[i] - origin[i]) / nr_m[i];
}
void EllipticDomain::getBoundaryStencil(int x, int y, int z, StencilValue_t& value,
......@@ -189,16 +188,16 @@ void EllipticDomain::constantInterpolation(int x, int y, int z, StencilValue_t&
{
scaleFactor = 1.0;
value.west = -1.0 / (hr[0] * hr[0]);
value.east = -1.0 / (hr[0] * hr[0]);
value.north = -1.0 / (hr[1] * hr[1]);
value.south = -1.0 / (hr[1] * hr[1]);
value.front = -1.0 / (hr[2] * hr[2]);
value.back = -1.0 / (hr[2] * hr[2]);
value.west = -1.0 / (hr_m[0] * hr_m[0]);
value.east = -1.0 / (hr_m[0] * hr_m[0]);
value.north = -1.0 / (hr_m[1] * hr_m[1]);
value.south = -1.0 / (hr_m[1] * hr_m[1]);
value.front = -1.0 / (hr_m[2] * hr_m[2]);
value.back = -1.0 / (hr_m[2] * hr_m[2]);
value.center = 2.0 / (hr[0] * hr[0])
+ 2.0 / (hr[1] * hr[1])
+ 2.0 / (hr[2] * hr[2]);
value.center = 2.0 / (hr_m[0] * hr_m[0])
+ 2.0 / (hr_m[1] * hr_m[1])
+ 2.0 / (hr_m[2] * hr_m[2]);
// we are a right boundary point
if (!isInside(x + 1, y, z))
......@@ -225,8 +224,8 @@ void EllipticDomain::linearInterpolation(int x, int y, int z, StencilValue_t& va
{
scaleFactor = 1.0;
double cx = getXRangeMin() + hr[0] * (x + 0.5);
double cy = getYRangeMin() + hr[1] * (y + 0.5);
double cx = getXRangeMin() + hr_m[0] * (x + 0.5);
double cy = getYRangeMin() + hr_m[1] * (y + 0.5);
double dx = 0.0;
std::multimap<int, double>::iterator it = intersectXDir_m.find(y);
......@@ -242,10 +241,10 @@ void EllipticDomain::linearInterpolation(int x, int y, int z, StencilValue_t& va
dy = it->second;
double dw = hr[0];
double de = hr[0];
double dn = hr[1];
double ds = hr[1];
double dw = hr_m[0];
double de = hr_m[0];
double dn = hr_m[1];
double ds = hr_m[1];
value.center = 0.0;
// we are a right boundary point
......@@ -285,9 +284,9 @@ void EllipticDomain::linearInterpolation(int x, int y, int z, StencilValue_t& va
}
// handle boundary condition in z direction
value.front = -1.0 / (hr[2] * hr[2]);
value.back = -1.0 / (hr[2] * hr[2]);
value.center += 2.0 / (hr[2] * hr[2]);
value.front = -1.0 / (hr_m[2] * hr_m[2]);
value.back = -1.0 / (hr_m[2] * hr_m[2]);
value.center += 2.0 / (hr_m[2] * hr_m[2]);
robinBoundaryStencil(z, value.front, value.back, value.center);
}
......@@ -297,8 +296,8 @@ void EllipticDomain::quadraticInterpolation(int x, int y, int z,
{
scaleFactor = 1.0;
double cx = (x - (nr[0] - 1) / 2.0) * hr[0];
double cy = (y - (nr[1] - 1) / 2.0) * hr[1];
double cx = (x - (nr_m[0] - 1) / 2.0) * hr_m[0];
double cy = (y - (nr_m[1] - 1) / 2.0) * hr_m[1];
// since every vector for elliptic domains has ALWAYS size 2 we
// can catch all cases manually
......@@ -314,10 +313,10 @@ void EllipticDomain::quadraticInterpolation(int x, int y, int z,
++it;
dy = it->second;
double dw = hr[0];
double de = hr[0];
double dn = hr[1];
double ds = hr[1];
double dw = hr_m[0];
double de = hr_m[0];
double dn = hr_m[1];
double ds = hr_m[1];
value.west = 0.0;
value.east = 0.0;
......@@ -370,14 +369,14 @@ void EllipticDomain::quadraticInterpolation(int x, int y, int z,
}
// handle boundary condition in z direction
value.front = -1.0 / (hr[2] * hr[2]);
value.back = -1.0 / (hr[2] * hr[2]);
value.center += 2.0 / (hr[2] * hr[2]);
value.front = -1.0 / (hr_m[2] * hr_m[2]);
value.back = -1.0 / (hr_m[2] * hr_m[2]);
value.center += 2.0 / (hr_m[2] * hr_m[2]);
robinBoundaryStencil(z, value.front, value.back, value.center);
}
void EllipticDomain::robinBoundaryStencil(int z, double &F, double &B, double &C) {
if (z == 0 || z == nr[2] - 1) {
if (z == 0 || z == nr_m[2] - 1) {
// case where we are on the Robin BC in Z-direction
// where we distinguish two cases
......@@ -390,8 +389,8 @@ void EllipticDomain::robinBoundaryStencil(int z, double &F, double &B, double &C
// add contribution of Robin discretization to center point
// d the distance between the center of the bunch and the boundary
double d = 0.5 * hr[2] * (nr[2] - 1);
C += 2.0 / (d * hr[2]);
double d = 0.5 * hr_m[2] * (nr_m[2] - 1);
C += 2.0 / (d * hr_m[2]);
}
}
......
......@@ -53,13 +53,13 @@ public:
/// queries if a given (x,y,z) coordinate lies inside the domain
inline bool isInside(int x, int y, int z) {
double xx = getXRangeMin() + hr[0] * (x + 0.5);
double yy = getYRangeMin() + hr[1] * (y + 0.5);
double xx = getXRangeMin() + hr_m[0] * (x + 0.5);
double yy = getYRangeMin() + hr_m[1] * (y + 0.5);
bool isInsideEllipse = (xx * xx / (getXRangeMax() * getXRangeMax()) +
yy * yy / (getYRangeMax() * getYRangeMax()) < 1);
return (isInsideEllipse && z > 0 && z < nr[2] - 1);
return (isInsideEllipse && z > 0 && z < nr_m[2] - 1);
}
int getNumXY(int /*z*/) { return nxy_m; }
......@@ -96,7 +96,7 @@ private:
int interpolationMethod_m;
/// conversion from (x,y) to index in xy plane
inline int toCoordIdx(int x, int y) { return y * nr[0] + x; }
inline int toCoordIdx(int x, int y) { return y * nr_m[0] + x; }
/// conversion from (x,y,z) to index on the 3D grid
inline int getIdx(int x, int y, int z) {
......@@ -110,9 +110,9 @@ private:
inline void getCoord(int idx, int &x, int &y, int &z) {
int ixy = idx % nxy_m;
int xy = coordMap_m[ixy];
int inr = (int)nr[0];
int inr = (int)nr_m[0];
x = xy % inr;
y = (xy - x) / nr[0];
y = (xy - x) / nr_m[0];
z = (idx - ixy) / nxy_m + 1;
}
......
......@@ -26,6 +26,11 @@
#include "Solvers/IrregularDomain.h"
IrregularDomain::IrregularDomain(const Vector_t& nr, const Vector_t& hr)
: nr_m(nr)
, hr_m(hr)
{ }
void IrregularDomain::getNeighbours(int x, int y, int z, StencilIndex_t& index)
{
......@@ -39,19 +44,19 @@ void IrregularDomain::getNeighbours(int x, int y, int z, StencilIndex_t& index)
if (x > 0 && isInside(x - 1, y, z))
index.west = getIdx(x - 1, y, z);
if (x < nr[0] - 1 && isInside(x + 1, y, z))
if (x < nr_m[0] - 1 && isInside(x + 1, y, z))
index.east = getIdx(x + 1, y, z);
if (y > 0 && isInside(x, y - 1, z))
index.south = getIdx(x, y - 1, z);
if (y < nr[1] - 1 && isInside(x, y + 1, z))
if (y < nr_m[1] - 1 && isInside(x, y + 1, z))
index.north = getIdx(x, y + 1, z);
if (z > 0 && isInside(x, y, z - 1))
index.front = getIdx(x, y, z - 1);
if (z < nr[2] - 1 && isInside(x, y, z + 1))
if (z < nr_m[2] - 1 && isInside(x, y, z + 1))
index.back = getIdx(x, y, z + 1);
}
......@@ -78,5 +83,5 @@ void IrregularDomain::resizeMesh(Vector_t& origin, Vector_t& hr,
{
origin = min_m;
for (int i = 0; i < 3; i++)
hr[i] = (max_m[i] - min_m[i]) / nr[i];
hr[i] = (max_m[i] - min_m[i]) / nr_m[i];
};
\ No newline at end of file
......@@ -57,6 +57,10 @@ public:
typedef Stencil<int> StencilIndex_t;
typedef Stencil<double> StencilValue_t;
IrregularDomain(const Vector_t& nr,
const Vector_t& hr);
/** method to compute the intersection points with the boundary geometry
* (stored in some appropriate data structure)
* \param hr updated mesh spacings
......@@ -104,10 +108,10 @@ public:
/// \return boolean indicating if the point lies inside the boundary
virtual bool isInside(int x, int y, int z) = 0;
Vector_t getNr() { return nr; }
Vector_t getHr() { return hr; }
void setNr(Vector_t nri) { nr = nri; }
void setHr(Vector_t hri) { hr = hri; }
Vector_t getNr() { return nr_m; }
Vector_t getHr() { return hr_m; }
void setNr(Vector_t nr) { nr_m = nr; }
void setHr(Vector_t hr) { hr_m = hr; }
void setMinMaxZ(double minz, double maxz) { zMin_m=minz; zMax_m=maxz; }
double getMinZ() { return zMin_m; }
......@@ -145,9 +149,9 @@ protected:
// a irregular domain is always defined on a grid
/// number of mesh points in each direction
Vector_t nr;
Vector_t nr_m;
/// mesh-spacings in each direction
Vector_t hr;
Vector_t hr_m;
/// min/max of bunch in floor coordinates
double zMin_m;
......
......@@ -141,8 +141,10 @@ MGPoissonSolver::MGPoissonSolver ( PartBunch *beam,
"Please set PARFFTX=FALSE, PARFFTY=FALSE, PARFFTT=TRUE in \n"
"the definition of the field solver in the input file.\n");
}
Vector_t hr = (currentGeometry->getmaxcoords() -
currentGeometry->getmincoords()) / orig_nr_m;
bp_m = std::unique_ptr<IrregularDomain>(
new ArbitraryDomain(currentGeometry, orig_nr_m, hr_m, interpl));
new ArbitraryDomain(currentGeometry, orig_nr_m, hr, interpl));
}
map_p = Teuchos::null;
......
......@@ -28,17 +28,17 @@
#include "Solvers/RectangularDomain.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)
{
setRangeMin(Vector_t(-a, -b, getMinZ()));
setRangeMax(Vector_t( a, b, getMax/()));
setNr(nr);
setHr(hr);
setRangeMax(Vector_t( a, b, getMaxZ()));
nxy_m = nr[0] * nr[1];
}
void RectangularDomain::compute(Vector_t hr, NDIndex<3> /*localId*/){
setHr(hr);
nxy_m = nr[0] * nr[1];
nxy_m = nr_m[0] * nr_m[1];
}
int RectangularDomain::getNumXY(int /*z*/) {
......@@ -50,22 +50,22 @@ void RectangularDomain::getBoundaryStencil(int x, int y, int z, StencilValue_t&
{
//scaleFactor = 1.0;
//W = -1/hr[0]*1/hr[0];
//E = -1/hr[0]*1/hr[0];
//N = -1/hr[1]*1/hr[1];
//S = -1/hr[1]*1/hr[1];
//F = -1/hr[2]*1/hr[2];
//B = -1/hr[2]*1/hr[2];
//C = 2/hr[0]*1/hr[0] + 2/hr[1]*1/hr[1] + 2/hr[2]*1/hr[2];
scaleFactor = hr[0] * hr[1] * hr[2];
value.west = -hr[1] * hr[2] / hr[0];
value.east = -hr[1] * hr[2] / hr[0];
value.north = -hr[0] * hr[2] / hr[1];
value.south = -hr[0] * hr[2] / hr[1];
value.front = -hr[0] * hr[1] / hr[2];
value.back = -hr[0] * hr[1] / hr[2];
value.center = 2 * hr[1] * hr[2] / hr[0] + 2 * hr[0] * hr[2] / hr[1] + 2 * hr[0] * hr[1] / hr[2];
//W = -1/hr_m_m[0]*1/hr_m[0];
//E = -1/hr_m[0]*1/hr_m[0];
//N = -1/hr_m[1]*1/hr_m[1];
//S = -1/hr_m[1]*1/hr_m[1];
//F = -1/hr_m[2]*1/hr_m[2];
//B = -1/hr_m[2]*1/hr_m[2];
//C = 2/hr_m[0]*1/hr_m[0] + 2/hr_m[1]*1/hr_m[1] + 2/hr_m[2]*1/hr_m[2];
scaleFactor = hr_m[0] * hr_m[1] * hr_m[2];
value.west = -hr_m[1] * hr_m[2] / hr_m[0];
value.east = -hr_m[1] * hr_m[2] / hr_m[0];
value.north = -hr_m[0] * hr_m[2] / hr_m[1];
value.south = -hr_m[0] * hr_m[2] / hr_m[1];
value.front = -hr_m[0] * hr_m[1] / hr_m[2];
value.back = -hr_m[0] * hr_m[1] / hr_m[2];
value.center = 2 * hr_m[1] * hr_m[2] / hr_m[0] + 2 * hr_m[0] * hr_m[2] / hr_m[1] + 2 * hr_m[0] * hr_m[1] / hr_m[2];
if(!isInside(x + 1, y, z))
value.east = 0.0; //we are a right boundary point
......@@ -82,10 +82,10 @@ void RectangularDomain::getBoundaryStencil(int x, int y, int z, StencilValue_t&
//dirichlet
if(z == 0)
value.front = 0.0;