1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
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 \*---------------------------------------------------------------------------*/
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
80 const std::string& title
82 static void writeCellDataHeader
88 static void writePointDataHeader
96 // Convert to VTK and store
98 static void insert(const scalar, DynamicList<floatScalar>&);
99 static void insert(const point&, DynamicList<floatScalar>&);
100 static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
101 static void insert(const symmTensor&, DynamicList<floatScalar>&);
102 static void insert(const tensor&, DynamicList<floatScalar>&);
105 //- Append elements to DynamicList
106 static void insert(const labelList&, DynamicList<label>&);
108 static void insert(const List<Type>&, DynamicList<floatScalar>&);
110 //- Write volField with cell values (including decomposed cells)
116 const GeometricField<Type, fvPatchField, volMesh>&,
120 //- Write pointField on all mesh points. Interpolate to cell centre
121 // for decomposed cell centres.
127 const GeometricField<Type, pointPatchField, pointMesh>&,
131 //- Write interpolated field on points and original cell values on
132 // decomposed cell centres.
138 const GeometricField<Type, fvPatchField, volMesh>&,
139 const GeometricField<Type, pointPatchField, pointMesh>&,
143 //- Write generic GeometricFields
144 template<class Type, template<class> class PatchField, class GeoMesh>
149 const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
153 //- Interpolate and write volFields
159 const volPointInterpolation&,
160 const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
166 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 } // End namespace Foam
170 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 # include "writeFunsTemplates.C"
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 // ************************************************************************* //