diff --git a/applications/utilities/postProcessing/sampling/sample/sampleDict b/applications/utilities/postProcessing/sampling/sample/sampleDict index f48237e9ed..156b7cf54f 100644 --- a/applications/utilities/postProcessing/sampling/sample/sampleDict +++ b/applications/utilities/postProcessing/sampling/sample/sampleDict @@ -27,6 +27,7 @@ setFormat raw; // Surface output format. Choice of // null : suppress output +// ensight : Ensight Gold format, one field per case file // foamFile : separate points, faces and values file // dx : DX scalar or vector format // vtk : VTK ascii format diff --git a/src/sampling/Make/files b/src/sampling/Make/files index c385e9aa93..6fee75b8f7 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -46,6 +46,7 @@ surfWriters = sampledSurface/writers $(surfWriters)/surfaceWriters.C $(surfWriters)/dx/dxSurfaceWriterRunTime.C +$(surfWriters)/ensight/ensightSurfaceWriterRunTime.C $(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C $(surfWriters)/null/nullSurfaceWriterRunTime.C $(surfWriters)/proxy/proxySurfaceWriterRunTime.C diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 4dd5deffa5..128f7d2606 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -103,7 +103,8 @@ void Foam::sampledSurfaces::sampleAndWrite mergeList_[surfI].points, mergeList_[surfI].faces, fieldName, - allValues + allValues, + s.interpolate() ); } } @@ -121,7 +122,8 @@ void Foam::sampledSurfaces::sampleAndWrite s.points(), s.faces(), fieldName, - values + values, + s.interpolate() ); } } diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C index 4950e37664..f4e7ebe216 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C @@ -250,6 +250,7 @@ void Foam::dxSurfaceWriter::write const faceList& faces, const word& fieldName, const Field& values, + const bool isNodeValues, const bool verbose ) const { @@ -272,7 +273,7 @@ void Foam::dxSurfaceWriter::write writeData(os, values); - if (values.size() == points.size()) + if (isNodeValues) { os << nl << "attribute \"dep\" string \"positions\"" << nl << nl; diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index 897133a005..fc996ee3d9 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -88,6 +88,7 @@ public: const faceList& faces, const word& fieldName, const Field& values, + const bool isNodeValues, const bool verbose = false ) const; }; diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C new file mode 100644 index 0000000000..81eb8510fa --- /dev/null +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C @@ -0,0 +1,372 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\/ M anipulation | +------------------------------------------------------------------------------- +License + This file is part of OpenFOAM. + + OpenFOAM is free software: you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + OpenFOAM is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + for more details. + + You should have received a copy of the GNU General Public License + along with OpenFOAM. If not, see . + +\*---------------------------------------------------------------------------*/ + +#include "ensightSurfaceWriter.H" + +#include "OFstream.H" +#include "OSspecific.H" +#include "IOmanip.H" + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +template +void Foam::ensightSurfaceWriter::binShapes +( + const pointField& points, + const faceList& faces, + DynamicList