diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 600d3d9ecdc505d573b6a863de5cfb624b8d77ec..2fa6b5c7de3d7e16eab0f47636953ab4ef99ccf2 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C @@ -31,6 +31,7 @@ License #include "sampledSurface.H" #include "mergePoints.H" #include "indirectPrimitivePatch.H" +#include "PatchTools.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -224,7 +225,7 @@ void Foam::fieldValues::faceSource::sampledSurfaceFaces(const dictionary& dict) } -void Foam::fieldValues::faceSource::combineSurfaceGeometry +void Foam::fieldValues::faceSource::combineMeshGeometry ( faceList& faces, pointField& points @@ -345,6 +346,45 @@ void Foam::fieldValues::faceSource::combineSurfaceGeometry } +void Foam::fieldValues::faceSource::combineSurfaceGeometry +( + faceList& faces, + pointField& points +) const +{ + if (surfacePtr_.valid()) + { + const sampledSurface& s = surfacePtr_(); + + if (Pstream::parRun()) + { + // dimension as fraction of mesh bounding box + scalar mergeDim = 1e-10*mesh().bounds().mag(); + + labelList pointsMap; + + PatchTools::gatherAndMerge + ( + mergeDim, + primitivePatch + ( + SubList<face>(s.faces(), s.faces().size()), + s.points() + ), + points, + faces, + pointsMap + ); + } + else + { + faces = s.faces(); + points = s.points(); + } + } +} + + // * * * * * * * * * * * * Protected Member Functions * * * * * * * * * * * // void Foam::fieldValues::faceSource::initialise(const dictionary& dict) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H index fafedc3a128ef9d404b2ccca0256ca141bf23c32..6c33df8611595e0f46cda28b09cf4601612a2bcc 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.H @@ -204,7 +204,14 @@ private: //- Set faces according to sampledSurface void sampledSurfaceFaces(const dictionary&); - //- Combine faces and points from multiple processors + //- Combine mesh faces and points from multiple processors + void combineMeshGeometry + ( + faceList& faces, + pointField& points + ) const; + + //- Combine surface faces and points from multiple processors void combineSurfaceGeometry ( faceList& faces, diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C index cfdcc08d4fb39214a1d88d8ca8d0a712cb4a07d2..1d58245010421b7fcb1f455482ecd602a1c56160 100644 --- a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C +++ b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSourceTemplates.C @@ -259,7 +259,15 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName) { faceList faces; pointField points; - combineSurfaceGeometry(faces, points); + + if (surfacePtr_.valid()) + { + combineSurfaceGeometry(faces, points); + } + else + { + combineMeshGeometry(faces, points); + } fileName outputDir; if (Pstream::parRun())