Initial commit for version 2.0.x patch release
[OpenFOAM-2.0.x.git] / src / sampling / sampledSurface / writers / vtk / vtkSurfaceWriter.H
blob75af4a347e90af2af09f5c213fbe1d8d6c0bfa67
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::vtkSurfaceWriter
27 Description
28     A surfaceWriter for VTK legacy format.
30 SourceFiles
31     vtkSurfaceWriter.C
33 \*---------------------------------------------------------------------------*/
35 #ifndef vtkSurfaceWriter_H
36 #define vtkSurfaceWriter_H
38 #include "surfaceWriter.H"
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 namespace Foam
45 /*---------------------------------------------------------------------------*\
46                       Class vtkSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
49 class vtkSurfaceWriter
51     public surfaceWriter
53     // Private Member Functions
55         static void writeGeometry(Ostream&, const pointField&, const faceList&);
57         template<class Type>
58         static void writeData(Ostream&, const Field<Type>&);
61         //- Templated write operation
62         template<class Type>
63         void writeTemplate
64         (
65             const fileName& outputDir,
66             const fileName& surfaceName,
67             const pointField& points,
68             const faceList& faces,
69             const word& fieldName,
70             const Field<Type>& values,
71             const bool isNodeValues,
72             const bool verbose
73         ) const;
75 public:
77     //- Runtime type information
78     TypeName("vtk");
81     // Constructors
83         //- Construct null
84         vtkSurfaceWriter();
87     //- Destructor
88     virtual ~vtkSurfaceWriter();
91     // Member Functions
93         //- Write single surface geometry to file.
94         virtual void write
95         (
96             const fileName& outputDir,
97             const fileName& surfaceName,
98             const pointField& points,
99             const faceList& faces,
100             const bool verbose = false
101         ) const;
104         //- Write scalarField for a single surface to file.
105         //  One value per face or vertex (isNodeValues = true)
106         virtual void write
107         (
108             const fileName& outputDir,      // <case>/surface/TIME
109             const fileName& surfaceName,    // name of surface
110             const pointField& points,
111             const faceList& faces,
112             const word& fieldName,          // name of field
113             const Field<scalar>& values,
114             const bool isNodeValues,
115             const bool verbose = false
116         ) const;
118         //- Write vectorField for a single surface to file.
119         //  One value per face or vertex (isNodeValues = true)
120         virtual void write
121         (
122             const fileName& outputDir,      // <case>/surface/TIME
123             const fileName& surfaceName,    // name of surface
124             const pointField& points,
125             const faceList& faces,
126             const word& fieldName,          // name of field
127             const Field<vector>& values,
128             const bool isNodeValues,
129             const bool verbose = false
130         ) const;
132         //- Write sphericalTensorField for a single surface to file.
133         //  One value per face or vertex (isNodeValues = true)
134         virtual void write
135         (
136             const fileName& outputDir,      // <case>/surface/TIME
137             const fileName& surfaceName,    // name of surface
138             const pointField& points,
139             const faceList& faces,
140             const word& fieldName,          // name of field
141             const Field<sphericalTensor>& values,
142             const bool isNodeValues,
143             const bool verbose = false
144         ) const;
146         //- Write symmTensorField for a single surface to file.
147         //  One value per face or vertex (isNodeValues = true)
148         virtual void write
149         (
150             const fileName& outputDir,      // <case>/surface/TIME
151             const fileName& surfaceName,    // name of surface
152             const pointField& points,
153             const faceList& faces,
154             const word& fieldName,          // name of field
155             const Field<symmTensor>& values,
156             const bool isNodeValues,
157             const bool verbose = false
158         ) const;
160         //- Write tensorField for a single surface to file.
161         //  One value per face or vertex (isNodeValues = true)
162         virtual void write
163         (
164             const fileName& outputDir,      // <case>/surface/TIME
165             const fileName& surfaceName,    // name of surface
166             const pointField& points,
167             const faceList& faces,
168             const word& fieldName,          // name of field
169             const Field<tensor>& values,
170             const bool isNodeValues,
171             const bool verbose = false
172         ) const;
177 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179 } // End namespace Foam
181 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
183 #endif
185 // ************************************************************************* //