From b07d3f1c652884e8f860569c834c3322aac28032 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Tue, 7 May 2013 12:18:59 +0100 Subject: [PATCH] ENH: Updated mesh-to-mesh interpolation using direct method --- .../calcMethod/direct/directMethod.C | 10 ++++++++++ .../calcMethod/direct/directMethod.H | 13 ++++++++++--- .../calcMethod/mapNearest/mapNearestMethod.H | 10 +++++----- .../meshToMeshMethod/meshToMeshMethod.H | 16 ++++++++++++---- 4 files changed, 37 insertions(+), 12 deletions(-) diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C index 9f3674700cd..2a43bb7ba2f 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.C @@ -38,6 +38,16 @@ namespace Foam // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // +bool Foam::directMethod::intersect +( + const label srcCellI, + const label tgtCellI +) const +{ + return tgt_.pointInCell(src_.cellCentres()[srcCellI], tgtCellI); +} + + bool Foam::directMethod::findInitialSeeds ( const labelList& srcCellIDs, diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H index 1c9f489a83c..2effe6d2b0b 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/direct/directMethod.H @@ -56,9 +56,16 @@ protected: // Protected Member Functions + //- Return the true if cells intersect + virtual bool intersect + ( + const label srcCellI, + const label tgtCellI + ) const; + //- Find indices of overlapping cells in src and tgt meshes - returns // true if found a matching pair - bool findInitialSeeds + virtual bool findInitialSeeds ( const labelList& srcCellIDs, const boolList& mapFlag, @@ -68,7 +75,7 @@ protected: ) const; //- Calculate the mesh-to-mesh addressing and weights - void calculateAddressing + virtual void calculateAddressing ( labelListList& srcToTgtCellAddr, scalarListList& srcToTgtCellWght, @@ -82,7 +89,7 @@ protected: ); //- Append to list of src mesh seed indices - void appendToDirectSeeds + virtual void appendToDirectSeeds ( boolList& mapFlag, labelList& srcTgtSeed, diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H index 813c46683ff..5ba76a30703 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/mapNearest/mapNearestMethod.H @@ -58,7 +58,7 @@ protected: //- Find indices of overlapping cells in src and tgt meshes - returns // true if found a matching pair - bool findInitialSeeds + virtual bool findInitialSeeds ( const labelList& srcCellIDs, const boolList& mapFlag, @@ -68,7 +68,7 @@ protected: ) const; //- Calculate the mesh-to-mesh addressing and weights - void calculateAddressing + virtual void calculateAddressing ( labelListList& srcToTgtCellAddr, scalarListList& srcToTgtCellWght, @@ -82,7 +82,7 @@ protected: ); //- Find the nearest cell on mesh2 for cell1 on mesh1 - void findNearestCell + virtual void findNearestCell ( const polyMesh& mesh1, const polyMesh& mesh2, @@ -91,7 +91,7 @@ protected: ) const; //- Set the next cells for the marching front algorithm - void setNextNearestCells + virtual void setNextNearestCells ( label& startSeedI, label& srcCellI, @@ -101,7 +101,7 @@ protected: ) const; //- Find a source cell mapped to target cell tgtCellI - label findMappedSrcCell + virtual label findMappedSrcCell ( const label tgtCellI, const List<DynamicList<label> >& tgtToSrc diff --git a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H index 3338fa53495..cf3e693f8bd 100644 --- a/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H +++ b/src/sampling/meshToMeshInterpolation/meshToMeshNew/calcMethod/meshToMeshMethod/meshToMeshMethod.H @@ -72,13 +72,21 @@ protected: labelList maskCells() const; //- Return the true if cells intersect - bool intersect(const label srcCellI, const label tgtCellI) const; + virtual bool intersect + ( + const label srcCellI, + const label tgtCellI + ) const; //- Return the intersection volume between two cells - scalar interVol(const label srcCellI, const label tgtCellI) const; + virtual scalar interVol + ( + const label srcCellI, + const label tgtCellI + ) const; //- Append target cell neihgbour cells to cellIDs list - void appendNbrCells + virtual void appendNbrCells ( const label tgtCellI, const polyMesh& mesh, @@ -86,7 +94,7 @@ protected: DynamicList<label>& nbrTgtCellIDs ) const; - bool initialise + virtual bool initialise ( labelListList& srcToTgtAddr, scalarListList& srcToTgtWght, -- GitLab