From 0db9fa570258e9d8c6ea3bdae1ef16cbec5aba90 Mon Sep 17 00:00:00 2001 From: mattijs Date: Tue, 9 Nov 2010 18:04:32 +0000 Subject: [PATCH] ENH: Ensight output for sampledSurfaces --- .../postProcessing/sampling/sample/sampleDict | 1 + src/sampling/Make/files | 1 + .../sampledSurfacesTemplates.C | 6 +- .../writers/dx/dxSurfaceWriter.C | 3 +- .../writers/dx/dxSurfaceWriter.H | 1 + .../writers/ensight/ensightSurfaceWriter.C | 372 ++++++++++++++++++ .../writers/ensight/ensightSurfaceWriter.H | 138 +++++++ .../ensight/ensightSurfaceWriterRunTime.C | 44 +++ .../writers/foamFile/foamFileSurfaceWriter.C | 1 + .../writers/foamFile/foamFileSurfaceWriter.H | 1 + .../writers/null/nullSurfaceWriter.C | 1 + .../writers/null/nullSurfaceWriter.H | 1 + .../writers/proxy/proxySurfaceWriter.H | 1 + .../writers/raw/rawSurfaceWriter.C | 21 +- .../writers/raw/rawSurfaceWriter.H | 6 + .../sampledSurface/writers/surfaceWriter.H | 3 +- .../writers/vtk/vtkSurfaceWriter.C | 3 +- .../writers/vtk/vtkSurfaceWriter.H | 1 + 18 files changed, 593 insertions(+), 12 deletions(-) create mode 100644 src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C create mode 100644 src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H create mode 100644 src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C 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