Skip to content
Snippets Groups Projects
Commit 5bd0d6b6 authored by Jonathan Lambrechts's avatar Jonathan Lambrechts
Browse files

fix searchAllElements in OctreeInternals

parent 64c06ef5
No related branches found
No related tags found
No related merge requests found
...@@ -403,6 +403,18 @@ void *searchAllElements(octantBucket *_buckets_head, double *_pt, globalInfo *_g ...@@ -403,6 +403,18 @@ void *searchAllElements(octantBucket *_buckets_head, double *_pt, globalInfo *_g
#endif #endif
flag1 = 0; flag1 = 0;
ELink ptr1 = ptrBucket->lhead;
while (ptr1 != NULL){
flag = xyzInElementBB(_pt, ptr1->region, BBElement);
if (flag == 1)
flag = xyzInElement(ptr1->region, _pt);
if (flag == 1) {
_elements->push_back(ptr1->region);
flag1 = 1;
}
ptr1 = ptr1->next;
}
for (iter = (ptrBucket->listBB).begin(); for (iter = (ptrBucket->listBB).begin();
iter != (ptrBucket->listBB).end(); iter++){ iter != (ptrBucket->listBB).end(); iter++){
flag = xyzInElementBB(_pt, *iter, BBElement); flag = xyzInElementBB(_pt, *iter, BBElement);
......
...@@ -115,7 +115,16 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) ...@@ -115,7 +115,16 @@ MElement *MElementOctree::find(double x, double y, double z, int dim)
{ {
double P[3] = {x, y, z}; double P[3] = {x, y, z};
MElement *e = (MElement*)Octree_Search(P, _octree); MElement *e = (MElement*)Octree_Search(P, _octree);
if (dim == -1 || !e || e->getDim() == dim)
return e;
std::list<void*> l;
Octree_SearchAll(P, _octree, &l);
for (std::list<void*>::iterator it = l.begin(); it != l.end(); it++) {
MElement *el = (MElement*) *it;
if (el->getDim() == dim)
return el;
}
// JF : can you check if this is still needed, now that we changed Octree_SearchAll
if (!e || (dim != -1 && e->getDim() != dim)){ if (!e || (dim != -1 && e->getDim() != dim)){
double initialTol = MElement::getTolerance(); double initialTol = MElement::getTolerance();
double tol = initialTol; double tol = initialTol;
...@@ -129,7 +138,6 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) ...@@ -129,7 +138,6 @@ MElement *MElementOctree::find(double x, double y, double z, int dim)
e = entities[i]->getMeshElement(j); e = entities[i]->getMeshElement(j);
if (dim == -1 || e->getDim() == dim){ if (dim == -1 || e->getDim() == dim){
if (MElementInEle(e, P)){ if (MElementInEle(e, P)){
// printf("coucou FOUND\n");
MElement::setTolerance(initialTol); MElement::setTolerance(initialTol);
return e; return e;
} }
...@@ -140,16 +148,5 @@ MElement *MElementOctree::find(double x, double y, double z, int dim) ...@@ -140,16 +148,5 @@ MElement *MElementOctree::find(double x, double y, double z, int dim)
MElement::setTolerance(initialTol); MElement::setTolerance(initialTol);
Msg::Warning("Point %g %g %g not found",x,y,z); Msg::Warning("Point %g %g %g not found",x,y,z);
} }
if (dim == -1 || !e || e->getDim() == dim)
return e;
std::list<void*> l;
Octree_SearchAll(P, _octree, &l);
for (std::list<void*>::iterator it = l.begin(); it != l.end(); it++) {
MElement *el = (MElement*) *it;
if (el->getDim() == dim)
return el;
}
return NULL; return NULL;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment