From 616b3c8273a881a151466e1fc6e3f4daa8409eaf Mon Sep 17 00:00:00 2001 From: mattijs <mattijs> Date: Wed, 13 Jun 2012 16:15:01 +0100 Subject: [PATCH] ENH: treeDataPrimitivePatch: refactored for single template arg --- .../backgroundMeshDecomposition.H | 4 +- src/dynamicMesh/boundaryMesh/boundaryMesh.C | 8 +- .../AMIInterpolation/AMIInterpolation.H | 2 +- .../indexedOctree/treeDataPrimitivePatch.C | 131 +++--------------- .../indexedOctree/treeDataPrimitivePatch.H | 28 +--- 5 files changed, 34 insertions(+), 139 deletions(-) diff --git a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H index 910732fa7ac..bcdd1638345 100644 --- a/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H +++ b/applications/utilities/mesh/generation/cvMesh/conformalVoronoiMesh/backgroundMeshDecomposition/backgroundMeshDecomposition.H @@ -78,10 +78,8 @@ SourceFiles namespace Foam { -typedef treeDataPrimitivePatch<face, List, const pointField, point> - treeDataBPatch; - typedef PrimitivePatch<face, List, const pointField, point> bPatch; +typedef treeDataPrimitivePatch<bPatch> treeDataBPatch; /*---------------------------------------------------------------------------*\ Class backgroundMeshDecomposition Declaration diff --git a/src/dynamicMesh/boundaryMesh/boundaryMesh.C b/src/dynamicMesh/boundaryMesh/boundaryMesh.C index 51be127dd71..4a705acead2 100644 --- a/src/dynamicMesh/boundaryMesh/boundaryMesh.C +++ b/src/dynamicMesh/boundaryMesh/boundaryMesh.C @@ -924,10 +924,10 @@ Foam::labelList Foam::boundaryMesh::getNearest // Create the octrees indexedOctree < - treeDataPrimitivePatch<face, UIndirectList, const pointField&> + treeDataPrimitivePatch<uindirectPrimitivePatch> > leftTree ( - treeDataPrimitivePatch<face, UIndirectList, const pointField&> + treeDataPrimitivePatch<uindirectPrimitivePatch> ( false, // cacheBb leftPatch @@ -939,10 +939,10 @@ Foam::labelList Foam::boundaryMesh::getNearest ); indexedOctree < - treeDataPrimitivePatch<face, UIndirectList, const pointField&> + treeDataPrimitivePatch<uindirectPrimitivePatch> > rightTree ( - treeDataPrimitivePatch<face, UIndirectList, const pointField&> + treeDataPrimitivePatch<uindirectPrimitivePatch> ( false, // cacheBb rightPatch diff --git a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H index 36cd661175b..d8cb82c07cf 100644 --- a/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H +++ b/src/meshTools/AMIInterpolation/AMIInterpolation/AMIInterpolation.H @@ -82,7 +82,7 @@ class AMIInterpolation public AMIInterpolationName { //- local typedef to octree tree-type - typedef treeDataPrimitivePatch<face, SubList, const pointField&> treeType; + typedef treeDataPrimitivePatch<TargetPatch> treeType; // Private data diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C index 6927cbaa509..4cd29682323 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.C +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.C @@ -29,30 +29,14 @@ License // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::scalar -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -tolSqr = sqr(1e-6); +template<class PatchType> +Foam::scalar Foam::treeDataPrimitivePatch<PatchType>::tolSqr = sqr(1e-6); // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::treeBoundBox -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -calcBb +template<class PatchType> +Foam::treeBoundBox Foam::treeDataPrimitivePatch<PatchType>::calcBb ( const pointField& points, const face& f @@ -71,15 +55,8 @@ calcBb } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -void Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -update() +template<class PatchType> +void Foam::treeDataPrimitivePatch<PatchType>::update() { if (cacheBb_) { @@ -96,18 +73,11 @@ update() // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // Construct from components -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -treeDataPrimitivePatch +template<class PatchType> +Foam::treeDataPrimitivePatch<PatchType>::treeDataPrimitivePatch ( const bool cacheBb, - const PrimitivePatch<Face, FaceList, PointField, PointType>& patch + const PatchType& patch ) : patch_(patch), @@ -119,16 +89,8 @@ treeDataPrimitivePatch // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::pointField -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -shapePoints() const +template<class PatchType> +Foam::pointField Foam::treeDataPrimitivePatch<PatchType>::shapePoints() const { pointField cc(patch_.size()); @@ -143,27 +105,10 @@ shapePoints() const //- Get type (inside,outside,mixed,unknown) of point w.r.t. surface. // Only makes sense for closed surfaces. -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -Foam::label -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -getVolumeType +template<class PatchType> +Foam::label Foam::treeDataPrimitivePatch<PatchType>:: getVolumeType ( - const indexedOctree - < - treeDataPrimitivePatch - < - Face, - FaceList, - PointField, - PointType - > - >& oc, + const indexedOctree<treeDataPrimitivePatch<PatchType> >& oc, const point& sample ) const { @@ -396,16 +341,8 @@ getVolumeType // Check if any point on shape is inside cubeBb. -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -bool -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -overlaps +template<class PatchType> +bool Foam::treeDataPrimitivePatch<PatchType>::overlaps ( const label index, const treeBoundBox& cubeBb @@ -462,16 +399,8 @@ overlaps // Check if any point on shape is inside sphere. -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -bool -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -overlaps +template<class PatchType> +bool Foam::treeDataPrimitivePatch<PatchType>::overlaps ( const label index, const point& centre, @@ -512,16 +441,8 @@ overlaps // Calculate nearest point to sample. Updates (if any) nearestDistSqr, minIndex, // nearestPoint. -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -void -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -findNearest +template<class PatchType> +void Foam::treeDataPrimitivePatch<PatchType>::findNearest ( const labelUList& indices, const point& sample, @@ -552,16 +473,8 @@ findNearest } -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType -> -bool -Foam::treeDataPrimitivePatch<Face, FaceList, PointField, PointType>:: -intersects +template<class PatchType> +bool Foam::treeDataPrimitivePatch<PatchType>::intersects ( const label index, const point& start, diff --git a/src/meshTools/indexedOctree/treeDataPrimitivePatch.H b/src/meshTools/indexedOctree/treeDataPrimitivePatch.H index 44f76d2c75f..bbb3c749562 100644 --- a/src/meshTools/indexedOctree/treeDataPrimitivePatch.H +++ b/src/meshTools/indexedOctree/treeDataPrimitivePatch.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-2012 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -59,13 +59,7 @@ TemplateName(treeDataPrimitivePatch); Class treeDataPrimitivePatch Declaration \*---------------------------------------------------------------------------*/ -template -< - class Face, - template<class> class FaceList, - class PointField, - class PointType=point -> +template<class PatchType> class treeDataPrimitivePatch : public treeDataPrimitivePatchName @@ -78,7 +72,7 @@ class treeDataPrimitivePatch // Private data //- Underlying geometry - const PrimitivePatch<Face, FaceList, PointField, PointType>& patch_; + const PatchType& patch_; //- Whether to precalculate and store face bounding box const bool cacheBb_; @@ -103,7 +97,7 @@ public: treeDataPrimitivePatch ( const bool cacheBb, - const PrimitivePatch<Face, FaceList, PointField, PointType>& + const PatchType& ); @@ -121,8 +115,7 @@ public: pointField shapePoints() const; //- Return access to the underlying patch - const PrimitivePatch<Face, FaceList, PointField, PointType>& - patch() const + const PatchType& patch() const { return patch_; } @@ -134,16 +127,7 @@ public: // Only makes sense for closed surfaces. label getVolumeType ( - const indexedOctree - < - treeDataPrimitivePatch - < - Face, - FaceList, - PointField, - PointType - > - >&, + const indexedOctree<treeDataPrimitivePatch<PatchType> >&, const point& ) const; -- GitLab