ENH: Enabled valueOutput for surfaces in fieldValues

This commit is contained in:
andy
2012-10-02 13:16:45 +01:00
parent 340bbed2e0
commit f05c049d43
3 changed files with 58 additions and 3 deletions

View File

@ -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)

View File

@ -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,

View File

@ -259,7 +259,15 @@ bool Foam::fieldValues::faceSource::writeValues(const word& fieldName)
{
faceList faces;
pointField points;
if (surfacePtr_.valid())
{
combineSurfaceGeometry(faces, points);
}
else
{
combineMeshGeometry(faces, points);
}
fileName outputDir;
if (Pstream::parRun())