From 51df389de63052d27766682bb5cf53b18b964082 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Wed, 26 Jan 2011 13:36:37 +0100 Subject: [PATCH] ENH: rework surface writers as non-templated classes - easier (more logical) when adding a new writer ENH: add surface field writer for 'starcd' format - creates *.usr files, which can be read in proSTAR with the 'getuser' command, but which can also be parsed directly since the format is extremely primitive --- src/sampling/Make/files | 16 +- .../sampledSurfaces/sampledSurfaces.C | 17 +- .../sampledSurfaces/sampledSurfaces.H | 45 +- .../sampledSurfacesTemplates.C | 21 +- .../writers/dx/dxSurfaceWriter.C | 137 +++--- .../writers/dx/dxSurfaceWriter.H | 101 ++++- .../writers/dx/dxSurfaceWriterRunTime.C | 43 -- .../writers/ensight/ensightSurfaceWriter.C | 200 ++++----- .../writers/ensight/ensightSurfaceWriter.H | 119 ++++- .../ensight/ensightSurfaceWriterRunTime.C | 44 -- .../writers/foamFile/foamFileSurfaceWriter.C | 95 ++-- .../writers/foamFile/foamFileSurfaceWriter.H | 105 ++++- .../foamFile/foamFileSurfaceWriterRunTime.C | 44 -- .../writers/makeSurfaceWriterMethods.H | 92 ++++ .../writers/null/nullSurfaceWriter.C | 63 --- .../writers/null/nullSurfaceWriter.H | 103 ----- .../writers/null/nullSurfaceWriterRunTime.C | 44 -- .../writers/proxy/proxySurfaceWriter.C | 34 +- .../writers/proxy/proxySurfaceWriter.H | 38 +- .../writers/proxy/proxySurfaceWriterRunTime.C | 45 -- .../writers/raw/rawSurfaceWriter.C | 416 +++++++----------- .../writers/raw/rawSurfaceWriter.H | 158 ++++--- .../writers/raw/rawSurfaceWriterRunTime.C | 44 -- .../writers/starcd/starcdSurfaceWriter.C | 172 ++++++++ .../writers/starcd/starcdSurfaceWriter.H | 181 ++++++++ .../sampledSurface/writers/surfaceWriter.C | 60 ++- .../sampledSurface/writers/surfaceWriter.H | 98 +++-- .../sampledSurface/writers/surfaceWriters.C | 50 --- .../sampledSurface/writers/surfaceWriters.H | 76 ---- .../writers/vtk/vtkSurfaceWriter.C | 163 ++++--- .../writers/vtk/vtkSurfaceWriter.H | 103 ++++- .../writers/vtk/vtkSurfaceWriterRunTime.C | 44 -- 32 files changed, 1511 insertions(+), 1460 deletions(-) delete mode 100644 src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C delete mode 100644 src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C delete mode 100644 src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C create mode 100644 src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H delete mode 100644 src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C delete mode 100644 src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H delete mode 100644 src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C delete mode 100644 src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C delete mode 100644 src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C create mode 100644 src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C create mode 100644 src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H delete mode 100644 src/sampling/sampledSurface/writers/surfaceWriters.C delete mode 100644 src/sampling/sampledSurface/writers/surfaceWriters.H delete mode 100644 src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C diff --git a/src/sampling/Make/files b/src/sampling/Make/files index 3c61e371b6d..c9b26376d09 100644 --- a/src/sampling/Make/files +++ b/src/sampling/Make/files @@ -46,14 +46,14 @@ sampledSurface/thresholdCellFaces/sampledThresholdCellFaces.C 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 -$(surfWriters)/raw/rawSurfaceWriterRunTime.C -$(surfWriters)/vtk/vtkSurfaceWriterRunTime.C +$(surfWriters)/surfaceWriter.C +$(surfWriters)/dx/dxSurfaceWriter.C +$(surfWriters)/ensight/ensightSurfaceWriter.C +$(surfWriters)/foamFile/foamFileSurfaceWriter.C +$(surfWriters)/proxy/proxySurfaceWriter.C +$(surfWriters)/raw/rawSurfaceWriter.C +$(surfWriters)/starcd/starcdSurfaceWriter.C +$(surfWriters)/vtk/vtkSurfaceWriter.C graphField/writePatchGraph.C graphField/writeCellGraph.C diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C index 06b32784894..e44e1f8a460 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -83,7 +83,7 @@ void Foam::sampledSurfaces::writeGeometry() const { if (Pstream::master() && mergeList_[surfI].faces.size()) { - genericFormatter_->write + formatter_->write ( outputDir, s.name(), @@ -94,7 +94,7 @@ void Foam::sampledSurfaces::writeGeometry() const } else if (s.faces().size()) { - genericFormatter_->write + formatter_->write ( outputDir, s.name(), @@ -123,9 +123,8 @@ Foam::sampledSurfaces::sampledSurfaces outputPath_(fileName::null), fieldSelection_(), interpolationScheme_(word::null), - writeFormat_(word::null), mergeList_(), - genericFormatter_(NULL), + formatter_(NULL), scalarFields_(), vectorFields_(), sphericalTensorFields_(), @@ -201,7 +200,7 @@ void Foam::sampledSurfaces::write() // write geometry first if required, // or when no fields would otherwise be written - if (nFields == 0 || genericFormatter_->separateFiles()) + if (nFields == 0 || formatter_->separateGeometry()) { writeGeometry(); } @@ -221,11 +220,11 @@ void Foam::sampledSurfaces::read(const dictionary& dict) clearFieldGroups(); dict.lookup("interpolationScheme") >> interpolationScheme_; - dict.lookup("surfaceFormat") >> writeFormat_; - // define the generic (geometry) writer - genericFormatter_ = surfaceWriter<bool>::New(writeFormat_); + word writeFormat(dict.lookup("surfaceFormat")); + // define the surface formatter + formatter_ = surfaceWriter::New(writeFormat); PtrList<sampledSurface> newList ( diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H index 0c2084507a8..4293cf9e628 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfaces.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -68,36 +68,11 @@ class sampledSurfaces { public: - //- The surface formatter - autoPtr< surfaceWriter<Type> > formatter; - //- Construct null fieldGroup() : - DynamicList<word>(0), - formatter(NULL) + DynamicList<word>(0) {} - - //- Construct for a particular surface format - fieldGroup(const word& writeFormat) - : - DynamicList<word>(0), - formatter(surfaceWriter<Type>::New(writeFormat)) - {} - - //- Reset format and field list - void clear() - { - DynamicList<word>::clear(); - formatter.clear(); - } - - //- Assign a new formatter - void operator=(const word& writeFormat) - { - formatter = surfaceWriter<Type>::New(writeFormat); - } - }; @@ -151,10 +126,6 @@ class sampledSurfaces //- Interpolation scheme to use word interpolationScheme_; - //- Output format to use - word writeFormat_; - - // surfaces //- Information for merging surfaces @@ -163,8 +134,8 @@ class sampledSurfaces // Calculated - //- Generic surface formatter - autoPtr< surfaceWriter<bool> > genericFormatter_; + //- Surface formatter + autoPtr<surfaceWriter> formatter_; //- Categorized scalar/vector/tensor fields fieldGroup<scalar> scalarFields_; @@ -190,14 +161,10 @@ class sampledSurfaces //- Sample and write a particular volume field template<class Type> - void sampleAndWrite - ( - const GeometricField<Type, fvPatchField, volMesh>&, - const surfaceWriter<Type>& formatter - ); + void sampleAndWrite(const GeometricField<Type, fvPatchField, volMesh>&); //- Sample and write all the fields of the given type - template <class Type> + template<class Type> void sampleAndWrite(fieldGroup<Type>&); //- Disallow default bitwise copy construct and assignment diff --git a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C index 578212ba3fe..13518214190 100644 --- a/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C +++ b/src/sampling/sampledSurface/sampledSurfaces/sampledSurfacesTemplates.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -32,8 +32,7 @@ License template<class Type> void Foam::sampledSurfaces::sampleAndWrite ( - const GeometricField<Type, fvPatchField, volMesh>& vField, - const surfaceWriter<Type>& formatter + const GeometricField<Type, fvPatchField, volMesh>& vField ) { // interpolator for this field @@ -96,7 +95,7 @@ void Foam::sampledSurfaces::sampleAndWrite // skip surface without faces (eg, a failed cut-plane) if (mergeList_[surfI].faces.size()) { - formatter.write + formatter_->write ( outputDir, s.name(), @@ -115,7 +114,7 @@ void Foam::sampledSurfaces::sampleAndWrite // skip surface without faces (eg, a failed cut-plane) if (s.faces().size()) { - formatter.write + formatter_->write ( outputDir, s.name(), @@ -139,12 +138,6 @@ void Foam::sampledSurfaces::sampleAndWrite { if (fields.size()) { - // create or use existing surfaceWriter - if (fields.formatter.empty()) - { - fields.formatter = surfaceWriter<Type>::New(writeFormat_); - } - forAll(fields, fieldI) { if (Pstream::master() && verbose_) @@ -168,8 +161,7 @@ void Foam::sampledSurfaces::sampleAndWrite false ), mesh_ - ), - fields.formatter() + ) ); } else @@ -190,8 +182,7 @@ void Foam::sampledSurfaces::sampleAndWrite <GeometricField<Type, fvPatchField, volMesh> > ( fields[fieldI] - ), - fields.formatter() + ) ); } } diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C index 6bdb3e63e9b..3d477daf9a9 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,10 +28,19 @@ License #include "OFstream.H" #include "OSspecific.H" +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceWriterType(dxSurfaceWriter); +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<class Type> -void Foam::dxSurfaceWriter<Type>::writeGeometry +void Foam::dxSurfaceWriter::writeGeometry ( Ostream& os, const pointField& points, @@ -54,7 +63,6 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry os << nl; // Write triangles - os << "# The irregular connections (triangles)" << nl << "object 2 class array type int rank 1 shape 3 items " << faces.size() << " data follows" << nl; @@ -80,17 +88,41 @@ void Foam::dxSurfaceWriter<Type>::writeGeometry } +void Foam::dxSurfaceWriter::writeTrailer(Ostream& os, const bool isNodeValues) +{ + if (isNodeValues) + { + os << nl << "attribute \"dep\" string \"positions\"" + << nl << nl; + } + else + { + os << nl << "attribute \"dep\" string \"connections\"" + << nl << nl; + } + + os << "# the field, with three components: \"positions\"," + << " \"connections\", and \"data\"" << nl + << "object \"irregular positions irregular " + << "connections\" class field" + << nl + << "component \"positions\" value 1" << nl + << "component \"connections\" value 2" << nl + << "component \"data\" value 3" << nl; + + os << "end" << endl; +} + + namespace Foam { - // Write scalarField in DX format template<> - void Foam::dxSurfaceWriter<Foam::scalar>::writeData + void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<scalar>& values ) { - // Write data os << "object 3 class array type float rank 0 items " << values.size() << " data follows" << nl; @@ -101,15 +133,13 @@ namespace Foam } - // Write vectorField in DX format template<> - void Foam::dxSurfaceWriter<Foam::vector>::writeData + void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<vector>& values ) { - // Write data os << "object 3 class array type float rank 1 shape 3 items " << values.size() << " data follows" << nl; @@ -122,15 +152,13 @@ namespace Foam } - // Write sphericalTensorField in DX format template<> - void Foam::dxSurfaceWriter<Foam::sphericalTensor>::writeData + void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<sphericalTensor>& values ) { - // Write data os << "object 3 class array type float rank 0 items " << values.size() << " data follows" << nl; @@ -141,15 +169,13 @@ namespace Foam } - // Write symmTensorField in DX format template<> - void Foam::dxSurfaceWriter<Foam::symmTensor>::writeData + void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<symmTensor>& values ) { - // Write data os << "object 3 class array type float rank 2 shape 3 items " << values.size() << " data follows" << nl; @@ -165,15 +191,14 @@ namespace Foam } - // Write tensorField in DX format + // Write Field<tensor> in DX format template<> - void Foam::dxSurfaceWriter<Foam::tensor>::writeData + inline void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<tensor>& values ) { - // Write data os << "object 3 class array type float rank 2 shape 3 items " << values.size() << " data follows" << nl; @@ -189,15 +214,15 @@ namespace Foam } } -// Write tensorField in DX format + +// arbitrary field template<class Type> -void Foam::dxSurfaceWriter<Type>::writeData +inline void Foam::dxSurfaceWriter::writeData ( Ostream& os, const Field<Type>& values ) { - // Write data os << "object 3 class array type float rank 0 items " << values.size() << " data follows" << nl; @@ -208,41 +233,8 @@ void Foam::dxSurfaceWriter<Type>::writeData } -// Write trailer in DX format template<class Type> -void Foam::dxSurfaceWriter<Type>::writeTrailer(Ostream& os) -{ - os << "# the field, with three components: \"positions\"," - << " \"connections\", and \"data\"" << nl - << "object \"irregular positions irregular " - << "connections\" class field" - << nl - << "component \"positions\" value 1" << nl - << "component \"connections\" value 2" << nl - << "component \"data\" value 3" << nl; -} - - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::dxSurfaceWriter<Type>::dxSurfaceWriter() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::dxSurfaceWriter<Type>::~dxSurfaceWriter() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::dxSurfaceWriter<Type>::write +void Foam::dxSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, @@ -270,24 +262,29 @@ void Foam::dxSurfaceWriter<Type>::write } writeGeometry(os, points, faces); - writeData(os, values); + writeTrailer(os, isNodeValues); +} - if (isNodeValues) - { - os << nl << "attribute \"dep\" string \"positions\"" - << nl << nl; - } - else - { - os << nl << "attribute \"dep\" string \"connections\"" - << nl << nl; - } - writeTrailer(os); +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - os << "end" << nl; -} +Foam::dxSurfaceWriter::dxSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::dxSurfaceWriter::~dxSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +// create write methods +defineSurfaceWriterWriteFields(Foam::dxSurfaceWriter); // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H index feccf33be1d..e4e3af67e6b 100644 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ Class Foam::dxSurfaceWriter Description + A surfaceWriter for OpenDX format. SourceFiles dxSurfaceWriter.C @@ -42,22 +43,36 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class dxSurfaceWriter Declaration + Class dxSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class dxSurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { // Private Member Functions static void writeGeometry(Ostream&, const pointField&, const faceList&); + static void writeTrailer(Ostream&, const bool isNodeValues); - static void writeData(Ostream&, const Field<Type>& values); + template<class Type> + static void writeData(Ostream&, const Field<Type>&); + + //- Templated write operation + template<class Type> + void writeTemplate + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose + ) const; - static void writeTrailer(Ostream&); public: @@ -77,32 +92,82 @@ public: // Member Functions - // Write + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<scalar>& values, + const bool isNodeValues, + const bool verbose = false + ) const; - //- Writes single surface to file. + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, - const fileName& surfaceName, + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, const bool isNodeValues, const bool verbose = false ) const; -}; + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "dxSurfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C deleted file mode 100644 index a53ba0f34fc..00000000000 --- a/src/sampling/sampledSurface/writers/dx/dxSurfaceWriterRunTime.C +++ /dev/null @@ -1,43 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "dxSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriters(dxSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C index cde2d597a83..d705525ebc4 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -31,37 +31,32 @@ License #include "ensightGeoFile.H" #include "ensightPartNonMeshFaces.H" -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { + makeSurfaceWriterType(ensightSurfaceWriter); +} - // Write scalarField in ensight format - template<> - void Foam::ensightSurfaceWriter<Foam::scalar>::writeData - ( - Ostream& os, - const Field<Foam::scalar>& values - ) - { - forAll(values, i) - { - os << values[i] << nl; - } - } +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - // Write booField in ensight format +namespace Foam +{ + + // Write scalarField in ensight format template<> - void Foam::ensightSurfaceWriter<bool>::writeData + inline void Foam::ensightSurfaceWriter::writeData ( Ostream& os, - const Field<bool>& values + const Field<scalar>& values ) { forAll(values, i) { - os << values[i] << nl; + os << values[i] << nl; } } } @@ -69,96 +64,25 @@ namespace Foam // Write generic field in ensight format template<class Type> -void Foam::ensightSurfaceWriter<Type>::writeData +inline void Foam::ensightSurfaceWriter::writeData ( Ostream& os, const Field<Type>& values ) { - for (direction cmpt = 0; cmpt < vector::nComponents; cmpt++) + for (direction cmpt = 0; cmpt < vector::nComponents; ++cmpt) { scalarField v(values.component(cmpt)); forAll(v, i) { - os << v[i] << nl; + os << v[i] << nl; } } } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components -template<class Type> -Foam::ensightSurfaceWriter<Type>::ensightSurfaceWriter() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::ensightSurfaceWriter<Type>::~ensightSurfaceWriter() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - template<class Type> -void Foam::ensightSurfaceWriter<Type>::write -( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const bool verbose -) const -{ - if (!isDir(outputDir)) - { - mkDir(outputDir); - } - - //const scalar timeValue = Foam::name(this->mesh().time().timeValue()); - const scalar timeValue = 0.0; - - - OFstream caseStr(outputDir/surfaceName + ".case"); - ensightGeoFile geomStr - ( - outputDir/surfaceName + ".000.mesh", - IOstream::ASCII - ); - - if (verbose) - { - Info<< "Writing case file to " << caseStr.name() << endl; - } - - caseStr - << "FORMAT" << nl - << "type: ensight gold" << nl - << nl - << "GEOMETRY" << nl - << "model: 1 " << geomStr.name().name() << nl - << nl - << "TIME" << nl - << "time set: 1" << nl - << "number of steps: 1" << nl - << "filename start number: 0" << nl - << "filename increment: 1" << nl - << "time values:" << nl - << timeValue << nl - << nl; - - ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points); - faceWriter.writeGeometry(geomStr); -} - - -template<class Type> -void Foam::ensightSurfaceWriter<Type>::write +void Foam::ensightSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, @@ -175,10 +99,9 @@ void Foam::ensightSurfaceWriter<Type>::write mkDir(outputDir/fieldName); } - //const scalar timeValue = Foam::name(this->mesh().time().timeValue()); + // const scalar timeValue = Foam::name(this->mesh().time().timeValue()); const scalar timeValue = 0.0; - OFstream caseStr(outputDir/fieldName/surfaceName + ".case"); ensightGeoFile geomStr ( @@ -230,8 +153,8 @@ void Foam::ensightSurfaceWriter<Type>::write << timeValue << nl << nl; - ensightPartNonMeshFaces faceWriter(0, geomStr.name().name(), faces, points); - faceWriter.writeGeometry(geomStr); + ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points); + geomStr << ensPart; // Write field fieldStr @@ -246,19 +169,19 @@ void Foam::ensightSurfaceWriter<Type>::write } else { - //faceWriter.writeField(fieldStr, values); - forAll(faceWriter.elementTypes(), elemI) + // ensPart.writeField(fieldStr, values); + forAll(ensPart.elementTypes(), elemI) { - if (faceWriter.elemLists()[elemI].size()) + if (ensPart.elemLists()[elemI].size()) { - fieldStr.writeKeyword(faceWriter.elementTypes()[elemI]); + fieldStr.writeKeyword(ensPart.elementTypes()[elemI]); writeData ( fieldStr, Field<Type> ( values, - faceWriter.elemLists()[elemI] + ensPart.elemLists()[elemI] ) ); } @@ -267,4 +190,75 @@ void Foam::ensightSurfaceWriter<Type>::write } +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::ensightSurfaceWriter::ensightSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::ensightSurfaceWriter::~ensightSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::ensightSurfaceWriter::write +( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const bool verbose +) const +{ + if (!isDir(outputDir)) + { + mkDir(outputDir); + } + + //const scalar timeValue = Foam::name(this->mesh().time().timeValue()); + const scalar timeValue = 0.0; + + + OFstream caseStr(outputDir/surfaceName + ".case"); + ensightGeoFile geomStr + ( + outputDir/surfaceName + ".000.mesh", + IOstream::ASCII + ); + + if (verbose) + { + Info<< "Writing case file to " << caseStr.name() << endl; + } + + caseStr + << "FORMAT" << nl + << "type: ensight gold" << nl + << nl + << "GEOMETRY" << nl + << "model: 1 " << geomStr.name().name() << nl + << nl + << "TIME" << nl + << "time set: 1" << nl + << "number of steps: 1" << nl + << "filename start number: 0" << nl + << "filename increment: 1" << nl + << "time values:" << nl + << timeValue << nl + << nl; + + ensightPartNonMeshFaces ensPart(0, geomStr.name().name(), faces, points); + geomStr << ensPart; +} + + +// create write methods +defineSurfaceWriterWriteFields(Foam::ensightSurfaceWriter); + + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H index d2f01c6479b..4d2bf47b90b 100644 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2010-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2010-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ Class Foam::ensightSurfaceWriter Description + A surfaceWriter for Ensight format. SourceFiles ensightSurfaceWriter.C @@ -41,29 +42,41 @@ SourceFiles namespace Foam { -class ensightGeoFile; - /*---------------------------------------------------------------------------*\ Class ensightSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class ensightSurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { // Private data - fileName caseFileName_; - fileName surfaceName_; - fileName geomName_; - DynamicList<word> varNames_; - DynamicList<fileName> varFileNames_; +// fileName caseFileName_; +// fileName surfaceName_; +// fileName geomName_; +// DynamicList<word> varNames_; +// DynamicList<fileName> varFileNames_; // Private Member Functions - static void writeData(Ostream&, const Field<Type>& values); + template<class Type> + static inline void writeData(Ostream&, const Field<Type>&); + + //- Templated write operation + template<class Type> + void writeTemplate + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose + ) const; public: @@ -84,9 +97,15 @@ public: // Member Functions - // Write + //- True if the surface format supports geometry in a separate file. + // False if geometry and field must be in a single file + virtual bool separateGeometry() + { + return true; + } - //- Write geometry to file. + + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, @@ -97,30 +116,82 @@ public: ) const; - //- Writes single surface to file. + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, - const fileName& surfaceName, + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, + const word& fieldName, // name of field + const Field<scalar>& values, const bool isNodeValues, const bool verbose = false ) const; -}; + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "ensightSurfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C deleted file mode 100644 index 8355a6d991b..00000000000 --- a/src/sampling/sampledSurface/writers/ensight/ensightSurfaceWriterRunTime.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / 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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "ensightSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriterType(ensightSurfaceWriter, bool); -makeSurfaceWriters(ensightSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C index 747a79f39a9..06005b5c0ae 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,31 +28,28 @@ License #include "OFstream.H" #include "OSspecific.H" -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::foamFileSurfaceWriter<Type>::foamFileSurfaceWriter() -: - surfaceWriter<Type>() -{} +#include "makeSurfaceWriterMethods.H" +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::foamFileSurfaceWriter<Type>::~foamFileSurfaceWriter() -{} +namespace Foam +{ + makeSurfaceWriterType(foamFileSurfaceWriter); +} -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // template<class Type> -void Foam::foamFileSurfaceWriter<Type>::write +void Foam::foamFileSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, const pointField& points, const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, const bool verbose ) const { @@ -65,38 +62,47 @@ void Foam::foamFileSurfaceWriter<Type>::write if (verbose) { - Info<< "Writing geometry to " << surfaceDir << endl; + Info<< "Writing field " << fieldName << " to " << surfaceDir << endl; } - // Points - OFstream(surfaceDir/"points")() << points; - - // Faces - OFstream(surfaceDir/"faces")() << faces; + // geometry should already have been written + // Values to separate directory (e.g. "scalarField/p") - // Face centers. Not really necessary but very handy when reusing as inputs - // for e.g. timeVaryingMapped bc. - pointField faceCentres(faces.size(),point::zero); + fileName foamName(pTraits<Type>::typeName); + fileName valuesDir(surfaceDir / (foamName + Field<Type>::typeName)); - forAll (faces, faceI) + if (!isDir(valuesDir)) { - faceCentres[faceI] = faces[faceI].centre(points); + mkDir(valuesDir); } - OFstream(surfaceDir/"faceCentres")() << faceCentres; + // values + OFstream(valuesDir/fieldName)() << values; } -template<class Type> -void Foam::foamFileSurfaceWriter<Type>::write +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::foamFileSurfaceWriter::foamFileSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::foamFileSurfaceWriter::~foamFileSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::foamFileSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, const bool verbose ) const { @@ -109,24 +115,31 @@ void Foam::foamFileSurfaceWriter<Type>::write if (verbose) { - Info<< "Writing field " << fieldName << " to " << surfaceDir << endl; + Info<< "Writing geometry to " << surfaceDir << endl; } - // geometry should already have been written - // Values to separate directory (e.g. "scalarField/p") + // Points + OFstream(surfaceDir/"points")() << points; - fileName foamName(pTraits<Type>::typeName); - fileName valuesDir(surfaceDir / (foamName + Field<Type>::typeName)); + // Faces + OFstream(surfaceDir/"faces")() << faces; - if (!isDir(valuesDir)) + // Face centers. Not really necessary but very handy when reusing as inputs + // for e.g. timeVaryingMapped bc. + pointField faceCentres(faces.size(),point::zero); + + forAll(faces, faceI) { - mkDir(valuesDir); + faceCentres[faceI] = faces[faceI].centre(points); } - // values - OFstream(valuesDir/fieldName)() << values; + OFstream(surfaceDir/"faceCentres")() << faceCentres; } +// create write methods +defineSurfaceWriterWriteFields(Foam::foamFileSurfaceWriter); + + // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H index 0076abdc88a..ce19c21455a 100644 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -43,14 +43,29 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class foamFileSurfaceWriter Declaration + Class foamFileSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class foamFileSurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { + // Private Member Functions + + //- Templated write operation + template<class Type> + void writeTemplate + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose + ) const; + public: @@ -70,13 +85,14 @@ public: // Member Functions - //- Return true if the surface format supports separate files - virtual bool separateFiles() + //- True if the surface format supports geometry in a separate file. + // False if geometry and field must be in a single file + virtual bool separateGeometry() { return true; } - //- Write geometry to file. + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, @@ -86,30 +102,83 @@ public: const bool verbose = false ) const; - //- Writes single surface to file. + + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, - const fileName& surfaceName, + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, + const word& fieldName, // name of field + const Field<scalar>& values, const bool isNodeValues, const bool verbose = false ) const; -}; + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "foamFileSurfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C deleted file mode 100644 index c8a40e736ca..00000000000 --- a/src/sampling/sampledSurface/writers/foamFile/foamFileSurfaceWriterRunTime.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "foamFileSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriterType(foamFileSurfaceWriter, bool); -makeSurfaceWriters(foamFileSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H new file mode 100644 index 00000000000..b748a32c6c0 --- /dev/null +++ b/src/sampling/sampledSurface/writers/makeSurfaceWriterMethods.H @@ -0,0 +1,92 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 <http://www.gnu.org/licenses/>. + +InClass + Foam::makeSurfaceWriterMethods + +Description + Convenience macros for instantiating writer methods for surfaceWriter + classes. + +\*---------------------------------------------------------------------------*/ + +#ifndef makeSurfaceWriterMethods_H +#define makeSurfaceWriterMethods_H + +#include "surfaceWriter.H" +#include "addToRunTimeSelectionTable.H" + +namespace Foam +{ + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#define makeSurfaceWriterType(ThisClass) \ + defineTypeNameAndDebug(ThisClass, 0); \ + addToRunTimeSelectionTable(surfaceWriter, ThisClass, word) + + +#define defineSurfaceWriterWriteField(ThisClass, FieldType) \ + void ThisClass::write \ + ( \ + const fileName& outputDir, \ + const fileName& surfaceName, \ + const pointField& points, \ + const faceList& faces, \ + const word& fieldName, \ + const Field<FieldType>& values, \ + const bool isNodeValues, \ + const bool verbose \ + ) const \ + { \ + writeTemplate \ + ( \ + outputDir, \ + surfaceName, \ + points, \ + faces, \ + fieldName, \ + values, \ + isNodeValues, \ + verbose \ + ); \ + } + + +#define defineSurfaceWriterWriteFields(ThisClass) \ + defineSurfaceWriterWriteField(ThisClass, scalar); \ + defineSurfaceWriterWriteField(ThisClass, vector); \ + defineSurfaceWriterWriteField(ThisClass, sphericalTensor); \ + defineSurfaceWriterWriteField(ThisClass, symmTensor); \ + defineSurfaceWriterWriteField(ThisClass, tensor) + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C deleted file mode 100644 index 85d4fcbb62c..00000000000 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.C +++ /dev/null @@ -1,63 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "nullSurfaceWriter.H" - -// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // - -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -template<class Type> -Foam::nullSurfaceWriter<Type>::nullSurfaceWriter() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::nullSurfaceWriter<Type>::~nullSurfaceWriter() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::nullSurfaceWriter<Type>::write -( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, - const bool verbose -) const -{} - - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H b/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H deleted file mode 100644 index aef12a76cea..00000000000 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriter.H +++ /dev/null @@ -1,103 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -Class - Foam::nullSurfaceWriter - -Description - -SourceFiles - nullSurfaceWriter.C - -\*---------------------------------------------------------------------------*/ - -#ifndef nullSurfaceWriter_H -#define nullSurfaceWriter_H - -#include "surfaceWriter.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -/*---------------------------------------------------------------------------*\ - Class nullSurfaceWriter Declaration -\*---------------------------------------------------------------------------*/ - -template<class Type> -class nullSurfaceWriter -: - public surfaceWriter<Type> -{ - -public: - - //- Runtime type information - TypeName("null"); - - - // Constructors - - //- Construct null - nullSurfaceWriter(); - - - //- Destructor - virtual ~nullSurfaceWriter(); - - - // Member Functions - - // Write - - //- Writes single surface to file. - virtual void write - ( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, - const bool verbose = false - ) const; -}; - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#ifdef NoRepository -# include "nullSurfaceWriter.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C deleted file mode 100644 index c9fd6af9d94..00000000000 --- a/src/sampling/sampledSurface/writers/null/nullSurfaceWriterRunTime.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "nullSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriterType(nullSurfaceWriter, bool); -makeSurfaceWriters(nullSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C index 11990cfd83a..d598754b384 100644 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,27 +29,34 @@ License #include "OFstream.H" #include "OSspecific.H" +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + defineTypeNameAndDebug(proxySurfaceWriter, 0); +} + + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class Type> -Foam::proxySurfaceWriter<Type>::proxySurfaceWriter(const word& ext) +Foam::proxySurfaceWriter::proxySurfaceWriter(const word& ext) : - surfaceWriter<Type>(), + surfaceWriter(), ext_(ext) {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template<class Type> -Foam::proxySurfaceWriter<Type>::~proxySurfaceWriter() +Foam::proxySurfaceWriter::~proxySurfaceWriter() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class Type> -void Foam::proxySurfaceWriter<Type>::write +void Foam::proxySurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, @@ -69,19 +76,14 @@ void Foam::proxySurfaceWriter<Type>::write mkDir(outputDir); } - fileName fName(outputDir/surfaceName + "." + ext_); + fileName outName(outputDir/surfaceName + "." + ext_); if (verbose) { - Info<< "Writing geometry to " << fName << endl; + Info<< "Writing geometry to " << outName << endl; } - MeshedSurfaceProxy<face> - ( - points, - faces - ).write(fName); - + MeshedSurfaceProxy<face>(points, faces).write(outName); } diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H index 2cbc6c30ac2..ad134b7b6e5 100644 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2009-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,8 @@ Class Foam::proxySurfaceWriter Description + A surfaceWriter that writes the geometry via the MeshedSurfaceProxy, but + which does not support any fields. SourceFiles proxySurfaceWriter.C @@ -42,13 +44,12 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class proxySurfaceWriter Declaration + Class proxySurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class proxySurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { // Private data @@ -74,15 +75,16 @@ public: // Member Functions - //- Always write separate geometry file - virtual bool separateFiles() + + //- True if the surface format supports geometry in a separate file. + // False if geometry and field must be in a single file + virtual bool separateGeometry() { return true; } - // Write - //- Write geometry to file. + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, @@ -92,20 +94,6 @@ public: const bool verbose = false ) const; - - //- Writes single surface to file. - virtual void write - ( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, - const bool verbose = false - ) const - {} }; @@ -115,12 +103,6 @@ public: // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "proxySurfaceWriter.C" -#endif - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - #endif // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C deleted file mode 100644 index 508b41c1b60..00000000000 --- a/src/sampling/sampledSurface/writers/proxy/proxySurfaceWriterRunTime.C +++ /dev/null @@ -1,45 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "proxySurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -// create type names, but do not register with run-time tables -makeTypeSurfaceWritersTypeName(proxySurfaceWriter, bool); -makeSurfaceWritersTypeName(proxySurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C index 46b8a188ecc..90e42c0c074 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -29,274 +29,262 @@ License #include "OSspecific.H" #include "IOmanip.H" +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceWriterType(rawSurfaceWriter); +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeGeometry +inline void Foam::rawSurfaceWriter::writeLocation ( + Ostream& os, const pointField& points, - const label pointI, - Ostream& os + const label pointI ) { const point& pt = points[pointI]; - - os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' '; + os << pt.x() << ' ' << pt.y() << ' ' << pt.z() << ' '; } -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeGeometry +inline void Foam::rawSurfaceWriter::writeLocation ( + Ostream& os, const pointField& points, const faceList& faces, - const label faceI, - Ostream& os + const label faceI ) { const point& ct = faces[faceI].centre(points); - - os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' '; + os << ct.x() << ' ' << ct.y() << ' ' << ct.z() << ' '; } -// Write scalarField in raw format -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeData -( - const word& fieldName, - const pointField& points, - const faceList& faces, - const scalarField& values, - const bool isNodeValues, - Ostream& os -) +namespace Foam { - // header - os << "# x y z " << fieldName << endl; - - // Write data - if (isNodeValues) + template<> + void Foam::rawSurfaceWriter::writeHeader + ( + Ostream& os, + const word& fieldName, + const Field<scalar>& values + ) { - forAll(values, elemI) - { - writeGeometry(points, elemI, os); - os << values[elemI] << nl; - } + os << values.size() << nl + << "# x y z " << fieldName << nl; } - else + + + template<> + void Foam::rawSurfaceWriter::writeHeader + ( + Ostream& os, + const word& fieldName, + const Field<vector>& values + ) { - forAll(values, elemI) - { - writeGeometry(points, faces, elemI, os); - os << values[elemI] << nl; - } + os << values.size() << nl + << "# x y z " + << fieldName << "_x " + << fieldName << "_y " + << fieldName << "_z " + << endl; } - os << nl; -} + template<> + void Foam::rawSurfaceWriter::writeHeader + ( + Ostream& os, + const word& fieldName, + const Field<sphericalTensor>& values + ) + { + os << values.size() << nl + << "# ii " + << fieldName << "_ii" << nl; + } -// Write vectorField in raw format -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeData -( - const word& fieldName, - const pointField& points, - const faceList& faces, - const vectorField& values, - const bool isNodeValues, - Ostream& os -) -{ - // header - os << "# x y z " - << fieldName << "_x " - << fieldName << "_y " - << fieldName << "_z " - << endl; - // Write data - if (isNodeValues) + template<> + void Foam::rawSurfaceWriter::writeHeader + ( + Ostream& os, + const word& fieldName, + const Field<symmTensor>& values + ) { - forAll(values, elemI) + os << values.size() << nl + << "# xx xy xz yy yz "; + for (int i=0; i<6; ++i) { - writeGeometry(points, elemI, os); - - const vector& v = values[elemI]; - os << v[0] << ' ' << v[1] << ' ' << v[2] << nl; + os << fieldName << "_" << i << " "; } + os << endl; } - else + + + template<> + void Foam::rawSurfaceWriter::writeHeader + ( + Ostream& os, + const word& fieldName, + const Field<tensor>& values + ) { - forAll(values, elemI) + os << values.size() << nl + << "# xx xy xz yx yy yz zx zy zz"; + for (int i=0; i<9; ++i) { - writeGeometry(points, faces, elemI, os); - - const vector& v = values[elemI]; - os << v[0] << ' ' << v[1] << ' ' << v[2] << nl; + os << fieldName << "_" << i << " "; } + os << nl; } -} + template<> + inline void Foam::rawSurfaceWriter::writeData + ( + Ostream& os, + const scalar& v + ) + { + os << v << nl; + } -// Write sphericalTensorField in raw format -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeData -( - const word& fieldName, - const pointField& points, - const faceList& faces, - const sphericalTensorField& values, - const bool isNodeValues, - Ostream& os -) -{ - // header - os << "# ii "; - os << fieldName << "_ii" << endl; - // Write data - if (isNodeValues) + template<> + inline void Foam::rawSurfaceWriter::writeData + ( + Ostream& os, + const vector& v + ) { - forAll(values, elemI) - { - writeGeometry(points, elemI, os); + os << v[0] << ' ' << v[1] << ' ' << v[2] << nl; + } - const sphericalTensor& v = values[elemI]; - os << v[0] << nl; - } + + template<> + inline void Foam::rawSurfaceWriter::writeData + ( + Ostream& os, + const sphericalTensor& v + ) + { + os << v[0] << nl; } - else + + + template<> + inline void Foam::rawSurfaceWriter::writeData + ( + Ostream& os, + const symmTensor& v + ) { - forAll(values, elemI) - { - writeGeometry(points, faces, elemI, os); + os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' + << v[3] << ' ' << v[4] << ' ' << v[5] << nl; + } - const sphericalTensor& v = values[elemI]; - os << v[0] << nl; - } + + template<> + inline void Foam::rawSurfaceWriter::writeData + ( + Ostream& os, + const tensor& v + ) + { + os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' + << v[3] << ' ' << v[4] << ' ' << v[5] << ' ' + << v[6] << ' ' << v[7] << ' ' << v[8] << nl; } + } -// Write symmTensorField in raw format template<class Type> -void Foam::rawSurfaceWriter<Type>::writeData +void Foam::rawSurfaceWriter::writeTemplate ( - const word& fieldName, + const fileName& outputDir, + const fileName& surfaceName, const pointField& points, const faceList& faces, - const symmTensorField& values, + const word& fieldName, + const Field<Type>& values, const bool isNodeValues, - Ostream& os -) + const bool verbose +) const { - // header - os << "# xx xy xz yy yz "; - for (int i=0; i<6; i++) + if (!isDir(outputDir)) { - os << fieldName << "_" << i << " "; + mkDir(outputDir); } - os << endl; - // Write data - if (isNodeValues) - { - forAll(values, elemI) - { - writeGeometry(points, elemI, os); + OFstream os(outputDir/fieldName + '_' + surfaceName + ".raw"); - const symmTensor& v = values[elemI]; + if (verbose) + { + Info<< "Writing field " << fieldName << " to " << os.name() << endl; + } - os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' - << v[3] << ' ' << v[4] << ' ' << v[5] << nl; - } + // header + os << "# " << fieldName; + if (isNodeValues) + { + os << " POINT_DATA "; } else { - forAll(values, elemI) - { - writeGeometry(points, faces, elemI, os); - - const symmTensor& v = values[elemI]; - - os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' - << v[3] << ' ' << v[4] << ' ' << v[5] << nl; - } + os << " FACE_DATA "; } -} - -// Write tensorField in raw format -template<class Type> -void Foam::rawSurfaceWriter<Type>::writeData -( - const word& fieldName, - const pointField& points, - const faceList& faces, - const tensorField& values, - const bool isNodeValues, - Ostream& os -) -{ // header - os << "# xx xy xz yx yy yz zx zy zz"; - for (int i=0; i<9; ++i) - { - os << fieldName << "_" << i << " "; - } - os << endl; + writeHeader(os, fieldName, values); - // Write data + // values if (isNodeValues) { forAll(values, elemI) { - writeGeometry(points, elemI, os); - - const tensor& v = values[elemI]; - os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' - << v[3] << ' ' << v[4] << ' ' << v[5] << ' ' - << v[6] << ' ' << v[7] << ' ' << v[8] << nl; + writeLocation(os, points, elemI); + writeData(os, values[elemI]); } } else { forAll(values, elemI) { - writeGeometry(points, faces, elemI, os); - - const tensor& v = values[elemI]; - os << v[0] << ' ' << v[1] << ' ' << v[2] << ' ' - << v[3] << ' ' << v[4] << ' ' << v[5] << ' ' - << v[6] << ' ' << v[7] << ' ' << v[8] << nl; + writeLocation(os, points, faces, elemI); + writeData(os, values[elemI]); } } } + // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class Type> -Foam::rawSurfaceWriter<Type>::rawSurfaceWriter() +Foam::rawSurfaceWriter::rawSurfaceWriter() : - surfaceWriter<Type>() + surfaceWriter() {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template<class Type> -Foam::rawSurfaceWriter<Type>::~rawSurfaceWriter() +Foam::rawSurfaceWriter::~rawSurfaceWriter() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // -template<class Type> -void Foam::rawSurfaceWriter<Type>::write +void Foam::rawSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, @@ -310,10 +298,7 @@ void Foam::rawSurfaceWriter<Type>::write mkDir(outputDir); } - OFstream os - ( - outputDir/surfaceName + ".raw" - ); + OFstream os(outputDir/surfaceName + ".raw"); if (verbose) { @@ -323,82 +308,21 @@ void Foam::rawSurfaceWriter<Type>::write // header os << "# geometry NO_DATA " << faces.size() << nl - << "# x y z" << endl; + << "# x y z" << nl; - // Write faces + // Write faces centres forAll(faces, elemI) { - writeGeometry(points, faces, elemI, os); - os << nl; + writeLocation(os, points, faces, elemI); + os << nl; } - os << nl; + os << nl; } -namespace Foam -{ - // bool fields aren't supported - template<> - void Foam::rawSurfaceWriter<bool>::write - ( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const word& fieldName, - const Field<bool>& values, - const bool isNodeValues, - const bool verbose - ) const - {} -} - - -template<class Type> -void Foam::rawSurfaceWriter<Type>::write -( - const fileName& outputDir, - const fileName& surfaceName, - const pointField& points, - const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, - const bool verbose -) const -{ - if (!isDir(outputDir)) - { - mkDir(outputDir); - } - - OFstream os - ( - outputDir/fieldName + '_' + surfaceName + ".raw" - ); - - if (verbose) - { - Info<< "Writing field " << fieldName << " to " << os.name() << endl; - } - - - // header - os << "# " << fieldName; - if (isNodeValues) - { - os << " POINT_DATA "; - } - else - { - os << " FACE_DATA "; - } - - os << values.size() << nl; - - writeData(fieldName, points, faces, values, isNodeValues, os); -} +// create write methods +defineSurfaceWriterWriteFields(Foam::rawSurfaceWriter); // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H index 771824bd893..5ec4d1ac305 100644 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ Class Foam::rawSurfaceWriter Description + A surfaceWriter for raw output. SourceFiles rawSurfaceWriter.C @@ -36,86 +37,62 @@ SourceFiles #include "surfaceWriter.H" + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // namespace Foam { /*---------------------------------------------------------------------------*\ - Class raw Declaration + Class rawSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class rawSurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { // Private Member Functions - static void writeGeometry + static inline void writeLocation ( - const pointField& points, - const label pointI, - Ostream& os + Ostream&, + const pointField&, + const label pointI ); - static void writeGeometry + static inline void writeLocation ( - const pointField& points, - const faceList& faces, - const label faceI, - Ostream& os + Ostream&, + const pointField&, + const faceList&, + const label faceI ); - static void writeData + template<class Type> + static void writeHeader ( + Ostream&, const word& fieldName, - const pointField& points, - const faceList& faces, - const scalarField& values, - const bool isNodeValues, - Ostream& os + const Field<Type>& ); - static void writeData - ( - const word& fieldName, - const pointField& points, - const faceList& faces, - const vectorField& values, - const bool isNodeValues, - Ostream& os - ); + template<class Type> + static inline void writeData(Ostream&, const Type&); - static void writeData - ( - const word& fieldName, - const pointField& points, - const faceList& faces, - const sphericalTensorField& values, - const bool isNodeValues, - Ostream& os - ); - static void writeData + //- Templated write operation + template<class Type> + void writeTemplate ( - const word& fieldName, + const fileName& outputDir, + const fileName& surfaceName, const pointField& points, const faceList& faces, - const symmTensorField& values, - const bool isNodeValues, - Ostream& os - ); - - static void writeData - ( const word& fieldName, - const pointField& points, - const faceList& faces, - const tensorField& values, + const Field<Type>& values, const bool isNodeValues, - Ostream& os - ); + const bool verbose + ) const; public: @@ -136,9 +113,7 @@ public: // Member Functions - // Write - - //- Write geometry to file. + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, @@ -148,30 +123,83 @@ public: const bool verbose = false ) const; - //- Writes single surface to file. + + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, - const fileName& surfaceName, + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, + const word& fieldName, // name of field + const Field<scalar>& values, const bool isNodeValues, const bool verbose = false ) const; -}; + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "rawSurfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C deleted file mode 100644 index d6a1a89cc91..00000000000 --- a/src/sampling/sampledSurface/writers/raw/rawSurfaceWriterRunTime.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "rawSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriterType(rawSurfaceWriter, bool); -makeSurfaceWriters(rawSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C new file mode 100644 index 00000000000..5ab7290218d --- /dev/null +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.C @@ -0,0 +1,172 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2011-2011 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 <http://www.gnu.org/licenses/>. + +\*---------------------------------------------------------------------------*/ + +#include "starcdSurfaceWriter.H" + +#include "MeshedSurfaceProxy.H" +#include "OFstream.H" +#include "OSspecific.H" + +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceWriterType(starcdSurfaceWriter); +} + + +// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // + +namespace Foam +{ + template<> + inline void Foam::starcdSurfaceWriter::writeData + ( + Ostream& os, + const scalar& v + ) + { + os << v << nl; + } + + + template<> + inline void Foam::starcdSurfaceWriter::writeData + ( + Ostream& os, + const vector& v + ) + { + os << v[0] << ' ' << v[1] << ' ' << v[2] << nl; + } + + + template<> + inline void Foam::starcdSurfaceWriter::writeData + ( + Ostream& os, + const sphericalTensor& v + ) + { + os << v[0] << nl; + } + +} + + +template<class Type> +inline void Foam::starcdSurfaceWriter::writeData +( + Ostream& os, + const Type& v +) +{} + + +template<class Type> +void Foam::starcdSurfaceWriter::writeTemplate +( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose +) const +{ + if (!isDir(outputDir)) + { + mkDir(outputDir); + } + + OFstream os(outputDir/fieldName + '_' + surfaceName + ".usr"); + + if (verbose) + { + Info<< "Writing field " << fieldName << " to " << os.name() << endl; + } + + // no header, just write values + forAll(values, elemI) + { + os << elemI+1 << ' '; + writeData(os, values[elemI]); + } +} + + + +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::starcdSurfaceWriter::starcdSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::starcdSurfaceWriter::~starcdSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::starcdSurfaceWriter::write +( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const bool verbose +) const +{ + if (!isDir(outputDir)) + { + mkDir(outputDir); + } + + fileName outName(outputDir/surfaceName + ".inp"); + + if (verbose) + { + Info<< "Writing geometry to " << outName << endl; + } + + MeshedSurfaceProxy<face>(points, faces).write(outName); +} + + +// create write methods +defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, scalar); +defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, vector); +defineSurfaceWriterWriteField(Foam::starcdSurfaceWriter, sphericalTensor); + + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H new file mode 100644 index 00000000000..bf0a0eb8245 --- /dev/null +++ b/src/sampling/sampledSurface/writers/starcd/starcdSurfaceWriter.H @@ -0,0 +1,181 @@ +/*---------------------------------------------------------------------------*\ + ========= | + \\ / F ield | OpenFOAM: The Open Source CFD Toolbox + \\ / O peration | + \\ / A nd | Copyright (C) 2008-2011 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 <http://www.gnu.org/licenses/>. + +Class + Foam::starcdSurfaceWriter + +Description + A surfaceWriter for STARCD files. + + The geometry is written via the MeshedSurfaceProxy, the fields + are written in a trivial ASCII format with ID and VALUE as + so-called user data. These @c .usr files can be read into proSTAR + with these types of commands. For element data: + @verbatim + getuser FILENAME.usr cell scalar free + getuser FILENAME.usr cell vector free + @endverbatim + and for vertex data: + @verbatim + getuser FILENAME.usr vertex scalar free + getuser FILENAME.usr vertex vector free + @endverbatim + +Note + Only scalar and vector fields are supported directly. + A sphericalTensor is written as a scalar. + Other field types are not written. + +SourceFiles + starcdSurfaceWriter.C + +\*---------------------------------------------------------------------------*/ + +#ifndef starcdSurfaceWriter_H +#define starcdSurfaceWriter_H + +#include "surfaceWriter.H" + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +namespace Foam +{ + +/*---------------------------------------------------------------------------*\ + Class starcdSurfaceWriter Declaration +\*---------------------------------------------------------------------------*/ + +class starcdSurfaceWriter +: + public surfaceWriter +{ + // Private Member Functions + + template<class Type> + static inline void writeData(Ostream&, const Type&); + + + //- Templated write operation + template<class Type> + void writeTemplate + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose + ) const; + + +public: + + //- Runtime type information + TypeName("starcd"); + + + // Constructors + + //- Construct null + starcdSurfaceWriter(); + + + //- Destructor + virtual ~starcdSurfaceWriter(); + + + // Member Functions + + //- True if the surface format supports geometry in a separate file. + // False if geometry and field must be in a single file + virtual bool separateGeometry() + { + return true; + } + + //- Write single surface geometry to file. + virtual void write + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const bool verbose = false + ) const; + + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<scalar>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; + + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +} // End namespace Foam + +// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + +#endif + +// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.C b/src/sampling/sampledSurface/writers/surfaceWriter.C index d4ebc9c2222..0f52c6f4aa8 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.C +++ b/src/sampling/sampledSurface/writers/surfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -26,47 +26,43 @@ License #include "surfaceWriter.H" #include "MeshedSurfaceProxy.H" -#include "nullSurfaceWriter.H" #include "proxySurfaceWriter.H" #include "HashTable.H" #include "word.H" +#include "addToRunTimeSelectionTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -template<class Type> -Foam::autoPtr< Foam::surfaceWriter<Type> > -Foam::surfaceWriter<Type>::New(const word& writeType) +namespace Foam { - typename wordConstructorTable::iterator cstrIter = + defineTypeNameAndDebug(surfaceWriter, 0); + defineRunTimeSelectionTable(surfaceWriter, word); + addNamedToRunTimeSelectionTable + ( + surfaceWriter, + surfaceWriter, + word, + null + ); +} + + +// * * * * * * * * * * * * * Static Member Functions * * * * * * * * * * * * // + +Foam::autoPtr<Foam::surfaceWriter> +Foam::surfaceWriter::New(const word& writeType) +{ + wordConstructorTable::iterator cstrIter = wordConstructorTablePtr_->find(writeType); if (cstrIter == wordConstructorTablePtr_->end()) { - // not supported for this data type, but it generally does work - // (it handles the 'bool' specialization - ie, geometry write) - if - ( - Foam::surfaceWriter<bool>::wordConstructorTablePtr_->found - ( - writeType - ) - ) - { - // use 'null' handler instead - return autoPtr< surfaceWriter<Type> > - ( - new nullSurfaceWriter<Type>() - ); - } - else if (MeshedSurfaceProxy<face>::canWriteType(writeType)) + if (MeshedSurfaceProxy<face>::canWriteType(writeType)) { // generally unknown, but can be written via MeshedSurfaceProxy // use 'proxy' handler instead - return autoPtr< surfaceWriter<Type> > - ( - new proxySurfaceWriter<Type>(writeType) - ); + return autoPtr<surfaceWriter>(new proxySurfaceWriter(writeType)); } if (cstrIter == wordConstructorTablePtr_->end()) @@ -83,24 +79,20 @@ Foam::surfaceWriter<Type>::New(const word& writeType) } } - return autoPtr< surfaceWriter<Type> >(cstrIter()()); + return autoPtr<surfaceWriter>(cstrIter()()); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // -template<class Type> -Foam::surfaceWriter<Type>::surfaceWriter() +Foam::surfaceWriter::surfaceWriter() {} // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // -template<class Type> -Foam::surfaceWriter<Type>::~surfaceWriter() +Foam::surfaceWriter::~surfaceWriter() {} -// * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * * // - // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/surfaceWriter.H b/src/sampling/sampledSurface/writers/surfaceWriter.H index d17db7a3f3a..1057a187bd7 100644 --- a/src/sampling/sampledSurface/writers/surfaceWriter.H +++ b/src/sampling/sampledSurface/writers/surfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -34,7 +34,7 @@ SourceFiles #ifndef surfaceWriter_H #define surfaceWriter_H -#include "Field.H" +#include "volFields.H" #include "typeInfo.H" #include "autoPtr.H" #include "pointField.H" @@ -48,22 +48,12 @@ SourceFiles namespace Foam { -// Forward declaration of friend functions and operators - -template<class Type> class surfaceWriter; -template<class Type> class nullSurfaceWriter; -template<class Type> class proxySurfaceWriter; - /*---------------------------------------------------------------------------*\ Class surfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class surfaceWriter { - //- friendship between writer data types - template<class Type2> friend class surfaceWriter; - public: //- Runtime type information @@ -99,14 +89,15 @@ public: // Member Functions - //- Return true if the surface format supports separate files - virtual bool separateFiles() + //- True if the surface format supports geometry in a separate file. + // False if geometry and field must be in a single file + virtual bool separateGeometry() { return false; } - //- Writes single surface geometry to file. + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, // <root>/<case>/surface/TIME @@ -118,8 +109,8 @@ public: {} - //- Writes single surface to file. Either one value per vertex or - // one value per face (isNodeValues = false) + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( const fileName& outputDir, // <root>/<case>/surface/TIME @@ -127,22 +118,79 @@ public: const pointField& points, const faceList& faces, const word& fieldName, // name of field - const Field<Type>& values, + const Field<scalar>& values, const bool isNodeValues, const bool verbose = false - ) const = 0; -}; + ) const + {} + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const + {} -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const + {} + + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const + {} + + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const + {} + + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "surfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/surfaceWriters.C b/src/sampling/sampledSurface/writers/surfaceWriters.C deleted file mode 100644 index 5a677c793ee..00000000000 --- a/src/sampling/sampledSurface/writers/surfaceWriters.C +++ /dev/null @@ -1,50 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "surfaceWriters.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // -#define defineSurfaceWriterType(dataType) \ - defineNamedTemplateTypeNameAndDebug(surfaceWriter< dataType >, 0); \ - defineTemplatedRunTimeSelectionTable(surfaceWriter, word, dataType) - -defineSurfaceWriterType(bool); - -defineSurfaceWriterType(scalar); -defineSurfaceWriterType(vector); -defineSurfaceWriterType(sphericalTensor); -defineSurfaceWriterType(symmTensor); -defineSurfaceWriterType(tensor); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/surfaceWriters.H b/src/sampling/sampledSurface/writers/surfaceWriters.H deleted file mode 100644 index 0369d2e9937..00000000000 --- a/src/sampling/sampledSurface/writers/surfaceWriters.H +++ /dev/null @@ -1,76 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -InClass - Foam::surfaceWriters - -Description - -\*---------------------------------------------------------------------------*/ - -#ifndef surfaceWriters_H -#define surfaceWriters_H - -#include "surfaceWriter.H" -#include "fieldTypes.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -// Only used internally -#define makeTypeSurfaceWritersTypeName(typeWriter, dataType) \ - \ - defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0) - -// Sometimes used externally -#define makeSurfaceWritersTypeName(typeWriter) \ - \ - makeTypeSurfaceWritersTypeName(typeWriter, scalar); \ - makeTypeSurfaceWritersTypeName(typeWriter, vector); \ - makeTypeSurfaceWritersTypeName(typeWriter, sphericalTensor); \ - makeTypeSurfaceWritersTypeName(typeWriter, symmTensor); \ - makeTypeSurfaceWritersTypeName(typeWriter, tensor) - -// Define type info for single dataType template instantiation (eg, vector) -#define makeSurfaceWriterType(typeWriter, dataType) \ - \ - defineNamedTemplateTypeNameAndDebug(typeWriter< dataType >, 0); \ - addTemplatedToRunTimeSelectionTable \ - ( \ - surfaceWriter, typeWriter, dataType, word \ - ) - - -// Define type info for scalar, vector etc. instantiations -#define makeSurfaceWriters(typeWriter) \ - \ - makeSurfaceWriterType(typeWriter, scalar); \ - makeSurfaceWriterType(typeWriter, vector); \ - makeSurfaceWriterType(typeWriter, sphericalTensor); \ - makeSurfaceWriterType(typeWriter, symmTensor); \ - makeSurfaceWriterType(typeWriter, tensor) - - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -#endif - -// ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C index 085dbd67d09..2f333a95158 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.C @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -28,10 +28,19 @@ License #include "OFstream.H" #include "OSspecific.H" +#include "makeSurfaceWriterMethods.H" + +// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // + +namespace Foam +{ + makeSurfaceWriterType(vtkSurfaceWriter); +} + + // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // -template<class Type> -void Foam::vtkSurfaceWriter<Type>::writeGeometry +void Foam::vtkSurfaceWriter::writeGeometry ( Ostream& os, const pointField& points, @@ -71,12 +80,12 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry { const face& f = faces[faceI]; - os << f.size(); + os << f.size(); forAll(f, fp) { - os << ' ' << f[fp]; + os << ' ' << f[fp]; } - os << nl; + os << nl; } } @@ -84,15 +93,14 @@ void Foam::vtkSurfaceWriter<Type>::writeGeometry namespace Foam { - // Write scalarField in vtk format template<> - void Foam::vtkSurfaceWriter<Foam::scalar>::writeData + void Foam::vtkSurfaceWriter::writeData ( Ostream& os, - const Field<Foam::scalar>& values + const Field<scalar>& values ) { - os << "1 " << values.size() << " float" << nl; + os << "1 " << values.size() << " float" << nl; forAll(values, elemI) { @@ -100,29 +108,28 @@ namespace Foam { if (elemI % 10) { - os << ' '; + os << ' '; } else { - os << nl; + os << nl; } } - const scalar v = values[elemI]; - os << float(v); + os << float(values[elemI]); } - os << nl; + os << nl; } - // Write vectorField in vtk format + template<> - void Foam::vtkSurfaceWriter<Foam::vector>::writeData + void Foam::vtkSurfaceWriter::writeData ( Ostream& os, - const Field<Foam::vector>& values + const Field<vector>& values ) { - os << "3 " << values.size() << " float" << nl; + os << "3 " << values.size() << " float" << nl; forAll(values, elemI) { @@ -133,33 +140,31 @@ namespace Foam } - // Write sphericalTensorField in vtk format template<> - void Foam::vtkSurfaceWriter<Foam::sphericalTensor>::writeData + void Foam::vtkSurfaceWriter::writeData ( Ostream& os, const Field<sphericalTensor>& values ) { - os << "1 " << values.size() << " float" << nl; + os << "1 " << values.size() << " float" << nl; forAll(values, elemI) { const sphericalTensor& v = values[elemI]; - os << float(v[0]) << nl; + os << float(v[0]) << nl; } } - // Write symmTensorField in vtk format template<> - void Foam::vtkSurfaceWriter<Foam::symmTensor>::writeData + void Foam::vtkSurfaceWriter::writeData ( Ostream& os, const Field<symmTensor>& values ) { - os << "6 " << values.size() << " float" << nl; + os << "6 " << values.size() << " float" << nl; forAll(values, elemI) { @@ -172,15 +177,14 @@ namespace Foam } - // Write tensorField in vtk format template<> - void Foam::vtkSurfaceWriter<Foam::tensor>::writeData + void Foam::vtkSurfaceWriter::writeData ( Ostream& os, const Field<tensor>& values ) { - os << "9 " << values.size() << " float" << nl; + os << "9 " << values.size() << " float" << nl; forAll(values, elemI) { @@ -197,47 +201,31 @@ namespace Foam // Write generic field in vtk format template<class Type> -void Foam::vtkSurfaceWriter<Type>::writeData +void Foam::vtkSurfaceWriter::writeData ( Ostream& os, const Field<Type>& values ) { - os << "1 " << values.size() << " float" << nl; + os << "1 " << values.size() << " float" << nl; forAll(values, elemI) { - os << float(0) << nl; + os << float(0) << nl; } } -// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // - -// Construct from components template<class Type> -Foam::vtkSurfaceWriter<Type>::vtkSurfaceWriter() -: - surfaceWriter<Type>() -{} - - -// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // - -template<class Type> -Foam::vtkSurfaceWriter<Type>::~vtkSurfaceWriter() -{} - - -// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // - -template<class Type> -void Foam::vtkSurfaceWriter<Type>::write +void Foam::vtkSurfaceWriter::writeTemplate ( const fileName& outputDir, const fileName& surfaceName, const pointField& points, const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, const bool verbose ) const { @@ -246,28 +234,56 @@ void Foam::vtkSurfaceWriter<Type>::write mkDir(outputDir); } - fileName fName(outputDir/surfaceName + ".vtk"); + OFstream os(outputDir/fieldName + '_' + surfaceName + ".vtk"); if (verbose) { - Info<< "Writing geometry to " << fName << endl; + Info<< "Writing field " << fieldName << " to " << os.name() << endl; } - OFstream os(fName); writeGeometry(os, points, faces); + + // start writing data + if (isNodeValues) + { + os << "POINT_DATA "; + } + else + { + os << "CELL_DATA "; + } + + os << values.size() << nl + << "FIELD attributes 1" << nl + << fieldName << " "; + + // Write data + writeData(os, values); } -template<class Type> -void Foam::vtkSurfaceWriter<Type>::write +// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // + +Foam::vtkSurfaceWriter::vtkSurfaceWriter() +: + surfaceWriter() +{} + + +// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // + +Foam::vtkSurfaceWriter::~vtkSurfaceWriter() +{} + + +// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // + +void Foam::vtkSurfaceWriter::write ( const fileName& outputDir, const fileName& surfaceName, const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, - const bool isNodeValues, const bool verbose ) const { @@ -276,36 +292,19 @@ void Foam::vtkSurfaceWriter<Type>::write mkDir(outputDir); } - OFstream os - ( - outputDir/fieldName + '_' + surfaceName + ".vtk" - ); + OFstream os(outputDir/surfaceName + ".vtk"); if (verbose) { - Info<< "Writing field " << fieldName << " to " << os.name() << endl; + Info<< "Writing geometry to " << os.name() << endl; } writeGeometry(os, points, faces); +} - // start writing data - if (isNodeValues) - { - os << "POINT_DATA "; - } - else - { - os << "CELL_DATA "; - } - - os << values.size() << nl - << "FIELD attributes 1" << nl - << fieldName << " "; - - // Write data - writeData(os, values); -} +// create write methods +defineSurfaceWriterWriteFields(Foam::vtkSurfaceWriter); // ************************************************************************* // diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H index bc13be23c2a..322159094b7 100644 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H +++ b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriter.H @@ -2,7 +2,7 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2004-2010 OpenCFD Ltd. + \\ / A nd | Copyright (C) 2008-2011 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License @@ -25,6 +25,7 @@ Class Foam::vtkSurfaceWriter Description + A surfaceWriter for VTK legacy format. SourceFiles vtkSurfaceWriter.C @@ -42,21 +43,35 @@ namespace Foam { /*---------------------------------------------------------------------------*\ - Class vtkSurfaceWriter Declaration + Class vtkSurfaceWriter Declaration \*---------------------------------------------------------------------------*/ -template<class Type> class vtkSurfaceWriter : - public surfaceWriter<Type> + public surfaceWriter { // Private Member Functions static void writeGeometry(Ostream&, const pointField&, const faceList&); - static void writeData(Ostream&, const Field<Type>& values); + template<class Type> + static void writeData(Ostream&, const Field<Type>&); + //- Templated write operation + template<class Type> + void writeTemplate + ( + const fileName& outputDir, + const fileName& surfaceName, + const pointField& points, + const faceList& faces, + const word& fieldName, + const Field<Type>& values, + const bool isNodeValues, + const bool verbose + ) const; + public: //- Runtime type information @@ -75,9 +90,7 @@ public: // Member Functions - // Write - - //- Write geometry to file. + //- Write single surface geometry to file. virtual void write ( const fileName& outputDir, @@ -88,30 +101,82 @@ public: ) const; - //- Writes single surface to file. + //- Write scalarField for a single surface to file. + // One value per face or vertex (isNodeValues = true) virtual void write ( - const fileName& outputDir, - const fileName& surfaceName, + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface const pointField& points, const faceList& faces, - const word& fieldName, - const Field<Type>& values, + const word& fieldName, // name of field + const Field<scalar>& values, const bool isNodeValues, const bool verbose = false ) const; -}; + //- Write vectorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<vector>& values, + const bool isNodeValues, + const bool verbose = false + ) const; -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // + //- Write sphericalTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<sphericalTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write symmTensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<symmTensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + + //- Write tensorField for a single surface to file. + // One value per face or vertex (isNodeValues = true) + virtual void write + ( + const fileName& outputDir, // <root>/<case>/surface/TIME + const fileName& surfaceName, // name of surface + const pointField& points, + const faceList& faces, + const word& fieldName, // name of field + const Field<tensor>& values, + const bool isNodeValues, + const bool verbose = false + ) const; + +}; -} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // -#ifdef NoRepository -# include "vtkSurfaceWriter.C" -#endif +} // End namespace Foam // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C b/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C deleted file mode 100644 index 1901acfef68..00000000000 --- a/src/sampling/sampledSurface/writers/vtk/vtkSurfaceWriterRunTime.C +++ /dev/null @@ -1,44 +0,0 @@ -/*---------------------------------------------------------------------------*\ - ========= | - \\ / F ield | OpenFOAM: The Open Source CFD Toolbox - \\ / O peration | - \\ / A nd | Copyright (C) 2004-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 <http://www.gnu.org/licenses/>. - -\*---------------------------------------------------------------------------*/ - -#include "vtkSurfaceWriter.H" -#include "surfaceWriters.H" -#include "addToRunTimeSelectionTable.H" - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -namespace Foam -{ - -// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // - -makeSurfaceWriterType(vtkSurfaceWriter, bool); -makeSurfaceWriters(vtkSurfaceWriter); - -// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // - -} // End namespace Foam - -// ************************************************************************* // -- GitLab