1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2010 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 Various functions for collecting and writing binary data.
33 \*---------------------------------------------------------------------------*/
35 #ifndef writeFunctions_H
36 #define writeFunctions_H
38 #include "floatScalar.H"
39 #include "DynamicList.H"
40 #include "volFieldsFwd.H"
41 #include "pointFieldsFwd.H"
43 #include "volPointInterpolation.H"
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50 /*---------------------------------------------------------------------------*\
51 Class writeFuns Declaration
52 \*---------------------------------------------------------------------------*/
56 // Private member functions
58 // Swap halves of word.
60 static void swapWord(label& word32);
61 static void swapWords(const label nWords, label* words32);
66 // Write ascii or binary. If binary optionally in-place swaps argument
68 static void write(std::ostream&, const bool, List<floatScalar>&);
69 static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
70 static void write(std::ostream&, const bool, labelList&);
71 static void write(std::ostream&, const bool, DynamicList<label>&);
76 static void writeHeader(std::ostream&, const bool, const string&);
77 static void writeCellDataHeader(std::ostream&, const label, const label);
78 static void writePointDataHeader
86 // Convert to VTK and store
88 static void insert(const scalar&, DynamicList<floatScalar>&);
89 static void insert(const point&, DynamicList<floatScalar>&);
90 static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
91 static void insert(const symmTensor&, DynamicList<floatScalar>&);
92 static void insert(const tensor&, DynamicList<floatScalar>&);
95 //- Append elements to DynamicList
96 static void insert(const labelList&, DynamicList<label>&);
98 static void insert(const List<Type>&, DynamicList<floatScalar>&);
100 //- Write volField with cell values (including decomposed cells)
106 const GeometricField<Type, fvPatchField, volMesh>&,
110 //- Write pointField on all mesh points. Interpolate to cell centre
111 // for decomposed cell centres.
117 const GeometricField<Type, pointPatchField, pointMesh>&,
121 //- Write interpolated field on points and original cell values on
122 // decomposed cell centres.
128 const GeometricField<Type, fvPatchField, volMesh>&,
129 const GeometricField<Type, pointPatchField, pointMesh>&,
133 //- Write generic GeometricFields
134 template<class Type, template<class> class PatchField, class GeoMesh>
139 const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
143 //- Interpolate and write volFields
149 const volPointInterpolation&,
150 const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
158 } // End namespace Foam
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 # include "writeFunsTemplates.C"
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 // ************************************************************************* //