Forward compatibility: flex
[foam-extend-3.2.git] / applications / utilities / postProcessing / dataConversion / foamToVTK / patchWriter.H
blob33aa11437a94f5eddec12db42ba4a17c899a4087
1 /*---------------------------------------------------------------------------*\
2   =========                 |
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 -------------------------------------------------------------------------------
8 License
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/>.
24 Class
25     Foam::patchWriter
27 Description
28     Write patch fields
30 SourceFiles
31     patchWriter.C
32     patchWriterTemplates.C
34 \*---------------------------------------------------------------------------*/
36 #ifndef patchWriter_H
37 #define patchWriter_H
39 #include "pointMesh.H"
40 #include "OFstream.H"
41 #include "volFields.H"
42 #include "pointFields.H"
43 #include "vtkMesh.H"
44 #include "indirectPrimitivePatch.H"
45 #include "PrimitivePatchInterpolationTemplate.H"
47 using namespace Foam;
49 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 namespace Foam
54 class volPointInterpolation;
56 /*---------------------------------------------------------------------------*\
57                            Class patchWriter Declaration
58 \*---------------------------------------------------------------------------*/
60 class patchWriter
62     const vtkMesh& vMesh_;
64     const bool binary_;
66     const bool nearCellValue_;
68     const fileName fName_;
70     const labelList patchIDs_;
72     std::ofstream os_;
74     label nPoints_;
76     label nFaces_;
79 public:
81     // Constructors
83         //- Construct from components
84         patchWriter
85         (
86             const vtkMesh&,
87             const bool binary,
88             const bool nearCellValue,
89             const fileName&,
90             const labelList& patchIDs
91         );
94     // Member Functions
96         std::ofstream& os()
97         {
98             return os_;
99         }
101         label nPoints() const
102         {
103             return nPoints_;
104         }
106         label nFaces() const
107         {
108             return nFaces_;
109         }
111         //- Write cellIDs
112         void writePatchIDs();
114         //- Write volFields
115         template<class Type>
116         void write
117         (
118             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
119         );
121         //- Write pointFields
122         template<class Type>
123         void write
124         (
125             const PtrList<GeometricField<Type, pointPatchField, pointMesh> >&
126         );
128         //- Interpolate and write volFields
129         template<class Type>
130         void write
131         (
132             const PrimitivePatchInterpolation<primitivePatch>&,
133             const PtrList<GeometricField<Type, fvPatchField, volMesh> >&
134         );
138 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
140 } // End namespace Foam
142 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
144 #ifdef NoRepository
145 #   include "patchWriterTemplates.C"
146 #endif
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
151 #endif
153 // ************************************************************************* //