From f05c049d43c0918a9287610ff6722b3bafffb265 Mon Sep 17 00:00:00 2001 From: andy <andy> Date: Tue, 2 Oct 2012 13:16:45 +0100 Subject: [PATCH] ENH: Enabled valueOutput for surfaces in fieldValues --- .../field/fieldValues/faceSource/faceSource.C | 42 ++++++++++++++++++- .../field/fieldValues/faceSource/faceSource.H | 9 +++- .../faceSource/faceSourceTemplates.C | 10 ++++- 3 files changed, 58 insertions(+), 3 deletions(-) diff --git a/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C b/src/postProcessing/functionObjects/field/fieldValues/faceSource/faceSource.C index 600d3d9ecdc..2fa6b5c7de3 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 fafedc3a128..6c33df86115 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 cfdcc08d4fb..1d582450104 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()) -- GitLab