Commit d4f6cf5a authored by franjo's avatar franjo
Browse files

Improvements of intersection detection and non-manifold meshing


git-svn-id: https://pl5.projectlocker.com/igui/meshGeneration/svn@8 fdcce57e-7e00-11e2-b579-49867b4cea03
parent 98242960
......@@ -109,6 +109,30 @@ void findCellsIntersectingSurface::findIntersectedCells()
}
}
//- remove triangles which do not intersect the bounding box
labelHashSet reasonableCandidates;
const pointField& sp = surf.points();
forAllConstIter(labelHashSet, triangles, tIter)
{
const labelledTri& tri = surf[tIter.key()];
boundBox obb(sp[tri[0]], sp[tri[0]]);
for(label i=1;i<3;++i)
{
const point& v = sp[tri[i]];
obb.min() = Foam::min(obb.min(), v);
obb.max() = Foam::max(obb.max(), v);
}
obb.min() -= vector(VSMALL, VSMALL, VSMALL);
obb.max() += vector(VSMALL, VSMALL, VSMALL);
if( obb.overlaps(bb) )
reasonableCandidates.insert(tIter.key());
}
triangles.transfer(reasonableCandidates);
//- check if any triangle in the surface mesh
//- intersects any of the cell's faces
labelHashSet facetsInCell;
......@@ -140,6 +164,9 @@ void findCellsIntersectingSurface::findIntersectedCells()
labelHashSet nodes;
forAllConstIter(labelHashSet, triangles, tIter)
{
if( facetsInCell.found(tIter.key()) )
continue;
const labelledTri& tri = surf[tIter.key()];
for(label i=0;i<3;++i)
......@@ -216,7 +243,9 @@ void findCellsIntersectingSurface::findIntersectedCells()
intersectedCells_[cellI] = intersected;
# pragma omp critical
facetsIntersectingCell_.setRow(cellI, facetsInCell.toc());
{
facetsIntersectingCell_.setRow(cellI, facetsInCell.toc());
}
}
}
......
......@@ -196,6 +196,36 @@ bool findNonManifoldInterfaces::findFaceCandidates()
}
}
# ifdef DEBUGNonManifoldInterfaces
Map<label> regionToID;
forAll(internalFacePatches_, faceI)
{
forAllRow(internalFacePatches_, faceI, i)
{
const label regionI = internalFacePatches_(faceI, i);
Map<label>::iterator iter = regionToID.find(regionI);
if( iter == regionToID.end() )
{
const word sName =
"interfaceFaceToPatch_" +
mesh_.boundaries()[regionI].patchName();
regionToID.insert
(
regionI,
mesh_.addFaceSubset(sName)
);
iter = regionToID.find(regionI);
}
mesh_.addFaceToSubset(iter(), faceI);
}
}
const label problemFacesID = mesh_.addFaceSubset("problematicFaces");
# endif
//- check if there exist any proximity problems
forAll(internalFacePatches_, faceI)
{
......@@ -203,6 +233,12 @@ bool findNonManifoldInterfaces::findFaceCandidates()
continue;
//- check if it is a proximity problem
Info << "More than one internal interface assigned to face "
<< faceI << endl;
# ifdef DEBUGNonManifoldInterfaces
mesh_.addFaceToSubset(problemFacesID, faceI);
# endif
}
return false;
......
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