foamFileSurfaceWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
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.
15 
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.
20 
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/>.
23 
24 Class
25  Foam::foamFileSurfaceWriter
26 
27 Description
28  A surfaceWriter for foamFiles
29 
30 SourceFiles
31  foamFileSurfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef foamFileSurfaceWriter_H
36 #define foamFileSurfaceWriter_H
37 
38 #include "surfaceWriter.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class foamFileSurfaceWriter Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 :
51  public surfaceWriter
52 {
53  // Private Member Functions
54 
55  //- Templated write operation
56  template<class Type>
57  void writeTemplate
58  (
59  const fileName& outputDir,
60  const fileName& surfaceName,
61  const pointField& points,
62  const faceList& faces,
63  const word& fieldName,
64  const Field<Type>& values,
65  const bool isNodeValues,
66  const bool verbose
67  ) const;
68 
69 
70 public:
71 
72  //- Runtime type information
73  TypeName("foamFile");
74 
75 
76  // Constructors
77 
78  //- Construct null
80 
81 
82  //- Destructor
83  virtual ~foamFileSurfaceWriter();
84 
85 
86  // Member Functions
87 
88  //- True if the surface format supports geometry in a separate file.
89  // False if geometry and field must be in a single file
90  virtual bool separateGeometry()
91  {
92  return true;
93  }
94 
95  //- Write single surface geometry to file.
96  virtual void write
97  (
98  const fileName& outputDir,
99  const fileName& surfaceName,
100  const pointField& points,
101  const faceList& faces,
102  const bool verbose = false
103  ) const;
104 
105 
106  //- Write scalarField for a single surface to file.
107  // One value per face or vertex (isNodeValues = true)
108  virtual void write
109  (
110  const fileName& outputDir, // <case>/surface/TIME
111  const fileName& surfaceName, // name of surface
112  const pointField& points,
113  const faceList& faces,
114  const word& fieldName, // name of field
115  const Field<scalar>& values,
116  const bool isNodeValues,
117  const bool verbose = false
118  ) const;
119 
120  //- Write vectorField for a single surface to file.
121  // One value per face or vertex (isNodeValues = true)
122  virtual void write
123  (
124  const fileName& outputDir, // <case>/surface/TIME
125  const fileName& surfaceName, // name of surface
126  const pointField& points,
127  const faceList& faces,
128  const word& fieldName, // name of field
129  const Field<vector>& values,
130  const bool isNodeValues,
131  const bool verbose = false
132  ) const;
133 
134  //- Write sphericalTensorField for a single surface to file.
135  // One value per face or vertex (isNodeValues = true)
136  virtual void write
137  (
138  const fileName& outputDir, // <case>/surface/TIME
139  const fileName& surfaceName, // name of surface
140  const pointField& points,
141  const faceList& faces,
142  const word& fieldName, // name of field
143  const Field<sphericalTensor>& values,
144  const bool isNodeValues,
145  const bool verbose = false
146  ) const;
147 
148  //- Write symmTensorField for a single surface to file.
149  // One value per face or vertex (isNodeValues = true)
150  virtual void write
151  (
152  const fileName& outputDir, // <case>/surface/TIME
153  const fileName& surfaceName, // name of surface
154  const pointField& points,
155  const faceList& faces,
156  const word& fieldName, // name of field
157  const Field<symmTensor>& values,
158  const bool isNodeValues,
159  const bool verbose = false
160  ) const;
161 
162  //- Write tensorField for a single surface to file.
163  // One value per face or vertex (isNodeValues = true)
164  virtual void write
165  (
166  const fileName& outputDir, // <case>/surface/TIME
167  const fileName& surfaceName, // name of surface
168  const pointField& points,
169  const faceList& faces,
170  const word& fieldName, // name of field
171  const Field<tensor>& values,
172  const bool isNodeValues,
173  const bool verbose = false
174  ) const;
175 
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
A class for handling file names.
Definition: fileName.H:69
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
TypeName("foamFile")
Runtime type information.
const pointField & points
A class for handling words, derived from string.
Definition: word.H:59
A surfaceWriter for foamFiles.
virtual ~foamFileSurfaceWriter()
Destructor.
Base class for surface writers.
Definition: surfaceWriter.H:54
foamFileSurfaceWriter()
Construct null.
virtual bool separateGeometry()
True if the surface format supports geometry in a separate file.
Namespace for OpenFOAM.