From df9ae1d07fd2d1479b6d91b4799ede5211a4d7e0 Mon Sep 17 00:00:00 2001 From: mattijs Date: Mon, 13 Oct 2014 12:46:27 +0100 Subject: [PATCH] ENH: edgeIntersections: added subset manipulation --- .../surfaceIntersection/edgeIntersections.C | 36 ++++++++++++++++++- .../surfaceIntersection/edgeIntersections.H | 11 +++++- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C index 441aa3be52..90b37e8d9f 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011-2012 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -700,4 +700,38 @@ Foam::label Foam::edgeIntersections::removeDegenerates } +void Foam::edgeIntersections::replace +( + const edgeIntersections& subInfo, + const labelList& edgeMap, + const labelList& faceMap +) +{ + forAll(subInfo, subI) + { + const List& subHits = subInfo[subI]; + const labelList& subClass = subInfo.classification()[subI]; + + label edgeI = edgeMap[subI]; + List& intersections = operator[](edgeI); + labelList& intersectionTypes = classification_[edgeI]; + + intersections.setSize(subHits.size()); + intersectionTypes.setSize(subHits.size()); + + forAll(subHits, i) + { + const pointIndexHit& subHit = subHits[i]; + intersections[i] = pointIndexHit + ( + subHit.hit(), + subHit.rawPoint(), + faceMap[subHit.index()] + ); + intersectionTypes[i] = subClass[i]; + } + } +} + + // ************************************************************************* // diff --git a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H index dc25f2e8f8..a2e088fdd8 100644 --- a/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H +++ b/src/meshTools/triSurface/booleanOps/surfaceIntersection/edgeIntersections.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation + \\ / A nd | Copyright (C) 2011-2014 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -197,6 +197,15 @@ public: const scalarField& surf1PointTol, pointField& points1 ); + + //- Replace edge intersection for a subset (given as edge map and + // face map - for face indices stored in pointIndexHit.index()) + void replace + ( + const edgeIntersections&, + const labelList& edgeMap, + const labelList& faceMap + ); };