1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | foam-extend: Open Source CFD
4 \\ / O peration | Version: 3.2
5 \\ / A nd | Web: http://www.foam-extend.org
6 \\/ M anipulation | For copyright notice see file Copyright
7 -------------------------------------------------------------------------------
9 This file is part of foam-extend.
11 foam-extend is free software: you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation, either version 3 of the License, or (at your
14 option) any later version.
16 foam-extend is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
21 You should have received a copy of the GNU General Public License
22 along with foam-extend. 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 \*---------------------------------------------------------------------------*/
66 #include "sphericalTensor.H"
67 #include "diagTensor.H"
68 #include "symmTensor.H"
70 #include "symmTensor4thOrder.H"
72 #include "runTimeSelectionTables.H"
76 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81 // Forward declaration of classes
84 /*---------------------------------------------------------------------------*\
85 Class writer Declaration
86 \*---------------------------------------------------------------------------*/
94 //- Generates filename from coordSet and sampled fields
95 fileName getBaseName(const coordSet&, const wordList&) const;
97 void writeCoord(const coordSet&, const label sampleI, Ostream&) const;
99 //- Writes single-column ascii write. Column 1 is coordSet coordinate,
100 // columns 2 is the value. Uses write() function
101 // to write coordinate in correct format.
102 void writeTable(const coordSet&, const List<Type>&, Ostream&) const;
104 //- Writes multi-column ascii write. Column 1 is coordSet coordinate,
105 // columns 2..n are the values. Uses write() function
106 // to write coordinate in correct format.
110 const List<const List<Type>*>&,
117 //- Runtime type information
120 // Declare run-time constructor selection table
122 declareRunTimeSelectionTable
134 //- Return a reference to the selected writer
135 static autoPtr<writer> New(const word& writeFormat);
145 virtual ~writer() = 0;
150 //- Generate file name with correct extension
151 virtual fileName getFileName
157 //- General entry point for writing.
158 // The data is organized in a set of point with one or more values
164 const List<const Field<Type>*>&,
168 //- General entry point for writing of multiple coordSets.
169 // Each coordSet (track) has same data variables.
170 // The data is per variable, per track, per point of track.
171 // If writeTracks adds connecting lines (wherever applicable)
174 const bool writeTracks,
175 const PtrList<coordSet>&,
176 const wordList& valueSetNames,
177 const List<List<Field<Type> > >&,
181 //- Write scalar as ascii
182 virtual Ostream& write(const scalar, Ostream&) const;
184 template<class VSType>
185 Ostream& writeVS(const VSType&, Ostream&) const;
187 //- Write vector. Tab separated ascii
188 virtual Ostream& write(const vector&, Ostream&) const;
190 //- Write sphericalTensor. Tab separated ascii
191 virtual Ostream& write(const sphericalTensor&, Ostream&) const;
193 //- Write diagTensor. Tab separated ascii
194 virtual Ostream& write(const diagTensor&, Ostream&) const;
196 //- Write symmTensor. Tab separated ascii
197 virtual Ostream& write(const symmTensor&, Ostream&) const;
199 //- Write tensor. Tab separated ascii
200 virtual Ostream& write(const tensor&, Ostream&) const;
202 //- Write symmTensor4thOrder. Tab separated ascii
203 virtual Ostream& write(const symmTensor4thOrder&, Ostream&) const;
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 } // End namespace Foam
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 // ************************************************************************* //