diff --git a/src/sampling/surface/cuttingPlane/cuttingPlane.C b/src/sampling/surface/cuttingPlane/cuttingPlane.C index cd8f314482..9838cd7323 100644 --- a/src/sampling/surface/cuttingPlane/cuttingPlane.C +++ b/src/sampling/surface/cuttingPlane/cuttingPlane.C @@ -28,6 +28,8 @@ License #include "volFields.H" #include "linePointRef.H" #include "meshTools.H" +#include "EdgeMap.H" +#include "HashOps.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -39,9 +41,19 @@ int Foam::cuttingPlane::debug(Foam::debug::debugSwitch("cuttingPlane", 0)); namespace Foam { // Check edge/plane intersection based on crossings ... trivial check. - inline bool intersectsEdge(const PackedList<2>& sides, const edge& e) + // Orients the edge (first,last) points in the positive normal direction + inline bool intersectEdgeOrient(const PackedList<2>& sides, edge& e) { - return (sides[e.first()] != sides[e.last()]); + if (sides[e.first()] == sides[e.last()]) + { + return false; + } + else if (sides[e.last()] < sides[e.first()]) + { + e.flip(); + } + + return true; } @@ -67,6 +79,31 @@ namespace Foam return (accum == 3 || accum >= 5); } + + //- Hash specialization for labelList. Hash incrementally. + template<> + inline unsigned Hash::operator() + ( + const labelList& list, + unsigned seed + ) const + { + return Hasher(list.cdata(), list.size()*sizeof(label), seed); + } + + //- Hash specialization for labelList + template<> + inline unsigned Hash::operator() + ( + const labelList& list + ) const + { + return Hash()(list, 0); + } + + //- For hashing face point labels, which are pre-sorted. + typedef HashSet> labelListHashSet; + } // End namespace Foam @@ -213,224 +250,326 @@ Foam::label Foam::cuttingPlane::calcCellCuts } -void Foam::cuttingPlane::intersectEdges +void Foam::cuttingPlane::walkCellCuts ( const primitiveMesh& mesh, const PackedList<2>& sides, const bitSet& cellCuts, - List