diff --git a/src/meshTools/Make/files b/src/meshTools/Make/files index 1b3dffa89d..d159b0df0b 100644 --- a/src/meshTools/Make/files +++ b/src/meshTools/Make/files @@ -41,7 +41,7 @@ $(pWave)/pointEdgePoint.C patchWave = $(algorithms)/PatchEdgeFaceWave $(patchWave)/PatchEdgeFaceWaveName.C $(patchWave)/patchEdgeFaceInfo.C -$(patchWave)/patchDist.C +$(patchWave)/patchPatchDist.C meshWave = $(algorithms)/MeshWave $(meshWave)/MeshWaveName.C diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.C b/src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.C similarity index 94% rename from src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.C rename to src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.C index 22ea9a35f1..6dc94b6c53 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.C +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.C @@ -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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -23,7 +23,7 @@ License \*---------------------------------------------------------------------------*/ -#include "patchDist.H" +#include "patchPatchDist.H" #include "PatchEdgeFaceWave.H" #include "syncTools.H" #include "polyMesh.H" @@ -31,7 +31,7 @@ License // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -Foam::patchDist::patchDist +Foam::patchPatchDist::patchPatchDist ( const polyPatch& patch, const labelHashSet& nbrPatchIDs @@ -41,19 +41,19 @@ Foam::patchDist::patchDist nbrPatchIDs_(nbrPatchIDs), nUnset_(0) { - patchDist::correct(); + patchPatchDist::correct(); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -Foam::patchDist::~patchDist() +Foam::patchPatchDist::~patchPatchDist() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -void Foam::patchDist::correct() +void Foam::patchPatchDist::correct() { // Mark all edge connected to a nbrPatch. label nBnd = 0; diff --git a/src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.H b/src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.H similarity index 86% rename from src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.H rename to src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.H index 11cf2f4825..4d669bbb45 100644 --- a/src/meshTools/algorithms/PatchEdgeFaceWave/patchDist.H +++ b/src/meshTools/algorithms/PatchEdgeFaceWave/patchPatchDist.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -22,19 +22,19 @@ License along with OpenFOAM. If not, see . Class - Foam::patchDist + Foam::patchPatchDist Description - Like wallDist but calculates on patch distance to nearest neighbouring + Like wallDist but calculates on a patch the distance to nearest neighbouring patches. Uses PatchEdgeFaceWave to do actual calculation. SourceFiles - patchDist.C + patchPatchDist.C \*---------------------------------------------------------------------------*/ -#ifndef patchDist_H -#define patchDist_H +#ifndef patchPatchDist_H +#define patchPatchDist_H #include "scalarField.H" #include "HashSet.H" @@ -48,10 +48,10 @@ namespace Foam class polyPatch; /*---------------------------------------------------------------------------*\ - Class patchDist Declaration + Class patchPatchDist Declaration \*---------------------------------------------------------------------------*/ -class patchDist +class patchPatchDist : public scalarField { @@ -75,7 +75,7 @@ public: // Constructors //- Construct from patch and neighbour patches. - patchDist + patchPatchDist ( const polyPatch& pp, const labelHashSet& nbrPatchIDs @@ -83,7 +83,7 @@ public: //- Destructor - virtual ~patchDist(); + virtual ~patchPatchDist(); // Member Functions diff --git a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C index 0ef785383b..db337fc098 100644 --- a/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.C +++ b/src/meshTools/algorithms/PointEdgeWave/PointEdgeWave.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-2013 OpenFOAM Foundation \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -523,6 +523,75 @@ void Foam::PointEdgeWave::handleCyclicPatches() } +// Propagate information from edge to point. Return number of points changed. +template +Foam::label Foam::PointEdgeWave::handleCollocatedPoints() +{ + // Transfer onto coupled patch + const globalMeshData& gmd = mesh_.globalData(); + const indirectPrimitivePatch& cpp = gmd.coupledPatch(); + const labelList& meshPoints = cpp.meshPoints(); + + const mapDistribute& slavesMap = gmd.globalPointSlavesMap(); + const labelListList& slaves = gmd.globalPointSlaves(); + + List elems(slavesMap.constructSize()); + forAll(meshPoints, pointI) + { + elems[pointI] = allPointInfo_[meshPoints[pointI]]; + } + + // Reset changed points counter. + nChangedPoints_ = 0; + + // Pull slave data onto master. No need to update transformed slots. + slavesMap.distribute(elems, false); + + // Combine master data with slave data + forAll(slaves, pointI) + { + Type& elem = elems[pointI]; + + const labelList& slavePoints = slaves[pointI]; + + label meshPointI = meshPoints[pointI]; + + // Combine master with untransformed slave data + forAll(slavePoints, j) + { + updatePoint + ( + meshPointI, + elems[slavePoints[j]], + elem + ); + } + + // Copy result back to slave slots + forAll(slavePoints, j) + { + elems[slavePoints[j]] = elem; + } + } + + // Push slave-slot data back to slaves + slavesMap.reverseDistribute(elems.size(), elems, false); + + // Extract back onto mesh + forAll(meshPoints, pointI) + { + allPointInfo_[meshPoints[pointI]] = elems[pointI]; + } + + // Sum nChangedPoints over all procs + label totNChanged = nChangedPoints_; + + reduce(totNChanged, sumOp