Commit d55c5d0c authored by Kaman Tülin's avatar Kaman Tülin
Browse files

Mesh the whole domain; take into account the bunch offset; ippl to 3D mapping...

Mesh the whole domain; take into account the bunch offset; ippl to 3D mapping for multicore simulations are handled
parent 85046c8a
......@@ -701,6 +701,10 @@ void PartBunch::computeSelfFields(int binNumber) {
eg_m = Vector_t(0.0);
if(fs_m->hasValidSolver()) {
/// Mesh the whole domain
if(fs_m->getFieldSolverType() == "SAAMG")
resizeMesh();
/// Scatter charge onto space charge grid.
this->Q *= this->dt;
if(!interpolationCacheSet_m) {
......@@ -893,8 +897,8 @@ void PartBunch::resizeMesh() {
double xmax = fs_m->solver_m->getXRangeMax();
double ymin = fs_m->solver_m->getYRangeMin();
double ymax = fs_m->solver_m->getYRangeMax();
double zmin = rmin_m[2]; //fs_m->solver_m->getZRangeMin();
double zmax = rmax_m[2]; //fs_m->solver_m->getZRangeMax();
double zmin = fs_m->solver_m->getZRangeMin();
double zmax = fs_m->solver_m->getZRangeMax();
if(xmin > rmin_m[0] || xmax < rmax_m[0] ||
ymin > rmin_m[1] || ymax < rmax_m[1]) {
......@@ -915,12 +919,11 @@ void PartBunch::resizeMesh() {
boundp();
get_bounds(rmin_m, rmax_m);
}
// extend domain with extra "ghost" point
Vector_t mymin = Vector_t(xmin, ymin , zmin-hr_m[2]);
Vector_t mymax = Vector_t(xmax, ymax , zmax+hr_m[2]);
Vector_t mymin = Vector_t(xmin, ymin , zmin);
Vector_t mymax = Vector_t(xmax, ymax , zmax);
for(int i = 0; i < 3; i++)
hr_m[i] = (mymax[i] - mymin[i]) / nr_m[i];
hr_m[i] = (mymax[i] - mymin[i])/nr_m[i];
getMesh().set_meshSpacing(&(hr_m[0]));
getMesh().set_origin(mymin);
......@@ -945,10 +948,9 @@ void PartBunch::computeSelfFields() {
eg_m = Vector_t(0.0);
if(fs_m->hasValidSolver()) {
//use the mesh that is already set
//if (fs_m->getFieldSolverType() == "SAAMG")
// resizeMesh();
// INFOMSG("after resizeMesh" << hr_m << endl);
//mesh the whole domain
if(fs_m->getFieldSolverType() == "SAAMG")
resizeMesh();
INFOMSG("mesh size" << hr_m << endl);
//scatter charges onto grid
......@@ -1220,6 +1222,9 @@ void PartBunch::computeSelfFields_cycl(double gamma) {
eg_m = Vector_t(0.0);
if(fs_m->hasValidSolver()) {
/// mesh the whole domain
if(fs_m->getFieldSolverType() == "SAAMG")
resizeMesh();
/// scatter particles charge onto grid.
this->Q.scatter(this->rho_m, this->R, IntrplCIC_t());
......@@ -1412,6 +1417,9 @@ void PartBunch::computeSelfFields_cycl(int bin) {
double gamma = getBinGamma(bin);
if(fs_m->hasValidSolver()) {
/// mesh the whole domain
if(fs_m->getFieldSolverType() == "SAAMG")
resizeMesh();
/// scatter particles charge onto grid.
this->Q.scatter(this->rho_m, this->R, IntrplCIC_t());
......@@ -2950,4 +2958,4 @@ bool PartBunch::WeHaveEnergyBins() {
return dist_m->GetNumberOfEnergyBins() > 0;
else
return false;
}
\ No newline at end of file
}
......@@ -3252,4 +3252,4 @@ Vector_t ParallelTTracker::calcMeanP() const {
}
reduce(meanP, meanP, OpAddAssign());
return meanP / Vector_t(itsBunch->getTotalNum());
}
\ No newline at end of file
}
......@@ -32,9 +32,12 @@ ArbitraryDomain::ArbitraryDomain( BoundaryGeometry * bgeom,
bgeom_m = bgeom;
minCoords_m = bgeom->getmincoords();
maxCoords_m = bgeom->getmaxcoords();
geomCentroid_m = (minCoords_m + maxCoords_m)/2.0;
setNr(nr);
setHr(hr);
for(int i=0; i<3; i++)
Geo_hr_m[i] = (maxCoords_m[i] - minCoords_m[i])/nr[i];
setHr(Geo_hr_m);
startId = 0;
......@@ -50,22 +53,16 @@ ArbitraryDomain::~ArbitraryDomain() {
//nothing so far
}
void ArbitraryDomain::Compute(Vector_t hr) {
void ArbitraryDomain::Compute(Vector_t hr){
setHr(hr);
}
/*
void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
globalMeanR_m = getGlobalMeanR();
setHr(hr);
setNr(nr);
int zGhostOffsetLeft = (localId[2].first()== 0) ? 0 : 1;
int zGhostOffsetRight = (localId[2].last() == nr[2] - 1) ? 0 : 1;
int yGhostOffsetLeft = (localId[1].first()== 0) ? 0 : 1;
int yGhostOffsetRight = (localId[1].last() == nr[1] - 1) ? 0 : 1;
int xGhostOffsetLeft = (localId[0].first()== 0) ? 0 : 1;
int xGhostOffsetRight = (localId[0].last() == nr[0] - 1) ? 0 : 1;
globalToLocalQuaternion_m = getGlobalToLocalQuaternion();
localToGlobalQuaternion_m[0] = globalToLocalQuaternion_m[0];
for (int i=1; i<4; i++)
localToGlobalQuaternion_m[i] = -globalToLocalQuaternion_m[i];
hasGeometryChanged_m = true;
......@@ -76,153 +73,114 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId) {
IntersectLoZ.clear();
IntersectHiZ.clear();
//calculate intersection
Vector_t P, dir, I;
for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
P[2] = (idz - (nr[2]-1)/2.0)*hr[2];
Vector_t P, saveP, dir, I;
//Reference Point
Vector_t P0 = geomCentroid_m;
for (int idy = localId[1].first()-yGhostOffsetLeft; idy <= localId[1].last()+yGhostOffsetRight; idy++) {
P[1] = (idy - (nr[1]-1)/2.0)*hr[1];
for (int idz = 0; idz < nr[2] ; idz++) {
saveP[2] = (idz - (nr[2]-1)/2.0)*hr[2];
for (int idy = 0; idy < nr[1] ; idy++) {
saveP[1] = (idy - (nr[1]-1)/2.0)*hr[1];
for (int idx = 0; idx <nr[0]; idx++) {
saveP[0] = (idx - (nr[0]-1)/2.0)*hr[0];
P = saveP;
for (int idx = localId[0].first()-xGhostOffsetLeft; idx <= localId[0].last()+xGhostOffsetRight; idx++) {
P[0] = (idx - (nr[0]-1)/2.0)*hr[0];
rotateWithQuaternion(P, localToGlobalQuaternion_m);
P += geomCentroid_m;
std::tuple<int, int, int> pos(idx, idy, idz);
if (bgeom_m->fastIsInside(P0, P) % 2 == 0) {
P0 = P;
dir = Vector_t(0,0,1);
if (bgeom_m->intersectRayBoundary(P, dir, I))
IntersectHiZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
std::tuple<int, int, int> pos(idx, idy, idz);
dir = Vector_t(0,0,-1);
if (bgeom_m->intersectRayBoundary(P, dir, I))
IntersectLoZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
rotateZAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "zdir=+1 " << dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "zdir=-1 " << -dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
dir = Vector_t(0,1,0);
if (bgeom_m->intersectRayBoundary(P, dir, I))
rotateYAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "ydir=+1 " << dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
dir = Vector_t(0,-1,0);
if (bgeom_m->intersectRayBoundary(P, dir, I))
IntersectLoY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "ydir=-1" << -dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
dir = Vector_t(1,0,0);
if (bgeom_m->intersectRayBoundary(P, dir, I))
IntersectHiX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
rotateXAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "xdir=+1 " << dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
dir = Vector_t(-1,0,0);
if (bgeom_m->intersectRayBoundary(P, dir, I))
IntersectLoX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
}
if (bgeom_m->intersectRayBoundary(P, -dir, I)){
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "xdir=-1 " << -dir << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
*gmsg << "OUTSIDE" << " x,y,z= " << idx << "," << idy << "," << idz << " P=" << P <<" I=" << I << endl;
#endif
}
}
}
}
//number of ghost nodes to the right
int znumGhostNodesRight = 0;
if(zGhostOffsetRight != 0) {
for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for(int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
if(isInside(idx, idy, localId[2].last() + zGhostOffsetRight))
znumGhostNodesRight++;
}
}
}
//number of ghost nodes to the left
int znumGhostNodesLeft = 0;
if(zGhostOffsetLeft != 0) {
for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for(int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
if(isInside(idx, idy, localId[2].first() - zGhostOffsetLeft))
znumGhostNodesLeft++;
}
}
}
//number of ghost nodes to the right
int ynumGhostNodesRight = 0;
if(yGhostOffsetRight != 0) {
for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for(int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
if(isInside(idx, localId[1].last() + yGhostOffsetRight, idz))
ynumGhostNodesRight++;
}
}
}
//number of ghost nodes to the left
int ynumGhostNodesLeft = 0;
if(yGhostOffsetLeft != 0) {
for(int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for(int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
if(isInside(idx, localId[1].first() - yGhostOffsetLeft, idz))
ynumGhostNodesLeft++;
}
}
}
//number of ghost nodes to the right
int xnumGhostNodesRight = 0;
if(xGhostOffsetRight != 0) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
if(isInside(localId[0].last() + xGhostOffsetRight, idy, idz))
xnumGhostNodesRight++;
}
}
}
//number of ghost nodes to the left
int xnumGhostNodesLeft = 0;
if(xGhostOffsetLeft != 0) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for(int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
if(isInside(localId[0].first() - xGhostOffsetLeft, idy, idz))
xnumGhostNodesLeft++;
}
}
}
//xy points in z plane
int numxy;
int numtotalxy = 0;
numXY.clear();
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
numxy =0;
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idx =localId[0].first(); idx <= localId[0].last(); idx++) {
if (isInside(idx, idy, idz))
numxy++;
}
}
numtotalxy += numxy;
}
startId = 0;
MPI_Scan(&numtotalxy, &startId, 1, MPI_INTEGER, MPI_SUM, Ippl::getComm());
startId -= numtotalxy;
//build up index and coord map
IdxMap.clear();
CoordMap.clear();
register int id = startId - xnumGhostNodesLeft - ynumGhostNodesLeft - znumGhostNodesLeft;
for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
for (int idy = localId[1].first()-yGhostOffsetLeft; idy <= localId[1].last()+yGhostOffsetRight; idy++) {
for (int idx = localId[0].first()-xGhostOffsetLeft; idx <= localId[0].last()+xGhostOffsetRight; idx++) {
if (isInside(idx, idy, idz)) {
IdxMap[toCoordIdx(idx, idy, idz)] = id;
CoordMap[id] = toCoordIdx(idx, idy, idz);
id++;
}
}
register int id=0;
register int idx, idy, idz;
for (idz = 0; idz < nr[2]; idz++) {
for (idy = 0; idy < nr[1]; idy++) {
for (idx = 0; idx < nr[0]; idx++) {
if (isInside(idx, idy, idz)) {
IdxMap[toCoordIdx(idx, idy, idz)] = id;
CoordMap[id] = toCoordIdx(idx, idy, idz);
id++;
}
}
}
}
}
*/
void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
......@@ -254,16 +212,18 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
//calculate intersection
Vector_t P, saveP, dir, I;
//Reference Point
Vector_t P0 = globalMeanR_m;
Vector_t P0 = geomCentroid_m;
for (int idz = localId[2].first()-zGhostOffsetLeft; idz <= localId[2].last()+zGhostOffsetRight; idz++) {
saveP[2] = (idz - (nr[2]-1)/2.0)*hr[2];
for (int idy = localId[1].first()-yGhostOffsetLeft; idy <= localId[1].last()+yGhostOffsetRight; idy++) {
saveP[1] = (idy - (nr[1]-1)/2.0)*hr[1];
for (int idx = localId[0].first()-xGhostOffsetLeft; idx <= localId[0].last()+xGhostOffsetRight; idx++) {
saveP[0] = (idx - (nr[0]-1)/2.0)*hr[0];
P = saveP;
rotateWithQuaternion(P, localToGlobalQuaternion_m);
P += globalMeanR_m;
P += geomCentroid_m;
if (bgeom_m->fastIsInside(P0, P) % 2 == 0) {
P0 = P;
......@@ -272,8 +232,8 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
rotateZAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= globalMeanR_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
} else {
#ifdef DEBUG_INTERSECT_RAY_BOUNDARY
......@@ -282,7 +242,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
}
if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
I -= globalMeanR_m;
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoZ.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[2]));
} else {
......@@ -293,7 +253,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
rotateYAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= globalMeanR_m;
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
} else {
......@@ -303,7 +263,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
}
if (bgeom_m->intersectRayBoundary(P, -dir, I)) {
I -= globalMeanR_m;
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoY.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[1]));
} else {
......@@ -314,7 +274,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
rotateXAxisWithQuaternion(dir, localToGlobalQuaternion_m);
if (bgeom_m->intersectRayBoundary(P, dir, I)) {
I -= globalMeanR_m;
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectHiX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
} else {
......@@ -324,7 +284,7 @@ void ArbitraryDomain::Compute(Vector_t hr, NDIndex<3> localId){
}
if (bgeom_m->intersectRayBoundary(P, -dir, I)){
I -= globalMeanR_m;
I -= geomCentroid_m;
rotateWithQuaternion(I, globalToLocalQuaternion_m);
IntersectLoX.insert(std::pair< std::tuple<int, int, int>, double >(pos, I[0]));
} else {
......@@ -340,19 +300,54 @@ 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++) {
if(isInside(idx, idy, localId[2].first() - zGhostOffsetLeft))
numGhostNodesLeft++;
}
}
}
//xy points in z plane
int numxy = 0;
int numtotal = 0;
numXY.clear();
for(int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
numxy = 0;
for(int idx = 0; idx < nr[0]; idx++) {
for(int idy = 0; idy < nr[1]; idy++) {
if(isInside(idx, idy, idz))
numxy++;
}
}
numXY[idz-localId[2].first()] = numxy;
numtotal += numxy;
}
int startIdx = 0;
MPI_Scan(&numtotal, &startIdx, 1, MPI_INTEGER, MPI_SUM, MPI_COMM_WORLD);
startIdx -= numtotal;
//build up index and coord map
IdxMap.clear();
CoordMap.clear();
register int index = startIdx - numGhostNodesLeft;
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++) {
if(isInside(idx, idy, idz)) {
IdxMap[toCoordIdx(idx, idy, idz)] = index;
CoordMap[index] = toCoordIdx(idx, idy, idz);
index++;
}
register int id=0;
for (int idz = 0; idz < nr[2]; idz++) {
for (int idy = 0; idy < nr[1]; idy++) {
for (int idx = 0; idx < nr[0]; idx++) {
IdxMap[toCoordIdx(idx, idy, idz)] = id;
CoordMap[id++] = toCoordIdx(idx, idy, idz);
}
}
}
}
}
}
// Conversion from (x,y,z) to index in xyz plane
......@@ -362,12 +357,14 @@ inline int ArbitraryDomain::toCoordIdx(int idx, int idy, int idz) {
// Conversion from (x,y,z) to index on the 3D grid
int ArbitraryDomain::getIdx(int idx, int idy, int idz) {
return IdxMap[toCoordIdx(idx, idy, idz)];
if(isInside(idx, idy, idz) && idx >= 0 && idy >= 0 && idz >= 0)
return IdxMap[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];
idx = id % (int)nr[0];
id /= nr[0];
......
......@@ -39,7 +39,7 @@ public:
/// returns number of nodes in xy plane
int getNumXY(int idz);
/// calculates intersection
// calculates intersection
void Compute(Vector_t hr);
// calculates intersection with rotated and shifted geometry
void Compute(Vector_t hr, NDIndex<3> localId);
......@@ -93,7 +93,7 @@ private:
std::map<int, int> numXZ;
// Number of nodes in the xy plane (for this case: independent of the z coordinate)
int nxy_m;
int nxy_m[1000];
// mapping (x,y,z) -> idxyz
std::map<int, int> IdxMap;
// Mapping idxyz -> (x,y,z)
......@@ -106,6 +106,7 @@ private:
Vector_t Geo_nr_m;
Vector_t Geo_hr_m;
Vector_t geomCentroid_m;
Vector_t minCoords_m;
Vector_t maxCoords_m;
......
......@@ -29,6 +29,39 @@ EllipticDomain::EllipticDomain(double semimajor, double semiminor, Vector_t nr,
interpolationMethod = QUADRATIC;
}
EllipticDomain::EllipticDomain(BoundaryGeometry *bgeom, Vector_t nr, Vector_t hr, std::string interpl) {
SemiMajor = bgeom->getA();
SemiMinor = bgeom->getB();
setMinMaxZ(bgeom->getS(), bgeom->getLength());
setNr(nr);
setHr(hr);
if(interpl == "CONSTANT")
interpolationMethod = CONSTANT;
else if(interpl == "LINEAR")
interpolationMethod = LINEAR;
else if(interpl == "QUADRATIC")
interpolationMethod = QUADRATIC;
}
EllipticDomain::EllipticDomain(BoundaryGeometry *bgeom, Vector_t nr, std::string interpl) {
SemiMajor = bgeom->getA();
SemiMinor = bgeom->getB();
setMinMaxZ(bgeom->getS(), bgeom->getLength());
Vector_t hr_m;
hr_m[0] = (getXRangeMax()-getXRangeMin())/nr[0];
hr_m[1] = (getYRangeMax()-getYRangeMin())/nr[1];
hr_m[2] = (getZRangeMax()-getZRangeMin())/nr[2];
setHr(hr_m);
if(interpl == "CONSTANT")
interpolationMethod = CONSTANT;
else if(interpl == "LINEAR")
interpolationMethod = LINEAR;
else if(interpl == "QUADRATIC")
interpolationMethod = QUADRATIC;
}
EllipticDomain::~EllipticDomain() {
//nothing so far
}
......@@ -143,7 +176,6 @@ void EllipticDomain::Compute(Vector_t hr, NDIndex<3> localId){
CoordMap[idx++] = toCoordIdx(x, y);
nxy_m++;
}
}
}
......
......@@ -7,6 +7,7 @@
#include <string>
#include <cmath>
#include "IrregularDomain.h"
#include "Structure/BoundaryGeometry.h"
class EllipticDomain : public IrregularDomain {
......@@ -14,6 +15,9 @@ public:
EllipticDomain(Vector_t nr, Vector_t hr);
EllipticDomain(double semimajor, double semiminor, Vector_t nr, Vector_t hr, std::string interpl);