BUGFIX: Illegal use of uninitialised value (backport)
[foam-extend-3.2.git] / applications / utilities / postProcessing / dataConversion / foamToVTK / patchWriter.H
blob114175754bcdad8732de1b5622b07ebfbacbc003
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright held by original author
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::patchWriter
28 Description
29     Write patch fields
31 SourceFiles
32     patchWriter.C
33     patchWriterTemplates.C
35 \*---------------------------------------------------------------------------*/
37 #ifndef patchWriter_H
38 #define patchWriter_H
40 #include "pointMesh.H"
41 #include "OFstream.H"
42 #include "volFields.H"
43 #include "pointFields.H"
44 #include "vtkMesh.H"
45 #include "indirectPrimitivePatch.H"
46 #include "PrimitivePatchInterpolation.H"
48 using namespace Foam;
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 namespace Foam
55 class volPointInterpolation;
57 /*---------------------------------------------------------------------------*\
58                            Class patchWriter Declaration
59 \*---------------------------------------------------------------------------*/
61 class patchWriter
63     const vtkMesh& vMesh_;
65     const bool binary_;
67     const bool nearCellValue_;
69     const fileName fName_;
71     const labelList patchIDs_;
73     std::ofstream os_;
75     label nPoints_;
77     label nFaces_;
80 public:
82     // Constructors
84         //- Construct from components
85         patchWriter
86         (
87             const vtkMesh&,
88             const bool binary,
89             const bool nearCellValue,
90             const fileName&,
91             const labelList& patchIDs
92         );
95     // Member Functions
97         std::ofstream& os()
98         {
99             return os_;
100         }
102         label nPoints() const
103         {
104             return nPoints_;
105         }
107         label nFaces() const
108         {
109             return nFaces_;
110         }
112         //- Write cellIDs
113         void writePatchIDs();
115         //- Write volFields
116         template<class Type>
117         void write
118         (
119             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
120         );
122         //- Write pointFields
123         template<class Type>
124         void write
125         (
126             const PtrList<GeometricField<Type, pointPatchField, pointMesh> >&
127         );
129         //- Interpolate and write volFields
130         template<class Type>
131         void write
132         (
133             const PrimitivePatchInterpolation<primitivePatch>&,
134             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
135         );
139 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
141 } // End namespace Foam
143 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
145 #ifdef NoRepository
146 #   include "patchWriterTemplates.C"
147 #endif
150 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
152 #endif
154 // ************************************************************************* //