1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
11 OpenFOAM is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by
13 the Free Software Foundation, either version 3 of the License, or
14 (at your option) any later version.
16 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
28 Base class for graphics format writing. Entry points are
30 Write to an Ostream a table of points with corresponding values.
31 - write(scalar/vector/sphericalTensor/symmTensor/tensor). \n
32 Write single scalar/vector/sphericalTensor/symmTensor/tensor.
33 Default is to write space separated components.
37 // Construct writer of xmgr type
38 autoPtr<writer<scalar> > scalarFormatter(writer<scalar>::New("xmgr"));
40 // Output list of points and corresponding values
41 scalarFormatter().write
45 points, // sample coordinates
46 "someLine", // name of coordSet
47 "distance", // write coordinates as distance to refPoint
48 points[0] // reference point
50 "U.component(0)", // name of values
58 \*---------------------------------------------------------------------------*/
68 #include "runTimeSelectionTables.H"
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
77 // Forward declaration of classes
80 /*---------------------------------------------------------------------------*\
81 Class writer Declaration
82 \*---------------------------------------------------------------------------*/
90 //- Generates filename from coordSet and sampled fields
91 fileName getBaseName(const coordSet&, const wordList&) const;
93 void writeCoord(const coordSet&, const label sampleI, Ostream&) const;
95 //- Writes single-column ascii write. Column 1 is coordSet coordinate,
96 // columns 2 is the value. Uses write() function
97 // to write coordinate in correct format.
98 void writeTable(const coordSet&, const List<Type>&, Ostream&) const;
100 //- Writes multi-column ascii write. Column 1 is coordSet coordinate,
101 // columns 2..n are the values. Uses write() function
102 // to write coordinate in correct format.
106 const List<const List<Type>*>&,
110 //- Writes a separator. Used by write functions.
111 virtual void writeSeparator(Ostream& os) const;
115 //- Runtime type information
118 // Declare run-time constructor selection table
120 declareRunTimeSelectionTable
132 //- Return a reference to the selected writer
133 static autoPtr<writer> New(const word& writeFormat);
143 virtual ~writer() = 0;
148 //- Generate file name with correct extension
149 virtual fileName getFileName
155 //- General entry point for writing.
156 // The data is organized in a set of point with one or more values
162 const List<const Field<Type>*>&,
166 //- General entry point for writing of multiple coordSets.
167 // Each coordSet (track) has same data variables.
168 // The data is per variable, per track, per point of track.
169 // If writeTracks adds connecting lines (wherever applicable)
172 const bool writeTracks,
173 const PtrList<coordSet>&,
174 const wordList& valueSetNames,
175 const List<List<Field<Type> > >&,
179 //- Write scalar as ascii
180 virtual Ostream& write(const scalar, Ostream&) const;
182 template<class VSType>
183 Ostream& writeVS(const VSType&, Ostream&) const;
185 //- Write vector. Tab separated ascii
186 virtual Ostream& write(const vector&, Ostream&) const;
188 //- Write sphericalTensor. Tab separated ascii
189 virtual Ostream& write(const sphericalTensor&, Ostream&) const;
191 //- Write symmTensor. Tab separated ascii
192 virtual Ostream& write(const symmTensor&, Ostream&) const;
194 //- Write tensor. Tab separated ascii
195 virtual Ostream& write(const tensor&, Ostream&) const;
199 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 } // End namespace Foam
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
214 // ************************************************************************* //