Commit 8594fb43 authored by mattijs's avatar mattijs
Browse files

ENH: snappyHexMesh: Cleanup of parallel cyclics. See #1731.

parent 6365bab8
......@@ -28,6 +28,8 @@ License
#include "weightedPosition.H"
#include "vectorTensorTransform.H"
#include "coupledPolyPatch.H"
#include "polyMesh.H"
#include "syncTools.H"
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
......@@ -150,4 +152,54 @@ void Foam::weightedPosition::operator()
}
void Foam::weightedPosition::syncPoints
(
const polyMesh& mesh,
List<weightedPosition>& fld
)
{
if (fld.size() != mesh.nPoints())
{
FatalErrorInFunction << "Size of field " << fld.size()
<< " does not correspond to the number of points in the mesh "
<< mesh.nPoints() << exit(FatalError);
}
syncTools::syncPointList
(
mesh,
fld,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
}
void Foam::weightedPosition::syncPoints
(
const polyMesh& mesh,
const labelUList& meshPoints,
List<weightedPosition>& fld
)
{
if (fld.size() != meshPoints.size())
{
FatalErrorInFunction << "Size of field " << fld.size()
<< " does not correspond to the number of points supplied "
<< meshPoints.size() << exit(FatalError);
}
syncTools::syncPointList
(
mesh,
meshPoints,
fld,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
}
// ************************************************************************* //
......@@ -79,6 +79,7 @@ namespace Foam
class weightedPosition;
class vectorTensorTransform;
class coupledPolyPatch;
class polyMesh;
//- pTraits
template<>
......@@ -160,6 +161,22 @@ public:
const coupledPolyPatch& cpp,
Container<weightedPosition>& map
) const;
//- Synchronisation for mesh point positions
static void syncPoints
(
const polyMesh& mesh,
List<weightedPosition>&
);
//- Synchronisation for patch point positions
static void syncPoints
(
const polyMesh& mesh,
const labelUList& meshPoints,
List<weightedPosition>&
);
};
......
......@@ -255,15 +255,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothInternalDisplacement
}
}
// Sum
syncTools::syncPointList
(
mesh,
sumLocation,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
// Add coupled contributions
weightedPosition::syncPoints(mesh, sumLocation);
tmp<pointField> tdisplacement(new pointField(mesh.nPoints(), Zero));
pointField& displacement = tdisplacement.ref();
......@@ -384,15 +377,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothPatchDisplacement
}
}
syncTools::syncPointList
(
mesh,
pp.meshPoints(),
avgBoundary,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
// Add coupled contributions
weightedPosition::syncPoints(mesh, pp.meshPoints(), avgBoundary);
// Normalise
forAll(avgBoundary, i)
......@@ -464,15 +450,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::smoothPatchDisplacement
}
}
syncTools::syncPointList
(
mesh,
globalSum,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
// Add coupled contributions
weightedPosition::syncPoints(mesh, globalSum);
avgInternal.setSize(meshPoints.size());
......@@ -1010,15 +989,8 @@ Foam::tmp<Foam::pointField> Foam::snappySnapDriver::avgCellCentres
}
}
syncTools::syncPointList
(
mesh,
pp.meshPoints(),
avgBoundary,
weightedPosition::plusEqOp, // combine op
pTraits<weightedPosition>::zero,// null value (not used)
pTraits<weightedPosition>::zero // transform class
);
// Add coupled contributions
weightedPosition::syncPoints(mesh, pp.meshPoints(), avgBoundary);
tmp<pointField> tavgBoundary(new pointField(avgBoundary.size()));
weightedPosition::getPoints(avgBoundary, tavgBoundary.ref());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment