Commit 319f3956 authored by Tuelin Kaman's avatar Tuelin Kaman

use fastIsInside and count the number of intersections

parent d08b9a01
......@@ -1718,6 +1718,7 @@ void ParallelCyclotronTracker::Tracker_RK4() {
// main integration loop
*gmsg << "* ---------------------------- Start tracking ----------------------------" << endl;
for(; step_m < maxSteps_m; step_m++) {
*gmsg << "step_m=" << step_m << endl;
bool dumpEachTurn = false;
if(initialTotalNum_m > 2) {
// single particle dumping
......
This diff is collapsed.
......@@ -204,9 +204,9 @@ void MGPoissonSolver::computePotential(Field_t &rho, Vector_t hr) {
IpplTimings::startTimer(FunctionTimer3_m);
int id = 0;
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
if (bp->isInside(idx, idy, idz))
RHS->Values()[id++] = rho[idx][idy][idz].get();
}
......@@ -299,9 +299,9 @@ void MGPoissonSolver::computePotential(Field_t &rho, Vector_t hr) {
id = 0;
rho = 0.0;
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
NDIndex<3> l(Index(idx, idx), Index(idy, idy), Index(idz, idz));
if (bp->isInside(idx, idy, idz))
rho.localElement(l) = LHS->Values()[id++];
......@@ -316,9 +316,9 @@ void MGPoissonSolver::redistributeWithRCB(NDIndex<3> localId) {
int numMyGridPoints = 0;
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
if (bp->isInside(idx, idy, idz))
numMyGridPoints++;
}
......@@ -334,9 +334,9 @@ void MGPoissonSolver::redistributeWithRCB(NDIndex<3> localId) {
coords->ExtractView(&v, &stride);
stride2 = 2 * stride;
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
if (bp->isInside(idx, idy, idz)) {
v[0] = (double)idx;
v[stride] = (double)idy;
......@@ -375,9 +375,9 @@ void MGPoissonSolver::IPPLToMap3D(NDIndex<3> localId) {
int NumMyElements = 0;
vector<int> MyGlobalElements;
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idy = localId[1].first(); idy <= localId[1].last(); idy++) {
for (int idz = localId[2].first(); idz <= localId[2].last(); idz++) {
for (int idx = localId[0].first(); idx <= localId[0].last(); idx++) {
if (bp->isInside(idx, idy, idz)) {
MyGlobalElements.push_back(bp->getIdx(idx, idy, idz));
NumMyElements++;
......@@ -385,7 +385,6 @@ void MGPoissonSolver::IPPLToMap3D(NDIndex<3> localId) {
}
}
}
Map = new Epetra_Map(-1, NumMyElements, &MyGlobalElements[0], 0, Comm);
}
......
......@@ -1848,13 +1848,13 @@ BoundaryGeometry::intersectLineSegmentBoundary4PartInside (
assert (intersect_result != -1);
exit (42); // terminate even if NDEBUG is set
case 0: // no intersection
case 2: // both points are outside
case 4: // both points are inside
intersect_result = 0;
break;
case 1: // line and triangle are in same plane
case 2: // both points are outside
case 3: // unique intersection in segment
*gmsg << "* Intersection test returned: " << intersect_result << endl;
//*gmsg << "* Intersection test returned: " << intersect_result << endl;
triangle_id = (*it);
goto done;
};
......
......@@ -246,7 +246,7 @@ void FieldSolver::initSolver(PartBunch &b) {
std::vector<BoundaryGeometry *> geometries;
for(unsigned int i = 0; i <= geoms.length(); i++) {
if(geoms[i] == ',' || i == geoms.length()) {
BoundaryGeometry *geom = BoundaryGeometry::find(tmp)->clone(getOpalName() + string("_geometry"));
BoundaryGeometry *geom = BoundaryGeometry::find(Attributes::getString(itsAttr[GEOMETRY]))->clone(getOpalName() + string("_geometry"));
if(geom != 0) {
geometries.push_back(geom);
}
......
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