initial commit for version 1.5.x patch release
[OpenFOAM-1.5.x.git] / applications / utilities / postProcessing / dataConversion / foamToVTK / writeFuns.H
blobdbd375649cf891e4b3821bc8c6989bd5b818ef68
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2008 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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 the
13     Free Software Foundation; either version 2 of the License, or (at your
14     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
19     for more details.
21     You should have received a copy of the GNU General Public License
22     along with OpenFOAM; if not, write to the Free Software Foundation,
23     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 Class
26     Foam::writeFunctions
28 Description
29     Various functions for collecting and writing binary data.
31 SourceFiles
32     writeFunctions.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef writeFunctions_H
37 #define writeFunctions_H
39 #include "floatScalar.H"
40 #include "DynamicList.H"
41 #include "volFieldsFwd.H"
42 #include "pointFieldsFwd.H"
43 #include "vtkMesh.H"
44 #include "volPointInterpolation.H"
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
48 namespace Foam
51 /*---------------------------------------------------------------------------*\
52                            Class writeFuns Declaration
53 \*---------------------------------------------------------------------------*/
55 class writeFuns
57     // Private member functions
59         // Swap halves of word.
61             static void swapWord(label& word32);
62             static void swapWords(const label nWords, label* words32);
65 public:
67     // Write ascii or binary. If binary optionally in-place swaps argument
69         static void write(std::ostream&, const bool, List<floatScalar>&);
70         static void write(std::ostream&, const bool, DynamicList<floatScalar>&);
71         static void write(std::ostream&, const bool, labelList&);
72         static void write(std::ostream&, const bool, DynamicList<label>&);
75     // Write header
77         static void writeHeader(std::ostream&, const bool, const string&);
78         static void writeCellDataHeader(std::ostream&, const label, const label);
79         static void writePointDataHeader
80         (
81             std::ostream&,
82             const label,
83             const label
84         );
87     // Convert to VTK and store
89         static void insert(const scalar&, DynamicList<floatScalar>&);
90         static void insert(const point&, DynamicList<floatScalar>&);
91         static void insert(const sphericalTensor&, DynamicList<floatScalar>&);
92         static void insert(const symmTensor&, DynamicList<floatScalar>&);
93         static void insert(const tensor&, DynamicList<floatScalar>&);
96     //- Append elements to DynamicList
97     static void insert(const labelList&, DynamicList<label>&);
98     template<class Type>
99     static void insert(const List<Type>&, DynamicList<floatScalar>&);
101     //- Write volField with cell values (including decomposed cells)
102     template<class Type>
103     static void write
104     (
105         std::ostream&,
106         const bool binary,
107         const GeometricField<Type, fvPatchField, volMesh>&,
108         const vtkMesh&
109     );
111     //- Write pointField on all mesh points. Interpolate to cell centre
112     //  for decomposed cell centres.
113     template<class Type>
114     static void write
115     (
116         std::ostream&,
117         const bool binary,
118         const GeometricField<Type, pointPatchField, pointMesh>&,
119         const vtkMesh&
120     );
122     //- Write interpolated field on points and original cell values on
123     //  decomposed cell centres.
124     template<class Type>
125     static void write
126     (
127         std::ostream&,
128         const bool binary,
129         const GeometricField<Type, fvPatchField, volMesh>&,
130         const GeometricField<Type, pointPatchField, pointMesh>&,
131         const vtkMesh&
132     );
134     //- Write generic GeometricFields
135     template<class Type, template<class> class PatchField, class GeoMesh>
136     static void write
137     (
138         std::ostream&,
139         const bool binary,
140         const PtrList<GeometricField<Type, PatchField, GeoMesh> >&,
141         const vtkMesh&
142     );
144     //- Interpolate and write volFields
145     template<class Type>
146     static void write
147     (
148         std::ostream&,
149         const bool binary,
150         const volPointInterpolation&,
151         const PtrList<GeometricField<Type, fvPatchField, volMesh> >&,
152         const vtkMesh&
153     );
157 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
159 } // End namespace Foam
161 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 #ifdef NoRepository
164 #   include "writeFunsTemplates.C"
165 #endif
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
169 #endif
171 // ************************************************************************* //