Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / sampling / sampledSurface / writers / raw / rawSurfaceWriter.H
blobc08b0eee5e9d997afefe91c1f89987e60779b688
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 2008-2011 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
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
19     for more details.
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/>.
24 Class
25     Foam::rawSurfaceWriter
27 Description
28     A surfaceWriter for raw output.
30 SourceFiles
31     rawSurfaceWriter.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef rawSurfaceWriter_H
36 #define rawSurfaceWriter_H
38 #include "surfaceWriter.H"
41 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 namespace Foam
46 /*---------------------------------------------------------------------------*\
47                       Class rawSurfaceWriter Declaration
48 \*---------------------------------------------------------------------------*/
50 class rawSurfaceWriter
52     public surfaceWriter
54     // Private Member Functions
56         static inline void writeLocation
57         (
58             Ostream&,
59             const pointField&,
60             const label pointI
61         );
63         static inline void writeLocation
64         (
65             Ostream&,
66             const pointField&,
67             const faceList&,
68             const label faceI
69         );
71         template<class Type>
72         static void writeHeader
73         (
74             Ostream&,
75             const word& fieldName,
76             const Field<Type>&
77         );
79         template<class Type>
80         static inline void writeData(Ostream&, const Type&);
83         //- Templated write operation
84         template<class Type>
85         void writeTemplate
86         (
87             const fileName& outputDir,
88             const fileName& surfaceName,
89             const pointField& points,
90             const faceList& faces,
91             const word& fieldName,
92             const Field<Type>& values,
93             const bool isNodeValues,
94             const bool verbose
95         ) const;
98 public:
100     //- Runtime type information
101     TypeName("raw");
104     // Constructors
106         //- Construct null
107         rawSurfaceWriter();
110     //- Destructor
111     virtual ~rawSurfaceWriter();
114     // Member Functions
116         //- Write single surface geometry to file.
117         virtual void write
118         (
119             const fileName& outputDir,
120             const fileName& surfaceName,
121             const pointField& points,
122             const faceList& faces,
123             const bool verbose = false
124         ) const;
127         //- Write scalarField for a single surface to file.
128         //  One value per face or vertex (isNodeValues = true)
129         virtual void write
130         (
131             const fileName& outputDir,      // <case>/surface/TIME
132             const fileName& surfaceName,    // name of surface
133             const pointField& points,
134             const faceList& faces,
135             const word& fieldName,          // name of field
136             const Field<scalar>& values,
137             const bool isNodeValues,
138             const bool verbose = false
139         ) const;
141         //- Write vectorField for a single surface to file.
142         //  One value per face or vertex (isNodeValues = true)
143         virtual void write
144         (
145             const fileName& outputDir,      // <case>/surface/TIME
146             const fileName& surfaceName,    // name of surface
147             const pointField& points,
148             const faceList& faces,
149             const word& fieldName,          // name of field
150             const Field<vector>& values,
151             const bool isNodeValues,
152             const bool verbose = false
153         ) const;
155         //- Write sphericalTensorField for a single surface to file.
156         //  One value per face or vertex (isNodeValues = true)
157         virtual void write
158         (
159             const fileName& outputDir,      // <case>/surface/TIME
160             const fileName& surfaceName,    // name of surface
161             const pointField& points,
162             const faceList& faces,
163             const word& fieldName,          // name of field
164             const Field<sphericalTensor>& values,
165             const bool isNodeValues,
166             const bool verbose = false
167         ) const;
169         //- Write symmTensorField for a single surface to file.
170         //  One value per face or vertex (isNodeValues = true)
171         virtual void write
172         (
173             const fileName& outputDir,      // <case>/surface/TIME
174             const fileName& surfaceName,    // name of surface
175             const pointField& points,
176             const faceList& faces,
177             const word& fieldName,          // name of field
178             const Field<symmTensor>& values,
179             const bool isNodeValues,
180             const bool verbose = false
181         ) const;
183         //- Write tensorField for a single surface to file.
184         //  One value per face or vertex (isNodeValues = true)
185         virtual void write
186         (
187             const fileName& outputDir,      // <case>/surface/TIME
188             const fileName& surfaceName,    // name of surface
189             const pointField& points,
190             const faceList& faces,
191             const word& fieldName,          // name of field
192             const Field<tensor>& values,
193             const bool isNodeValues,
194             const bool verbose = false
195         ) const;
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
202 } // End namespace Foam
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 #endif
208 // ************************************************************************* //