surfaceWriter.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-2012 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::surfaceWriter
26 
27 Description
28  Base class for surface writers
29 
30 SourceFiles
31  surfaceWriter.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef surfaceWriter_H
36 #define surfaceWriter_H
37 
38 #include "typeInfo.H"
39 #include "autoPtr.H"
40 #include "pointField.H"
41 #include "faceList.H"
42 #include "fileName.H"
43 
44 #include "runTimeSelectionTables.H"
45 
46 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 
48 namespace Foam
49 {
50 
51 /*---------------------------------------------------------------------------*\
52  Class surfaceWriter Declaration
53 \*---------------------------------------------------------------------------*/
54 
55 class surfaceWriter
56 {
57 public:
58 
59  //- Runtime type information
60  TypeName("surfaceWriter");
61 
62  // Declare run-time constructor selection table
63 
65  (
66  autoPtr,
68  word,
69  (),
70  ()
71  );
72 
74  (
75  autoPtr,
77  wordDict,
78  (
79  const dictionary& optDict
80  ),
81  (optDict)
82  );
83 
84 
85  // Selectors
86 
87  //- Return a reference to the selected surfaceWriter
88  static autoPtr<surfaceWriter> New(const word& writeType);
89 
90  //- Return a reference to the selected surfaceWriter
91  // Select with extra write option
93  (
94  const word& writeType,
95  const dictionary& writeOptions
96  );
97 
98 
99  // Constructors
100 
101  //- Construct null
102  surfaceWriter();
103 
104 
105  //- Destructor
106  virtual ~surfaceWriter();
107 
108 
109  // Member Functions
110 
111  //- True if the surface format supports geometry in a separate file.
112  // False if geometry and field must be in a single file
113  virtual bool separateGeometry()
114  {
115  return false;
116  }
117 
118  //- Write single surface geometry to file.
119  virtual void write
120  (
121  const fileName& outputDir, // <case>/surface/TIME
122  const fileName& surfaceName, // name of surface
123  const pointField& points,
124  const faceList& faces,
125  const bool verbose = false
126  ) const
127  {}
128 
129  //- Write scalarField for a single surface to file.
130  // One value per face or vertex (isNodeValues = true)
131  virtual void write
132  (
133  const fileName& outputDir, // <case>/surface/TIME
134  const fileName& surfaceName, // name of surface
135  const pointField& points,
136  const faceList& faces,
137  const word& fieldName, // name of field
138  const Field<scalar>& values,
139  const bool isNodeValues,
140  const bool verbose = false
141  ) const
142  {}
143 
144  //- Write vectorField for a single surface to file.
145  // One value per face or vertex (isNodeValues = true)
146  virtual void write
147  (
148  const fileName& outputDir, // <case>/surface/TIME
149  const fileName& surfaceName, // name of surface
150  const pointField& points,
151  const faceList& faces,
152  const word& fieldName, // name of field
153  const Field<vector>& values,
154  const bool isNodeValues,
155  const bool verbose = false
156  ) const
157  {}
158 
159  //- Write sphericalTensorField for a single surface to file.
160  // One value per face or vertex (isNodeValues = true)
161  virtual void write
162  (
163  const fileName& outputDir, // <case>/surface/TIME
164  const fileName& surfaceName, // name of surface
165  const pointField& points,
166  const faceList& faces,
167  const word& fieldName, // name of field
168  const Field<sphericalTensor>& values,
169  const bool isNodeValues,
170  const bool verbose = false
171  ) const
172  {}
173 
174  //- Write symmTensorField for a single surface to file.
175  // One value per face or vertex (isNodeValues = true)
176  virtual void write
177  (
178  const fileName& outputDir, // <case>/surface/TIME
179  const fileName& surfaceName, // name of surface
180  const pointField& points,
181  const faceList& faces,
182  const word& fieldName, // name of field
183  const Field<symmTensor>& values,
184  const bool isNodeValues,
185  const bool verbose = false
186  ) const
187  {}
188 
189  //- Write tensorField for a single surface to file.
190  // One value per face or vertex (isNodeValues = true)
191  virtual void write
192  (
193  const fileName& outputDir, // <case>/surface/TIME
194  const fileName& surfaceName, // name of surface
195  const pointField& points,
196  const faceList& faces,
197  const word& fieldName, // name of field
198  const Field<tensor>& values,
199  const bool isNodeValues,
200  const bool verbose = false
201  ) const
202  {}
203 };
204 
205 
206 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
207 
208 } // End namespace Foam
209 
210 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211 
212 #endif
213 
214 // ************************************************************************* //
virtual bool separateGeometry()
True if the surface format supports geometry in a separate file.
declareRunTimeSelectionTable(autoPtr, surfaceWriter, word,(),())
A class for handling file names.
Definition: fileName.H:69
surfaceWriter()
Construct null.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual ~surfaceWriter()
Destructor.
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.
A class for handling words, derived from string.
Definition: word.H:59
TypeName("surfaceWriter")
Runtime type information.
Base class for surface writers.
Definition: surfaceWriter.H:54
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
Definition: surfaceWriter.C:55
Namespace for OpenFOAM.