Skip to content
Snippets Groups Projects
Commit 8cdb70f5 authored by Thomas Toulorge's avatar Thomas Toulorge
Browse files

Fixed bugs in blob creation in old HO mesh optimizer

parent d6a63345
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#if defined(HAVE_BFGS) #if defined(HAVE_BFGS)
typedef std::vector<MElement*> elVec; typedef std::vector<MElement*> elVec;
typedef elVec::iterator elVecIter;
typedef elVec::const_iterator elVecConstIter; typedef elVec::const_iterator elVecConstIter;
typedef std::set<MElement*> elSet; typedef std::set<MElement*> elSet;
typedef elSet::iterator elSetIter; typedef elSet::iterator elSetIter;
...@@ -233,7 +232,6 @@ static bool testTriSphereIntersect(SPoint3 A, SPoint3 B, SPoint3 C, ...@@ -233,7 +232,6 @@ static bool testTriSphereIntersect(SPoint3 A, SPoint3 B, SPoint3 C,
// Approximate test of intersection element with circle/sphere by sampling // Approximate test of intersection element with circle/sphere by sampling
static bool testElInDist(const SPoint3 p, double limDist, MElement *el) static bool testElInDist(const SPoint3 p, double limDist, MElement *el)
{ {
const double sampleLen = 0.5*limDist; // Distance between sample points
const double limDistSq = limDist*limDist; const double limDistSq = limDist*limDist;
if (el->getDim() == 2) { // 2D? if (el->getDim() == 2) { // 2D?
...@@ -242,9 +240,7 @@ static bool testElInDist(const SPoint3 p, double limDist, MElement *el) ...@@ -242,9 +240,7 @@ static bool testElInDist(const SPoint3 p, double limDist, MElement *el)
el->getEdgeVertices(iEd, edgeVert); el->getEdgeVertices(iEd, edgeVert);
const SPoint3 A = edgeVert[0]->point(); const SPoint3 A = edgeVert[0]->point();
const SPoint3 B = edgeVert[1]->point(); const SPoint3 B = edgeVert[1]->point();
if (testSegSphereIntersect(A, B, p, limDistSq)) { if (testSegSphereIntersect(A, B, p, limDistSq)) return true;
return true;
}
} }
} }
else { // 3D else { // 3D
...@@ -255,11 +251,11 @@ static bool testElInDist(const SPoint3 p, double limDist, MElement *el) ...@@ -255,11 +251,11 @@ static bool testElInDist(const SPoint3 p, double limDist, MElement *el)
const SPoint3 B = faceVert[1]->point(); const SPoint3 B = faceVert[1]->point();
const SPoint3 C = faceVert[2]->point(); const SPoint3 C = faceVert[2]->point();
if (faceVert.size() == 3) if (faceVert.size() == 3)
return testTriSphereIntersect(A, B, C, p, limDistSq); if (testTriSphereIntersect(A, B, C, p, limDistSq)) return true;
else { else {
const SPoint3 D = faceVert[3]->point(); const SPoint3 D = faceVert[3]->point();
return (testTriSphereIntersect(A, B, C, p, limDistSq) || if (testTriSphereIntersect(A, B, C, p, limDistSq) ||
testTriSphereIntersect(A, C, D, p, limDistSq)); testTriSphereIntersect(A, C, D, p, limDistSq)) return true;
} }
} }
} }
...@@ -273,12 +269,13 @@ static void getElementNeighbours(MElement *el, const vertElVecMap &v2e, ...@@ -273,12 +269,13 @@ static void getElementNeighbours(MElement *el, const vertElVecMap &v2e,
{ {
elElSetMap::iterator it = e2e.find(el); elElSetMap::iterator it = e2e.find(el);
if (it == e2e.end()) { // If not in e2e, compute and store if (it == e2e.end()) { // If not in e2e, compute and store
neighbours.clear();
for (int i = 0; i < el->getNumPrimaryVertices(); ++i) { for (int i = 0; i < el->getNumPrimaryVertices(); ++i) {
const elVec &adjEl = v2e.find(el->getVertex(i))->second; const elVec &adjEl = v2e.find(el->getVertex(i))->second;
neighbours.clear(); for(elVecConstIter itA = adjEl.begin(); itA != adjEl.end(); itA++)
neighbours.insert(adjEl.begin(), adjEl.end()); if (*itA != el) neighbours.insert(*itA);
e2e.insert(std::pair<MElement*, elSet>(el, neighbours));
} }
e2e.insert(std::pair<MElement*, elSet>(el, neighbours));
} }
else neighbours = it->second; else neighbours = it->second;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment