sampling: use new runtime macros and avoid typedefs for each writer/instance

This commit is contained in:
Mark Olesen 2008-11-21 21:46:06 +01:00
parent bad35371b8
commit 7cf90b039e
52 changed files with 479 additions and 1108 deletions

View File

@ -29,7 +29,6 @@ License
#include "GeometricField.H" #include "GeometricField.H"
#include "meshToMesh.H" #include "meshToMesh.H"
#include "cuttingPlane.H"
#include "IOobjectList.H" #include "IOobjectList.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -12,11 +12,13 @@ sampledSet/midPointAndFace/midPointAndFaceSet.C
sampledSet/sampledSets/sampledSets.C sampledSet/sampledSets/sampledSets.C
sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C sampledSet/sampledSetsFunctionObject/sampledSetsFunctionObject.C
sampledSet/writers/writer/writers.C setWriters = sampledSet/writers
sampledSet/writers/raw/rawWriters.C
sampledSet/writers/xmgr/xmgrWriters.C $(setWriters)/writers.C
sampledSet/writers/gnuplot/gnuplotWriters.C $(setWriters)/gnuplot/gnuplotSetWriterRunTime.C
sampledSet/writers/jplot/jplotWriters.C $(setWriters)/jplot/jplotSetWriterRunTime.C
$(setWriters)/raw/rawSetWriterRunTime.C
$(setWriters)/xmgrace/xmgraceSetWriterRunTime.C
cuttingPlane/cuttingPlane.C cuttingPlane/cuttingPlane.C
@ -31,13 +33,15 @@ sampledSurface/sampledSurface/sampledSurface.C
sampledSurface/sampledSurfaces/sampledSurfaces.C sampledSurface/sampledSurfaces/sampledSurfaces.C
sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C sampledSurface/sampledSurfacesFunctionObject/sampledSurfacesFunctionObject.C
sampledSurface/writers/surfaceWriters.C surfWriters = sampledSurface/writers
sampledSurface/writers/foamFile/foamFileWriters.C
sampledSurface/writers/dx/dxWriters.C $(surfWriters)/surfaceWriters.C
sampledSurface/writers/raw/rawSurfaceWriters.C $(surfWriters)/dx/dxSurfaceWriterRunTime.C
sampledSurface/writers/vtk/vtkWriters.C $(surfWriters)/foamFile/foamFileSurfaceWriterRunTime.C
sampledSurface/writers/stl/stlWriters.C $(surfWriters)/null/nullSurfaceWriterRunTime.C
sampledSurface/writers/null/nullWriters.C $(surfWriters)/raw/rawSurfaceWriterRunTime.C
$(surfWriters)/stl/stlSurfaceWriterRunTime.C
$(surfWriters)/vtk/vtkSurfaceWriterRunTime.C
graphField/writePatchGraph.C graphField/writePatchGraph.C
graphField/writeCellGraph.C graphField/writeCellGraph.C

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gnuplot.H" #include "gnuplotSetWriter.H"
#include "clock.H" #include "clock.H"
#include "coordSet.H" #include "coordSet.H"
#include "fileName.H" #include "fileName.H"
@ -34,9 +34,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class Type> template<class Type>
Foam::gnuplot<Type>::gnuplot() Foam::gnuplotSetWriter<Type>::gnuplotSetWriter()
: :
writer<Type>() writer<Type>()
{} {}
@ -44,14 +43,14 @@ Foam::gnuplot<Type>::gnuplot()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::gnuplot<Type>::~gnuplot() Foam::gnuplotSetWriter<Type>::~gnuplotSetWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::fileName Foam::gnuplot<Type>::getFileName Foam::fileName Foam::gnuplotSetWriter<Type>::getFileName
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames const wordList& valueSetNames
@ -62,7 +61,7 @@ Foam::fileName Foam::gnuplot<Type>::getFileName
template<class Type> template<class Type>
void Foam::gnuplot<Type>::write void Foam::gnuplotSetWriter<Type>::write
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames, const wordList& valueSetNames,

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::gnuplot Foam::gnuplotSetWriter
Description Description
SourceFiles SourceFiles
gnuplot.C gnuplotSetWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef gnuplot_H #ifndef gnuplotSetWriter_H
#define gnuplot_H #define gnuplotSetWriter_H
#include "writer.H" #include "writer.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class gnuplot Declaration Class gnuplotSetWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class gnuplot class gnuplotSetWriter
: :
public writer<Type> public writer<Type>
{ {
@ -61,11 +61,11 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
gnuplot(); gnuplotSetWriter();
//- Destructor //- Destructor
virtual ~gnuplot(); virtual ~gnuplotSetWriter();
// Member Functions // Member Functions
@ -93,7 +93,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "gnuplot.C" # include "gnuplotSetWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,14 +24,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "gnuplotWriters.H" #include "gnuplotSetWriter.H"
#include "writers.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeWriters(gnuplot) makeSetWriters(gnuplotSetWriter)
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::gnuplotWriters
SourceFiles
gnuplotWriters.C
\*---------------------------------------------------------------------------*/
#ifndef gnuplotWriters_H
#define gnuplotWriters_H
#include "gnuplot.H"
#include "writers.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWritersTypedefs(gnuplot)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "jplot.H" #include "jplotSetWriter.H"
#include "clock.H" #include "clock.H"
#include "coordSet.H" #include "coordSet.H"
#include "fileName.H" #include "fileName.H"
@ -34,21 +34,19 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::Ostream& Foam::jplot<Type>::writeHeader(Ostream& os) const Foam::Ostream& Foam::jplotSetWriter<Type>::writeHeader(Ostream& os) const
{ {
return os return os
<< "# JPlot input file" << endl << "# JPlot input file" << nl
<< "#" << endl << "#" << nl << nl
<< endl
<< "# Generated by sample on " << clock::date().c_str() << endl; << "# Generated by sample on " << clock::date().c_str() << endl;
} }
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class Type> template<class Type>
Foam::jplot<Type>::jplot() Foam::jplotSetWriter<Type>::jplotSetWriter()
: :
writer<Type>() writer<Type>()
{} {}
@ -57,14 +55,14 @@ Foam::jplot<Type>::jplot()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::jplot<Type>::~jplot() Foam::jplotSetWriter<Type>::~jplotSetWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::fileName Foam::jplot<Type>::getFileName Foam::fileName Foam::jplotSetWriter<Type>::getFileName
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames const wordList& valueSetNames
@ -75,7 +73,7 @@ Foam::fileName Foam::jplot<Type>::getFileName
template<class Type> template<class Type>
void Foam::jplot<Type>::write void Foam::jplotSetWriter<Type>::write
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames, const wordList& valueSetNames,
@ -83,7 +81,7 @@ void Foam::jplot<Type>::write
Ostream& os Ostream& os
) const ) const
{ {
os << "# JPlot file" << endl os << "# JPlot file" << nl
<< "# column 1: " << points.name() << endl; << "# column 1: " << points.name() << endl;
forAll(valueSets, i) forAll(valueSets, i)

View File

@ -23,15 +23,15 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::jplot Foam::jplotSetWriter
SourceFiles SourceFiles
jplot.C jplotSetWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef jplot_H #ifndef jplotSetWriter_H
#define jplot_H #define jplotSetWriter_H
#include "writer.H" #include "writer.H"
#include "vector.H" #include "vector.H"
@ -42,11 +42,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class jplot Declaration Class jplotSetWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class jplot class jplotSetWriter
: :
public writer<Type> public writer<Type>
{ {
@ -65,11 +65,11 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
jplot(); jplotSetWriter();
//- Destructor //- Destructor
virtual ~jplot(); virtual ~jplotSetWriter();
// Member Functions // Member Functions
@ -97,7 +97,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "jplot.C" # include "jplotSetWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,14 +24,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "xmgrWriters.H" #include "jplotSetWriter.H"
#include "writers.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeWriters(xmgr) makeSetWriters(jplotSetWriter)
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::jplotWriters
SourceFiles
jplotWriters.C
\*---------------------------------------------------------------------------*/
#ifndef jplotWriters_H
#define jplotWriters_H
#include "jplot.H"
#include "writers.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWritersTypedefs(jplot)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,16 +24,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "raw.H" #include "rawSetWriter.H"
#include "coordSet.H" #include "coordSet.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class Type> template<class Type>
Foam::raw<Type>::raw() Foam::rawSetWriter<Type>::rawSetWriter()
: :
writer<Type>() writer<Type>()
{} {}
@ -42,14 +41,14 @@ Foam::raw<Type>::raw()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::raw<Type>::~raw() Foam::rawSetWriter<Type>::~rawSetWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::fileName Foam::raw<Type>::getFileName Foam::fileName Foam::rawSetWriter<Type>::getFileName
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames const wordList& valueSetNames
@ -60,7 +59,7 @@ Foam::fileName Foam::raw<Type>::getFileName
template<class Type> template<class Type>
void Foam::raw<Type>::write void Foam::rawSetWriter<Type>::write
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames, const wordList& valueSetNames,

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::raw Foam::rawSetWriter
Description Description
SourceFiles SourceFiles
raw.C rawSetWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef raw_H #ifndef rawSetWriter_H
#define raw_H #define rawSetWriter_H
#include "writer.H" #include "writer.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class raw Declaration Class rawSetWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class raw class rawSetWriter
: :
public writer<Type> public writer<Type>
{ {
@ -61,11 +61,11 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
raw(); rawSetWriter();
//- Destructor //- Destructor
virtual ~raw(); virtual ~rawSetWriter();
// Member Functions // Member Functions
@ -93,7 +93,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "raw.C" # include "rawSetWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,14 +24,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "jplotWriters.H" #include "rawSetWriter.H"
#include "writers.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeWriters(jplot) makeSetWriters(rawSetWriter)
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -1,51 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::rawWriters
SourceFiles
rawWriters.C
\*---------------------------------------------------------------------------*/
#ifndef rawWriters_H
#define rawWriters_H
#include "raw.H"
#include "writers.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWritersTypedefs(raw)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -205,49 +205,6 @@ public:
# include "writer.C" # include "writer.C"
#endif #endif
// Only used internally
#define makeTypeWritersTypeName(type) \
\
defineNamedTemplateTypeNameAndDebug(type, 0);
// Used externally sometimes
#define makeWritersTypeName(typeWriter) \
\
makeTypeWritersTypeName(typeWriter##ScalarWriter); \
makeTypeWritersTypeName(typeWriter##VectorWriter); \
makeTypeWritersTypeName(typeWriter##SphericalTensorWriter); \
makeTypeWritersTypeName(typeWriter##SymmTensorWriter); \
makeTypeWritersTypeName(typeWriter##TensorWriter);
// Define type info for single template instantiation (e.g. vector)
#define makeWriterTypes(WriterType, type) \
\
defineNamedTemplateTypeNameAndDebug(type, 0); \
\
addToRunTimeSelectionTable \
( \
WriterType, type, word \
);
// Define type info info for scalar, vector etc. instantiations
#define makeWriters(typeWriter) \
\
makeWriterTypes(writerScalarWriter, typeWriter##ScalarWriter); \
makeWriterTypes(writerVectorWriter, typeWriter##VectorWriter); \
makeWriterTypes(writerSphericalTensorWriter, typeWriter##SphericalTensorWriter);\
makeWriterTypes(writerSymmTensorWriter, typeWriter##SymmTensorWriter); \
makeWriterTypes(writerTensorWriter, typeWriter##TensorWriter);
#define makeWritersTypedefs(typeWriter) \
\
typedef typeWriter<scalar> typeWriter##ScalarWriter; \
typedef typeWriter<vector> typeWriter##VectorWriter; \
typedef typeWriter<sphericalTensor> typeWriter##SphericalTensorWriter; \
typedef typeWriter<symmTensor> typeWriter##SymmTensorWriter; \
typedef typeWriter<tensor> typeWriter##TensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,55 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "writers.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
defineNamedTemplateTypeNameAndDebug(writerScalarWriter, 0);
defineTemplateRunTimeSelectionTable(writerScalarWriter, word);
defineNamedTemplateTypeNameAndDebug(writerVectorWriter, 0);
defineTemplateRunTimeSelectionTable(writerVectorWriter, word);
defineNamedTemplateTypeNameAndDebug(writerSphericalTensorWriter, 0);
defineTemplateRunTimeSelectionTable(writerSphericalTensorWriter, word);
defineNamedTemplateTypeNameAndDebug(writerSymmTensorWriter, 0);
defineTemplateRunTimeSelectionTable(writerSymmTensorWriter, word);
defineNamedTemplateTypeNameAndDebug(writerTensorWriter, 0);
defineTemplateRunTimeSelectionTable(writerTensorWriter, word);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,50 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::rawWriters
SourceFiles
writers.C
\*---------------------------------------------------------------------------*/
#ifndef writers_H
#define writers_H
#include "writer.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWritersTypedefs(writer)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -0,0 +1,50 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "writers.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
#define defineSetWriterType(dataType) \
defineNamedTemplateTypeNameAndDebug(writer<dataType >, 0); \
defineTemplatedRunTimeSelectionTable(writer, word, dataType);
defineSetWriterType(scalar);
defineSetWriterType(vector);
defineSetWriterType(sphericalTensor);
defineSetWriterType(symmTensor);
defineSetWriterType(tensor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -0,0 +1,80 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::writer
SourceFiles
writers.C
\*---------------------------------------------------------------------------*/
#ifndef writers_H
#define writers_H
#include "writer.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Only used internally
#define makeTypeSetWritersTypeName(typeWriter, dataType) \
\
defineNamedTemplateTypeNameAndDebug(typeWriter<dataType >, 0);
// Sometimes used externally
#define makeSetWritersTypeName(typeWriter) \
\
makeTypeSetWritersTypeName(typeWriter, scalar); \
makeTypeSetWritersTypeName(typeWriter, vector); \
makeTypeSetWritersTypeName(typeWriter, sphericalTensor); \
makeTypeSetWritersTypeName(typeWriter, symmTensor); \
makeTypeSetWritersTypeName(typeWriter, tensor);
// Define type info for single dataType template instantiation (eg, vector)
#define makeSetWriterType(typeWriter, dataType) \
\
defineNamedTemplateTypeNameAndDebug(typeWriter<dataType >, 0); \
addTemplatedToRunTimeSelectionTable \
( \
writer, typeWriter, dataType, word \
);
// Define type info for scalar, vector etc. instantiations
#define makeSetWriters(typeWriter) \
\
makeSetWriterType(typeWriter, scalar); \
makeSetWriterType(typeWriter, vector); \
makeSetWriterType(typeWriter, sphericalTensor); \
makeSetWriterType(typeWriter, symmTensor); \
makeSetWriterType(typeWriter, tensor);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -1,54 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::xmgrWriters
Description
SourceFiles
xmgrWriters.C
\*---------------------------------------------------------------------------*/
#ifndef xmgrWriters_H
#define xmgrWriters_H
#include "xmgr.H"
#include "writers.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
makeWritersTypedefs(xmgr)
}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "xmgr.H" #include "xmgraceSetWriter.H"
#include "coordSet.H" #include "coordSet.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
@ -32,9 +32,8 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
// Construct from components
template<class Type> template<class Type>
Foam::xmgr<Type>::xmgr() Foam::xmgraceSetWriter<Type>::xmgraceSetWriter()
: :
writer<Type>() writer<Type>()
{} {}
@ -43,14 +42,14 @@ Foam::xmgr<Type>::xmgr()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::xmgr<Type>::~xmgr() Foam::xmgraceSetWriter<Type>::~xmgraceSetWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::fileName Foam::xmgr<Type>::getFileName Foam::fileName Foam::xmgraceSetWriter<Type>::getFileName
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames const wordList& valueSetNames
@ -61,7 +60,7 @@ Foam::fileName Foam::xmgr<Type>::getFileName
template<class Type> template<class Type>
void Foam::xmgr<Type>::write void Foam::xmgraceSetWriter<Type>::write
( (
const coordSet& points, const coordSet& points,
const wordList& valueSetNames, const wordList& valueSetNames,
@ -85,5 +84,4 @@ void Foam::xmgr<Type>::write
} }
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::xmgr Foam::xmgraceSetWriter
Description Description
SourceFiles SourceFiles
xmgr.C xmgraceSetWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef xmgr_H #ifndef xmgraceSetWriter_H
#define xmgr_H #define xmgraceSetWriter_H
#include "writer.H" #include "writer.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class xmgr Declaration Class xmgraceSetWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class xmgr class xmgraceSetWriter
: :
public writer<Type> public writer<Type>
{ {
@ -61,11 +61,11 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
xmgr(); xmgraceSetWriter();
//- Destructor //- Destructor
virtual ~xmgr(); virtual ~xmgraceSetWriter();
// Member Functions // Member Functions
@ -93,7 +93,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "xmgr.C" # include "xmgraceSetWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,14 +24,15 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rawWriters.H" #include "xmgraceSetWriter.H"
#include "writers.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam namespace Foam
{ {
makeWriters(raw) makeSetWriters(xmgraceSetWriter)
} }
// ************************************************************************* // // ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "dx.H" #include "dxSurfaceWriter.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
#include "faceList.H" #include "faceList.H"
@ -33,7 +33,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXGeometry void Foam::dxSurfaceWriter<Type>::writeDXGeometry
( (
const pointField& points, const pointField& points,
const faceList& faces, const faceList& faces,
@ -84,7 +84,7 @@ void Foam::dx<Type>::writeDXGeometry
// Write scalarField in DX format // Write scalarField in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXData void Foam::dxSurfaceWriter<Type>::writeDXData
( (
const pointField& points, const pointField& points,
const scalarField& values, const scalarField& values,
@ -116,7 +116,7 @@ void Foam::dx<Type>::writeDXData
// Write vectorField in DX format // Write vectorField in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXData void Foam::dxSurfaceWriter<Type>::writeDXData
( (
const pointField& points, const pointField& points,
const vectorField& values, const vectorField& values,
@ -150,7 +150,7 @@ void Foam::dx<Type>::writeDXData
// Write sphericalTensorField in DX format // Write sphericalTensorField in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXData void Foam::dxSurfaceWriter<Type>::writeDXData
( (
const pointField& points, const pointField& points,
const sphericalTensorField& values, const sphericalTensorField& values,
@ -182,7 +182,7 @@ void Foam::dx<Type>::writeDXData
// Write symmTensorField in DX format // Write symmTensorField in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXData void Foam::dxSurfaceWriter<Type>::writeDXData
( (
const pointField& points, const pointField& points,
const symmTensorField& values, const symmTensorField& values,
@ -219,7 +219,7 @@ void Foam::dx<Type>::writeDXData
// Write tensorField in DX format // Write tensorField in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXData void Foam::dxSurfaceWriter<Type>::writeDXData
( (
const pointField& points, const pointField& points,
const tensorField& values, const tensorField& values,
@ -256,7 +256,7 @@ void Foam::dx<Type>::writeDXData
// Write trailer in DX format // Write trailer in DX format
template<class Type> template<class Type>
void Foam::dx<Type>::writeDXTrailer(Ostream& os) const void Foam::dxSurfaceWriter<Type>::writeDXTrailer(Ostream& os) const
{ {
os << "# the field, with three components: \"positions\"," os << "# the field, with three components: \"positions\","
<< " \"connections\", and \"data\"" << nl << " \"connections\", and \"data\"" << nl
@ -272,7 +272,7 @@ void Foam::dx<Type>::writeDXTrailer(Ostream& os) const
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::dx<Type>::dx() Foam::dxSurfaceWriter<Type>::dxSurfaceWriter()
: :
surfaceWriter<Type>() surfaceWriter<Type>()
{} {}
@ -281,14 +281,14 @@ Foam::dx<Type>::dx()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::dx<Type>::~dx() Foam::dxSurfaceWriter<Type>::~dxSurfaceWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::dx<Type>::write void Foam::dxSurfaceWriter<Type>::write
( (
const fileName& samplePath, const fileName& samplePath,
const fileName& timeDir, const fileName& timeDir,
@ -307,22 +307,22 @@ void Foam::dx<Type>::write
mkDir(surfaceDir); mkDir(surfaceDir);
} }
fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".dx"); fileName fName(surfaceDir/fieldName + '_' + surfaceName + ".dx");
if (verbose) if (verbose)
{ {
Info<< "Writing field " << fieldName << " to " << planeFName << endl; Info<< "Writing field " << fieldName << " to " << fName << endl;
} }
OFstream dxFile(planeFName); OFstream os(fName);
writeDXGeometry(points, faces, dxFile); writeDXGeometry(points, faces, os);
writeDXData(points, values, dxFile); writeDXData(points, values, os);
writeDXTrailer(dxFile); writeDXTrailer(os);
dxFile << "end" << nl; os << "end" << nl;
} }

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::dx Foam::dxSurfaceWriter
Description Description
SourceFiles SourceFiles
dx.C dxSurfaceWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef dx_H #ifndef dxSurfaceWriter_H
#define dx_H #define dxSurfaceWriter_H
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class dx Declaration Class dxSurfaceWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class dx class dxSurfaceWriter
: :
public surfaceWriter<Type> public surfaceWriter<Type>
{ {
@ -107,12 +107,12 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
dx(); dxSurfaceWriter();
// Destructor // Destructor
virtual ~dx(); virtual ~dxSurfaceWriter();
// Member Functions // Member Functions
@ -141,7 +141,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "dx.C" # include "dxSurfaceWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "dxWriters.H" #include "dxSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -34,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(dx); makeSurfaceWriters(dxSurfaceWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::dxWriters
Description
SourceFiles
dxWriters.C
\*---------------------------------------------------------------------------*/
#ifndef dxWriters_H
#define dxWriters_H
#include "dx.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef dx<scalar> dxScalarWriter;
typedef dx<vector> dxVectorWriter;
typedef dx<sphericalTensor> dxSphericalTensorWriter;
typedef dx<symmTensor> dxSymmTensorWriter;
typedef dx<tensor> dxTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "foamFile.H" #include "foamFileSurfaceWriter.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
#include "faceList.H" #include "faceList.H"
@ -33,7 +33,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::foamFile<Type>::foamFile() Foam::foamFileSurfaceWriter<Type>::foamFileSurfaceWriter()
: :
surfaceWriter<Type>() surfaceWriter<Type>()
{} {}
@ -42,14 +42,14 @@ Foam::foamFile<Type>::foamFile()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::foamFile<Type>::~foamFile() Foam::foamFileSurfaceWriter<Type>::~foamFileSurfaceWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::foamFile<Type>::write void Foam::foamFileSurfaceWriter<Type>::write
( (
const fileName& samplePath, const fileName& samplePath,
const fileName& timeDir, const fileName& timeDir,
@ -61,42 +61,36 @@ void Foam::foamFile<Type>::write
const bool verbose const bool verbose
) const ) const
{ {
fileName planeFName(samplePath/timeDir/surfaceName); fileName surfaceDir(samplePath/timeDir/surfaceName);
if (!exists(planeFName)) if (!exists(surfaceDir))
{ {
mkDir(planeFName); mkDir(surfaceDir);
} }
if (verbose) if (verbose)
{ {
Info<< "Writing field " << fieldName << " to " << planeFName << endl; Info<< "Writing field " << fieldName << " to " << surfaceDir << endl;
} }
// Points // Points
OFstream pointsFile(planeFName/"points"); OFstream(surfaceDir/"points")() << points;
pointsFile << points;
// Faces // Faces
OFstream facesFile(planeFName/"faces"); OFstream(surfaceDir/"faces")() << faces;
facesFile << faces;
// Values to separate directory (e.g. "scalarField/p") // Values to separate directory (e.g. "scalarField/p")
fileName foamName(pTraits<Type>::typeName); fileName foamName(pTraits<Type>::typeName);
fileName valuesDir(surfaceDir / (foamName + Field<Type>::typeName));
fileName valuesDir(planeFName / (foamName + Field<Type>::typeName));
if (!exists(valuesDir)) if (!exists(valuesDir))
{ {
mkDir(valuesDir); mkDir(valuesDir);
} }
OFstream valuesFile(valuesDir/fieldName); // values
OFstream(valuesDir/fieldName)() << values;
valuesFile << values;
} }

View File

@ -23,18 +23,18 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::foamFile Foam::foamFileSurfaceWriter
Description Description
A surfaceWriter for foamFiles A surfaceWriter for foamFiles
SourceFiles SourceFiles
foamFile.C foamFileSurfaceWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef foamFile_H #ifndef foamFileSurfaceWriter_H
#define foamFile_H #define foamFileSurfaceWriter_H
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -44,11 +44,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class foamFile Declaration Class foamFileSurfaceWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class foamFile class foamFileSurfaceWriter
: :
public surfaceWriter<Type> public surfaceWriter<Type>
{ {
@ -62,12 +62,12 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
foamFile(); foamFileSurfaceWriter();
// Destructor // Destructor
virtual ~foamFile(); virtual ~foamFileSurfaceWriter();
// Member Functions // Member Functions
@ -96,7 +96,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "foamFile.C" # include "foamFileSurfaceWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "foamFileSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(foamFileSurfaceWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::foamFileWriters
Description
SourceFiles
foamFileWriters.C
\*---------------------------------------------------------------------------*/
#ifndef foamFileWriters_H
#define foamFileWriters_H
#include "foamFile.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef foamFile<scalar> foamFileScalarWriter;
typedef foamFile<vector> foamFileVectorWriter;
typedef foamFile<sphericalTensor> foamFileSphericalTensorWriter;
typedef foamFile<symmTensor> foamFileSymmTensorWriter;
typedef foamFile<tensor> foamFileTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "null.H" #include "nullSurfaceWriter.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
#include "faceList.H" #include "faceList.H"
@ -35,7 +35,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::null<Type>::null() Foam::nullSurfaceWriter<Type>::nullSurfaceWriter()
: :
surfaceWriter<Type>() surfaceWriter<Type>()
{} {}
@ -44,14 +44,14 @@ Foam::null<Type>::null()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::null<Type>::~null() Foam::nullSurfaceWriter<Type>::~nullSurfaceWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::null<Type>::write void Foam::nullSurfaceWriter<Type>::write
( (
const fileName& samplePath, const fileName& samplePath,
const fileName& timeDir, const fileName& timeDir,

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::null Foam::nullSurfaceWriter
Description Description
SourceFiles SourceFiles
null.C nullSurfaceWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef null_H #ifndef nullSurfaceWriter_H
#define null_H #define nullSurfaceWriter_H
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class null Declaration Class nullSurfaceWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class null class nullSurfaceWriter
: :
public surfaceWriter<Type> public surfaceWriter<Type>
{ {
@ -61,12 +61,12 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
null(); nullSurfaceWriter();
// Destructor // Destructor
virtual ~null(); virtual ~nullSurfaceWriter();
// Member Functions // Member Functions
@ -95,7 +95,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "null.C" # include "nullSurfaceWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -0,0 +1,44 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "nullSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(nullSurfaceWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::nullWriters
Description
SourceFiles
nullWriters.C
\*---------------------------------------------------------------------------*/
#ifndef nullWriters_H
#define nullWriters_H
#include "null.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef null<scalar> nullScalarWriter;
typedef null<vector> nullVectorWriter;
typedef null<sphericalTensor> nullSphericalTensorWriter;
typedef null<symmTensor> nullSymmTensorWriter;
typedef null<tensor> nullTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -347,16 +347,15 @@ void Foam::rawSurfaceWriter<Type>::write
mkDir(surfaceDir); mkDir(surfaceDir);
} }
fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".raw"); fileName fName(surfaceDir/fieldName + '_' + surfaceName + ".raw");
if (verbose) if (verbose)
{ {
Info<< "Writing field " << fieldName << " to " << planeFName << endl; Info<< "Writing field " << fieldName << " to " << fName << endl;
} }
OFstream rawFile(planeFName); OFstream os(fName);
writeData(fieldName, points, faces, values, os);
writeData(fieldName, points, faces, values, rawFile);
} }

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "rawSurfaceWriters.H" #include "rawSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::rawSurfaceWriters
Description
SourceFiles
rawSurfaceWriters.C
\*---------------------------------------------------------------------------*/
#ifndef rawSurfaceWriters_H
#define rawSurfaceWriters_H
#include "rawSurfaceWriter.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef rawSurfaceWriter<scalar> rawSurfaceWriterScalarWriter;
typedef rawSurfaceWriter<vector> rawSurfaceWriterVectorWriter;
typedef rawSurfaceWriter<sphericalTensor> rawSurfaceWriterSphericalTensorWriter;
typedef rawSurfaceWriter<symmTensor> rawSurfaceWriterSymmTensorWriter;
typedef rawSurfaceWriter<tensor> rawSurfaceWriterTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "stl.H" #include "stlSurfaceWriter.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
#include "faceList.H" #include "faceList.H"
@ -34,7 +34,7 @@ License
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::stl<Type>::stl() Foam::stlSurfaceWriter<Type>::stlSurfaceWriter()
: :
surfaceWriter<Type>() surfaceWriter<Type>()
{} {}
@ -43,14 +43,14 @@ Foam::stl<Type>::stl()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::stl<Type>::~stl() Foam::stlSurfaceWriter<Type>::~stlSurfaceWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::stl<Type>::write void Foam::stlSurfaceWriter<Type>::write
( (
const fileName& samplePath, const fileName& samplePath,
const fileName& timeDir, const fileName& timeDir,
@ -69,11 +69,11 @@ void Foam::stl<Type>::write
mkDir(surfaceDir); mkDir(surfaceDir);
} }
fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".stl"); fileName fName(surfaceDir/fieldName + '_' + surfaceName + ".stl");
if (verbose) if (verbose)
{ {
Info<< "Writing field " << fieldName << " to " << planeFName << endl; Info<< "Writing field " << fieldName << " to " << fName << endl;
} }
// Convert faces to triangles. // Convert faces to triangles.
@ -108,7 +108,7 @@ void Foam::stl<Type>::write
) )
), ),
points points
).write(planeFName); ).write(fName);
} }

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::stl Foam::stlSurfaceWriter
Description Description
SourceFiles SourceFiles
stl.C stlSurfaceWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef stl_H #ifndef stlSurfaceWriter_H
#define stl_H #define stlSurfaceWriter_H
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class stl Declaration Class stlSurfaceWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class stl class stlSurfaceWriter
: :
public surfaceWriter<Type> public surfaceWriter<Type>
{ {
@ -61,12 +61,12 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
stl(); stlSurfaceWriter();
// Destructor // Destructor
virtual ~stl(); virtual ~stlSurfaceWriter();
// Member Functions // Member Functions
@ -95,7 +95,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "stl.C" # include "stlSurfaceWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "foamFileWriters.H" #include "stlSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -34,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(foamFile); makeSurfaceWriters(stlSurfaceWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,43 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "stlWriters.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(stl);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::stlWriters
Description
SourceFiles
stlWriters.C
\*---------------------------------------------------------------------------*/
#ifndef stlWriters_H
#define stlWriters_H
#include "stl.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef stl<scalar> stlScalarWriter;
typedef stl<vector> stlVectorWriter;
typedef stl<sphericalTensor> stlSphericalTensorWriter;
typedef stl<symmTensor> stlSymmTensorWriter;
typedef stl<tensor> stlTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //

View File

@ -117,41 +117,6 @@ public:
# include "surfaceWriter.C" # include "surfaceWriter.C"
#endif #endif
// Only used internally
#define makeTypeSurfaceWritersTypeName(type) \
\
defineNamedTemplateTypeNameAndDebug(type, 0);
// Used externally sometimes
#define makeSurfaceWritersTypeName(typeWriter) \
\
makeTypeSurfaceWritersTypeName(typeWriter##ScalarWriter); \
makeTypeSurfaceWritersTypeName(typeWriter##VectorWriter); \
makeTypeSurfaceWritersTypeName(typeWriter##SphericalTensorWriter); \
makeTypeSurfaceWritersTypeName(typeWriter##SymmTensorWriter); \
makeTypeSurfaceWritersTypeName(typeWriter##TensorWriter);
// Define type info for single template instantiation (e.g. vector)
#define makeSurfaceWriterTypes(WriterType, type) \
\
defineNamedTemplateTypeNameAndDebug(type, 0); \
\
addToRunTimeSelectionTable \
( \
WriterType, type, word \
);
// Define type info info for scalar, vector etc. instantiations
#define makeSurfaceWriters(typeWriter) \
\
makeSurfaceWriterTypes(scalarWriter, typeWriter##ScalarWriter); \
makeSurfaceWriterTypes(vectorWriter, typeWriter##VectorWriter); \
makeSurfaceWriterTypes(sphericalTensorWriter, typeWriter##SphericalTensorWriter);\
makeSurfaceWriterTypes(symmTensorWriter, typeWriter##SymmTensorWriter); \
makeSurfaceWriterTypes(tensorWriter, typeWriter##TensorWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif #endif

View File

@ -32,21 +32,15 @@ namespace Foam
{ {
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
#define defineSurfaceWriterType(dataType) \
defineNamedTemplateTypeNameAndDebug(surfaceWriter<dataType >, 0); \
defineTemplatedRunTimeSelectionTable(surfaceWriter, word, dataType);
defineNamedTemplateTypeNameAndDebug(scalarWriter, 0); defineSurfaceWriterType(scalar);
defineTemplateRunTimeSelectionTable(scalarWriter, word); defineSurfaceWriterType(vector);
defineSurfaceWriterType(sphericalTensor);
defineNamedTemplateTypeNameAndDebug(vectorWriter, 0); defineSurfaceWriterType(symmTensor);
defineTemplateRunTimeSelectionTable(vectorWriter, word); defineSurfaceWriterType(tensor);
defineNamedTemplateTypeNameAndDebug(sphericalTensorWriter, 0);
defineTemplateRunTimeSelectionTable(sphericalTensorWriter, word);
defineNamedTemplateTypeNameAndDebug(symmTensorWriter, 0);
defineTemplateRunTimeSelectionTable(symmTensorWriter, word);
defineNamedTemplateTypeNameAndDebug(tensorWriter, 0);
defineTemplateRunTimeSelectionTable(tensorWriter, word);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -36,21 +36,39 @@ Description
#include "fieldTypes.H" #include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
// Only used internally
#define makeTypeSurfaceWritersTypeName(typeWriter, dataType) \
\
defineNamedTemplateTypeNameAndDebug(typeWriter<dataType >, 0);
namespace Foam // 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 \
);
typedef surfaceWriter<scalar> scalarWriter;
typedef surfaceWriter<vector> vectorWriter;
typedef surfaceWriter<sphericalTensor> sphericalTensorWriter;
typedef surfaceWriter<symmTensor> symmTensorWriter;
typedef surfaceWriter<tensor> tensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // 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);
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,7 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "vtk.H" #include "vtkSurfaceWriter.H"
#include "fileName.H" #include "fileName.H"
#include "OFstream.H" #include "OFstream.H"
#include "faceList.H" #include "faceList.H"
@ -33,7 +33,7 @@ License
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * // // * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtk<Type>::writeGeometry void Foam::vtkSurfaceWriter<Type>::writeGeometry
( (
const pointField& points, const pointField& points,
const faceList& faces, const faceList& faces,
@ -48,37 +48,33 @@ void Foam::vtk<Type>::writeGeometry
<< "ASCII" << nl << "ASCII" << nl
<< "DATASET POLYDATA" << nl; << "DATASET POLYDATA" << nl;
// Write vertex coords
os << "POINTS " << points.size() << " float" << nl; os << "POINTS " << points.size() << " float" << nl;
forAll(points, pointI) forAll(points, pointI)
{ {
const point& pt = points[pointI]; const point& pt = points[pointI];
os << float(pt.x()) << ' '
os << float(pt.x()) << ' ' << float(pt.y()) << ' ' << float(pt.z()) << float(pt.y()) << ' '
<< nl; << float(pt.z()) << nl;
} }
os << endl; os << endl;
// Write triangles // Write faces
label nNodes = 0;
label nFaceVerts = 0;
forAll(faces, faceI) forAll(faces, faceI)
{ {
const face& f = faces[faceI]; nNodes += faces[faceI].size();
nFaceVerts += f.size() + 1;
} }
os << "POLYGONS " << faces.size() << ' ' << nFaceVerts << nl; os << "POLYGONS " << faces.size() << ' '
<< faces.size() + nNodes << nl;
forAll(faces, faceI) forAll(faces, faceI)
{ {
const face& f = faces[faceI]; const face& f = faces[faceI];
os << f.size(); os << f.size();
forAll(f, fp) forAll(f, fp)
{ {
os << ' ' << f[fp]; os << ' ' << f[fp];
@ -90,7 +86,7 @@ void Foam::vtk<Type>::writeGeometry
// Write scalarField in vtk format // Write scalarField in vtk format
template<class Type> template<class Type>
void Foam::vtk<Type>::writeData void Foam::vtkSurfaceWriter<Type>::writeData
( (
const fileName& fieldName, const fileName& fieldName,
const pointField& points, const pointField& points,
@ -116,16 +112,18 @@ void Foam::vtk<Type>::writeData
forAll(values, elemI) forAll(values, elemI)
{ {
if (elemI)
{
if (elemI % 10)
{
os << ' ';
}
else
{
os << nl;
}
}
os << float(values[elemI]); os << float(values[elemI]);
if (elemI > 0 && (elemI%10) == 0)
{
os << nl;
}
else
{
os << ' ';
}
} }
os << nl; os << nl;
} }
@ -133,7 +131,7 @@ void Foam::vtk<Type>::writeData
// Write vectorField in vtk format // Write vectorField in vtk format
template<class Type> template<class Type>
void Foam::vtk<Type>::writeData void Foam::vtkSurfaceWriter<Type>::writeData
( (
const fileName& fieldName, const fileName& fieldName,
const pointField& points, const pointField& points,
@ -168,7 +166,7 @@ void Foam::vtk<Type>::writeData
// Write sphericalTensorField in vtk format // Write sphericalTensorField in vtk format
template<class Type> template<class Type>
void Foam::vtk<Type>::writeData void Foam::vtkSurfaceWriter<Type>::writeData
( (
const fileName& fieldName, const fileName& fieldName,
const pointField& points, const pointField& points,
@ -204,7 +202,7 @@ void Foam::vtk<Type>::writeData
// Write symmTensorField in vtk format // Write symmTensorField in vtk format
template<class Type> template<class Type>
void Foam::vtk<Type>::writeData void Foam::vtkSurfaceWriter<Type>::writeData
( (
const fileName& fieldName, const fileName& fieldName,
const pointField& points, const pointField& points,
@ -241,7 +239,7 @@ void Foam::vtk<Type>::writeData
// Write tensorField in vtk format // Write tensorField in vtk format
template<class Type> template<class Type>
void Foam::vtk<Type>::writeData void Foam::vtkSurfaceWriter<Type>::writeData
( (
const fileName& fieldName, const fileName& fieldName,
const pointField& points, const pointField& points,
@ -281,7 +279,7 @@ void Foam::vtk<Type>::writeData
// Construct from components // Construct from components
template<class Type> template<class Type>
Foam::vtk<Type>::vtk() Foam::vtkSurfaceWriter<Type>::vtkSurfaceWriter()
: :
surfaceWriter<Type>() surfaceWriter<Type>()
{} {}
@ -290,14 +288,14 @@ Foam::vtk<Type>::vtk()
// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
template<class Type> template<class Type>
Foam::vtk<Type>::~vtk() Foam::vtkSurfaceWriter<Type>::~vtkSurfaceWriter()
{} {}
// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
template<class Type> template<class Type>
void Foam::vtk<Type>::write void Foam::vtkSurfaceWriter<Type>::write
( (
const fileName& samplePath, const fileName& samplePath,
const fileName& timeDir, const fileName& timeDir,
@ -316,18 +314,17 @@ void Foam::vtk<Type>::write
mkDir(surfaceDir); mkDir(surfaceDir);
} }
fileName planeFName(surfaceDir/fieldName + '_' + surfaceName + ".vtk"); fileName fName(surfaceDir/fieldName + '_' + surfaceName + ".vtk");
if (verbose) if (verbose)
{ {
Info<< "Writing field " << fieldName << " to " << planeFName << endl; Info<< "Writing field " << fieldName << " to " << fName << endl;
} }
OFstream vtkFile(planeFName); OFstream os(fName);
writeGeometry(points, faces, vtkFile); writeGeometry(points, faces, os);
writeData(fieldName, points, values, os);
writeData(fieldName, points, values, vtkFile);
} }

View File

@ -23,17 +23,17 @@ License
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Class Class
Foam::vtk Foam::vtkSurfaceWriter
Description Description
SourceFiles SourceFiles
vtk.C vtkSurfaceWriter.C
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#ifndef vtk_H #ifndef vtkSurfaceWriter_H
#define vtk_H #define vtkSurfaceWriter_H
#include "surfaceWriter.H" #include "surfaceWriter.H"
@ -43,11 +43,11 @@ namespace Foam
{ {
/*---------------------------------------------------------------------------*\ /*---------------------------------------------------------------------------*\
Class vtk Declaration Class vtkSurfaceWriter Declaration
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
template<class Type> template<class Type>
class vtk class vtkSurfaceWriter
: :
public surfaceWriter<Type> public surfaceWriter<Type>
{ {
@ -110,12 +110,12 @@ public:
// Constructors // Constructors
//- Construct null //- Construct null
vtk(); vtkSurfaceWriter();
// Destructor // Destructor
virtual ~vtk(); virtual ~vtkSurfaceWriter();
// Member Functions // Member Functions
@ -144,7 +144,7 @@ public:
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#ifdef NoRepository #ifdef NoRepository
# include "vtk.C" # include "vtkSurfaceWriter.C"
#endif #endif
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -24,7 +24,8 @@ License
\*---------------------------------------------------------------------------*/ \*---------------------------------------------------------------------------*/
#include "nullWriters.H" #include "vtkSurfaceWriter.H"
#include "surfaceWriters.H"
#include "addToRunTimeSelectionTable.H" #include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@ -34,7 +35,7 @@ namespace Foam
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(null); makeSurfaceWriters(vtkSurfaceWriter);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //

View File

@ -1,43 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
\*---------------------------------------------------------------------------*/
#include "vtkWriters.H"
#include "addToRunTimeSelectionTable.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
makeSurfaceWriters(vtk);
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// ************************************************************************* //

View File

@ -1,63 +0,0 @@
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2008 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 2 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, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
InClass
Foam::vtkWriters
Description
SourceFiles
vtkWriters.C
\*---------------------------------------------------------------------------*/
#ifndef vtkWriters_H
#define vtkWriters_H
#include "vtk.H"
#include "surfaceWriters.H"
#include "fieldTypes.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
{
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
typedef vtk<scalar> vtkScalarWriter;
typedef vtk<vector> vtkVectorWriter;
typedef vtk<sphericalTensor> vtkSphericalTensorWriter;
typedef vtk<symmTensor> vtkSymmTensorWriter;
typedef vtk<tensor> vtkTensorWriter;
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
} // End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //