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 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
83 static void writeCellDataHeader
90 static void writePointDataHeader
98 // Convert to VTK and store
100 static void insert(const scalar&, DynamicList<floatScalar>&);
101 static void insert(const point&, DynamicList<floatScalar>&);
102 static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
103 static void insert(const symmTensor&, DynamicList<floatScalar>&);
104 static void insert(const tensor&, DynamicList<floatScalar>&);
107 //- Append elements to DynamicList
108 static void insert(const labelList&, DynamicList<label>&);
110 static void insert(const List<Type>&, DynamicList<floatScalar>&);
112 //- Write volField with cell values (including decomposed cells)
118 const GeometricField<Type, fvPatchField, volMesh>&,
122 //- Write pointField on all mesh points. Interpolate to cell centre
123 // for decomposed cell centres.
129 const GeometricField<Type, pointPatchField, pointMesh>&,
133 //- Write interpolated field on points and original cell values on
134 // decomposed cell centres.
140 const GeometricField<Type, fvPatchField, volMesh>&,
141 const GeometricField<Type, pointPatchField, pointMesh>&,
145 //- Write generic GeometricFields
146 template<class Type, template<class> class PatchField, class GeoMesh>
151 const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
155 //- Interpolate and write volFields
161 const volPointInterpolation&,
162 const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
168 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 } // End namespace Foam
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
175 # include "writeFunsTemplates.C"
178 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
182 // ************************************************************************* //