diff --git a/src/sampling/sampledSurface/isoSurface/isoSurface.C b/src/sampling/sampledSurface/isoSurface/isoSurface.C index a9d57ad500..bff64af5cf 100644 --- a/src/sampling/sampledSurface/isoSurface/isoSurface.C +++ b/src/sampling/sampledSurface/isoSurface/isoSurface.C @@ -37,7 +37,7 @@ License namespace Foam { -defineTypeNameAndDebug(isoSurface, 0); + defineTypeNameAndDebug(isoSurface, 0); } @@ -58,7 +58,6 @@ bool Foam::isoSurface::noTransform(const tensor& tt) const } -// Calculates per face whether couple is collocated. bool Foam::isoSurface::collocatedPatch(const polyPatch& pp) { const coupledPolyPatch& cpp = refCast(pp); @@ -66,7 +65,6 @@ bool Foam::isoSurface::collocatedPatch(const polyPatch& pp) } -// Calculates per face whether couple is collocated. Foam::PackedBoolList Foam::isoSurface::collocatedFaces ( const coupledPolyPatch& pp @@ -297,7 +295,6 @@ bool Foam::isoSurface::isEdgeOfFaceCut } -// Get neighbour value and position. void Foam::isoSurface::getNeighbour ( const labelList& boundaryRegion, @@ -331,7 +328,6 @@ void Foam::isoSurface::getNeighbour } -// Determine for every face/cell whether it (possibly) generates triangles. void Foam::isoSurface::calcCutTypes ( const labelList& boundaryRegion, @@ -471,43 +467,6 @@ void Foam::isoSurface::calcCutTypes } -// Return the two common points between two triangles -Foam::labelPair Foam::isoSurface::findCommonPoints -( - const labelledTri& tri0, - const labelledTri& tri1 -) -{ - labelPair common(-1, -1); - - label fp0 = 0; - label fp1 = findIndex(tri1, tri0[fp0]); - - if (fp1 == -1) - { - fp0 = 1; - fp1 = findIndex(tri1, tri0[fp0]); - } - - if (fp1 != -1) - { - // So tri0[fp0] is tri1[fp1] - - // Find next common point - label fp0p1 = tri0.fcIndex(fp0); - label fp1p1 = tri1.fcIndex(fp1); - label fp1m1 = tri1.rcIndex(fp1); - - if (tri0[fp0p1] == tri1[fp1p1] || tri0[fp0p1] == tri1[fp1m1]) - { - common[0] = tri0[fp0]; - common[1] = tri0[fp0p1]; - } - } - return common; -} - - // Caculate centre of surface. Foam::point Foam::isoSurface::calcCentre(const triSurface& s) { @@ -521,75 +480,6 @@ Foam::point Foam::isoSurface::calcCentre(const triSurface& s) } -// Replace surface (localPoints, localTris) with single point. Returns -// point. Destructs arguments. -Foam::pointIndexHit Foam::isoSurface::collapseSurface -( - pointField& localPoints, - DynamicList& localTris -) -{ - pointIndexHit info(false, vector::zero, localTris.size()); - - if (localTris.size() == 1) - { - const labelledTri& tri = localTris[0]; - info.setPoint(tri.centre(localPoints)); - info.setHit(); - } - else if (localTris.size() == 2) - { - // Check if the two triangles share an edge. - const labelledTri& tri0 = localTris[0]; - const labelledTri& tri1 = localTris[0]; - - labelPair shared = findCommonPoints(tri0, tri1); - - if (shared[0] != -1) - { - info.setPoint - ( - 0.5 - * ( - tri0.centre(localPoints) - + tri1.centre(localPoints) - ) - ); - info.setHit(); - } - } - else if (localTris.size()) - { - // Check if single region. Rare situation. - triSurface surf - ( - localTris, - geometricSurfacePatchList(0), - localPoints, - true - ); - localTris.clearStorage(); - - labelList faceZone; - label nZones = surf.markZones - ( - boolList(surf.nEdges(), false), - faceZone - ); - - if (nZones == 1) - { - info.setPoint(calcCentre(surf)); - info.setHit(); - } - } - - return info; -} - - -// Determine per cell centre whether all the intersections get collapsed -// to a single point void Foam::isoSurface::calcSnappedCc ( const labelList& boundaryRegion, @@ -755,8 +645,6 @@ void Foam::isoSurface::calcSnappedCc } -// Determine per meshpoint whether all the intersections get collapsed -// to a single point void Foam::isoSurface::calcSnappedPoint ( const PackedBoolList& isBoundaryPoint, @@ -1131,7 +1019,6 @@ Foam::triSurface Foam::isoSurface::stitchTriPoints } -// Does face use valid vertices? bool Foam::isoSurface::validTri(const triSurface& surf, const label faceI) { // Simple check on indices ok. @@ -1202,435 +1089,6 @@ bool Foam::isoSurface::validTri(const triSurface& surf, const label faceI) } -void Foam::isoSurface::calcAddressing -( - const triSurface& surf, - List>& faceEdges, - labelList& edgeFace0, - labelList& edgeFace1, - Map& edgeFacesRest -) const -{ - const pointField& points = surf.points(); - - pointField edgeCentres(3*surf.size()); - label edgeI = 0; - forAll(surf, triI) - { - const labelledTri& tri = surf[triI]; - edgeCentres[edgeI++] = 0.5*(points[tri[0]]+points[tri[1]]); - edgeCentres[edgeI++] = 0.5*(points[tri[1]]+points[tri[2]]); - edgeCentres[edgeI++] = 0.5*(points[tri[2]]+points[tri[0]]); - } - - pointField mergedCentres; - labelList oldToMerged; - bool hasMerged = mergePoints - ( - edgeCentres, - mergeDistance_, - false, - oldToMerged, - mergedCentres - ); - - if (debug) - { - Pout<< "isoSurface : detected " - << mergedCentres.size() - << " geometric edges on " << surf.size() << " triangles." << endl; - } - - if (!hasMerged) - { - return; - } - - - // Determine faceEdges - faceEdges.setSize(surf.size()); - edgeI = 0; - forAll(surf, triI) - { - faceEdges[triI][0] = oldToMerged[edgeI++]; - faceEdges[triI][1] = oldToMerged[edgeI++]; - faceEdges[triI][2] = oldToMerged[edgeI++]; - } - - - // Determine edgeFaces - edgeFace0.setSize(mergedCentres.size()); - edgeFace0 = -1; - edgeFace1.setSize(mergedCentres.size()); - edgeFace1 = -1; - edgeFacesRest.clear(); - - // Overflow edge faces for geometric shared edges that turned - // out to be different anyway. - EdgeMap extraEdgeFaces(mergedCentres.size()/100); - - forAll(oldToMerged, oldEdgeI) - { - label triI = oldEdgeI / 3; - label edgeI = oldToMerged[oldEdgeI]; - - if (edgeFace0[edgeI] == -1) - { - // First triangle for edge - edgeFace0[edgeI] = triI; - } - else - { - //- Check that the two triangles actually topologically - // share an edge - const labelledTri& prevTri = surf[edgeFace0[edgeI]]; - const labelledTri& tri = surf[triI]; - - label fp = oldEdgeI % 3; - - edge e(tri[fp], tri[tri.fcIndex(fp)]); - - label prevTriIndex = -1; - - forAll(prevTri, i) - { - if (edge(prevTri[i], prevTri[prevTri.fcIndex(i)]) == e) - { - prevTriIndex = i; - break; - } - } - - if (prevTriIndex == -1) - { - // Different edge. Store for later. - EdgeMap::iterator iter = extraEdgeFaces.find(e); - - if (iter != extraEdgeFaces.end()) - { - labelList& eFaces = iter(); - label sz = eFaces.size(); - eFaces.setSize(sz+1); - eFaces[sz] = triI; - } - else - { - extraEdgeFaces.insert(e, labelList(1, triI)); - } - } - else if (edgeFace1[edgeI] == -1) - { - edgeFace1[edgeI] = triI; - } - else - { - //WarningInFunction - // << "Edge " << edgeI << " with centre " - // << mergedCentres[edgeI] - // << " used by more than two triangles: " - // << edgeFace0[edgeI] << ", " - // << edgeFace1[edgeI] << " and " << triI << endl; - Map::iterator iter = edgeFacesRest.find(edgeI); - - if (iter != edgeFacesRest.end()) - { - labelList& eFaces = iter(); - label sz = eFaces.size(); - eFaces.setSize(sz+1); - eFaces[sz] = triI; - } - else - { - edgeFacesRest.insert(edgeI, labelList(1, triI)); - } - } - } - } - - // Add extraEdgeFaces - edgeI = edgeFace0.size(); - - edgeFace0.setSize(edgeI + extraEdgeFaces.size()); - edgeFace1.setSize(edgeI + extraEdgeFaces.size(), -1); - - forAllConstIter(EdgeMap, extraEdgeFaces, iter) - { - const labelList& eFaces = iter(); - - // The current edge will become edgeI. Replace all occurrences in - // faceEdges - forAll(eFaces, i) - { - label triI = eFaces[i]; - const labelledTri& tri = surf[triI]; - - FixedList& fEdges = faceEdges[triI]; - forAll(tri, fp) - { - edge e(tri[fp], tri[tri.fcIndex(fp)]); - - if (e == iter.key()) - { - fEdges[fp] = edgeI; - break; - } - } - } - - - // Add face to edgeFaces - - edgeFace0[edgeI] = eFaces[0]; - - if (eFaces.size() >= 2) - { - edgeFace1[edgeI] = eFaces[1]; - - if (eFaces.size() > 2) - { - edgeFacesRest.insert - ( - edgeI, - SubList