diff --git a/src/sampling/surface/cuttingPlane/cuttingPlane.C b/src/sampling/surface/cuttingPlane/cuttingPlane.C index 051a60c1cb..1650dc311b 100644 --- a/src/sampling/surface/cuttingPlane/cuttingPlane.C +++ b/src/sampling/surface/cuttingPlane/cuttingPlane.C @@ -56,6 +56,23 @@ namespace Foam } + // Classify sides of plane (0=BACK, 1=ONPLANE, 2=FRONT) for each point + inline PackedList<2> classifySides(const plane& pln, const pointField& pts) + { + const label len = pts.size(); + + PackedList<2> output(len); + + // From signed (-1,0,+1) to (0,1,2) for PackedList + for (label i=0; i < len; ++i) + { + output.set(i, unsigned(1 + pln.sign(pts[i], SMALL))); + } + + return output; + } + + // Check for face/plane intersection based on crossings // Took (-1,0,+1) from plane::sign and packed as (0,1,2). // Now use for left shift to obtain (1,2,4). @@ -78,35 +95,11 @@ namespace Foam return (accum == 3 || accum >= 5); } - - //- For hashing face point labels, which are pre-sorted. - typedef HashSet> labelListHashSet; - } // End namespace Foam // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -Foam::PackedList<2> Foam::cuttingPlane::classifySides -( - const plane& pln, - const pointField& pts -) -{ - const label len = pts.size(); - - PackedList<2> output(len); - - // From signed (-1,0,+1) to (0,1,2) for PackedList - for (label i=0; i < len; ++i) - { - output.set(i, unsigned(1 + pln.sign(pts[i], SMALL))); - } - - return output; -} - - Foam::label Foam::cuttingPlane::calcCellCuts ( const primitiveMesh& mesh, @@ -231,12 +224,18 @@ Foam::label Foam::cuttingPlane::calcCellCuts void Foam::cuttingPlane::walkCellCuts ( const primitiveMesh& mesh, - const PackedList<2>& sides, const bitSet& cellCuts, + const PackedList<2>& sides, const bool triangulate, label nFaceCuts ) { + // Information required from the mesh + const faceList& faces = mesh.faces(); + const cellList& cells = mesh.cells(); + const pointField& points = mesh.points(); + + // Dynamic lists to handle triangulation and/or missed cuts etc const label nCellCuts = cellCuts.count(); @@ -250,12 +249,6 @@ void Foam::cuttingPlane::walkCellCuts nFaceCuts = 4*nCellCuts; } - // Information required from the mesh - const faceList& faces = mesh.faces(); - const cellList& cells = mesh.cells(); - const pointField& points = mesh.points(); - - // Edge to pointId mapping EdgeMap