surfaceWriter.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2019 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 = 0;
127 
128  //- Write scalarField for a single surface to file.
129  // One value per face or vertex (isNodeValues = true)
130  virtual void write
131  (
132  const fileName& outputDir, // <case>/surface/TIME
133  const fileName& surfaceName, // name of surface
134  const pointField& points,
135  const faceList& faces,
136  const word& fieldName, // name of field
137  const Field<scalar>& values,
138  const bool isNodeValues,
139  const bool verbose = false
140  ) const = 0;
141 
142  //- Write vectorField for a single surface to file.
143  // One value per face or vertex (isNodeValues = true)
144  virtual void write
145  (
146  const fileName& outputDir, // <case>/surface/TIME
147  const fileName& surfaceName, // name of surface
148  const pointField& points,
149  const faceList& faces,
150  const word& fieldName, // name of field
151  const Field<vector>& values,
152  const bool isNodeValues,
153  const bool verbose = false
154  ) const = 0;
155 
156  //- Write sphericalTensorField for a single surface to file.
157  // One value per face or vertex (isNodeValues = true)
158  virtual void write
159  (
160  const fileName& outputDir, // <case>/surface/TIME
161  const fileName& surfaceName, // name of surface
162  const pointField& points,
163  const faceList& faces,
164  const word& fieldName, // name of field
165  const Field<sphericalTensor>& values,
166  const bool isNodeValues,
167  const bool verbose = false
168  ) const = 0;
169 
170  //- Write symmTensorField for a single surface to file.
171  // One value per face or vertex (isNodeValues = true)
172  virtual void write
173  (
174  const fileName& outputDir, // <case>/surface/TIME
175  const fileName& surfaceName, // name of surface
176  const pointField& points,
177  const faceList& faces,
178  const word& fieldName, // name of field
179  const Field<symmTensor>& values,
180  const bool isNodeValues,
181  const bool verbose = false
182  ) const = 0;
183 
184  //- Write tensorField for a single surface to file.
185  // One value per face or vertex (isNodeValues = true)
186  virtual void write
187  (
188  const fileName& outputDir, // <case>/surface/TIME
189  const fileName& surfaceName, // name of surface
190  const pointField& points,
191  const faceList& faces,
192  const word& fieldName, // name of field
193  const Field<tensor>& values,
194  const bool isNodeValues,
195  const bool verbose = false
196  ) const = 0;
197 };
198 
199 
200 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
201 
202 } // End namespace Foam
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 #endif
207 
208 // ************************************************************************* //
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:79
surfaceWriter()
Construct null.
Definition: surfaceWriter.C:93
virtual void write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const =0
Write single surface geometry to file.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:158
virtual ~surfaceWriter()
Destructor.
Definition: surfaceWriter.C:99
const pointField & points
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:44
Namespace for OpenFOAM.