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 | Copyright (C) 2015 OpenCFD Ltd.
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() const
114  {
115  return false;
116  }
117 
118  //- Write single surface geometry to file.
119  virtual fileName 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  return fileName::null;
129  }
130 
131  //- Write scalarField for a single surface to file.
132  // One value per face or vertex (isNodeValues = true)
133  virtual fileName write
134  (
135  const fileName& outputDir, // <case>/surface/TIME
136  const fileName& surfaceName, // name of surface
137  const pointField& points,
138  const faceList& faces,
139  const word& fieldName, // name of field
140  const Field<scalar>& values,
141  const bool isNodeValues,
142  const bool verbose = false
143  ) const
144  {
145  return fileName::null;
146  }
147 
148  //- Write vectorField for a single surface to file.
149  // One value per face or vertex (isNodeValues = true)
150  virtual fileName 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<vector>& values,
158  const bool isNodeValues,
159  const bool verbose = false
160  ) const
161  {
162  return fileName::null;
163  }
164 
165  //- Write sphericalTensorField for a single surface to file.
166  // One value per face or vertex (isNodeValues = true)
167  virtual fileName write
168  (
169  const fileName& outputDir, // <case>/surface/TIME
170  const fileName& surfaceName, // name of surface
171  const pointField& points,
172  const faceList& faces,
173  const word& fieldName, // name of field
174  const Field<sphericalTensor>& values,
175  const bool isNodeValues,
176  const bool verbose = false
177  ) const
178  {
179  return fileName::null;
180  }
181 
182  //- Write symmTensorField for a single surface to file.
183  // One value per face or vertex (isNodeValues = true)
184  virtual fileName write
185  (
186  const fileName& outputDir, // <case>/surface/TIME
187  const fileName& surfaceName, // name of surface
188  const pointField& points,
189  const faceList& faces,
190  const word& fieldName, // name of field
191  const Field<symmTensor>& values,
192  const bool isNodeValues,
193  const bool verbose = false
194  ) const
195  {
196  return fileName::null;
197  }
198 
199  //- Write tensorField for a single surface to file.
200  // One value per face or vertex (isNodeValues = true)
201  virtual fileName write
202  (
203  const fileName& outputDir, // <case>/surface/TIME
204  const fileName& surfaceName, // name of surface
205  const pointField& points,
206  const faceList& faces,
207  const word& fieldName, // name of field
208  const Field<tensor>& values,
209  const bool isNodeValues,
210  const bool verbose = false
211  ) const
212  {
213  return fileName::null;
214  }
215 };
216 
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 } // End namespace Foam
221 
222 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
223 
224 #endif
225 
226 // ************************************************************************* //
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:54
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::surfaceWriter::TypeName
TypeName("surfaceWriter")
Runtime type information.
typeInfo.H
faceList.H
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
fileName.H
Foam::surfaceWriter::surfaceWriter
surfaceWriter()
Construct null.
Definition: surfaceWriter.C:104
Foam::surfaceWriter::write
virtual fileName write(const fileName &outputDir, const fileName &surfaceName, const pointField &points, const faceList &faces, const bool verbose=false) const
Write single surface geometry to file.
Definition: surfaceWriter.H:119
Foam::dictionary
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:137
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::fileName::null
static const fileName null
An empty fileName.
Definition: fileName.H:97
Foam::surfaceWriter::separateGeometry
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
Definition: surfaceWriter.H:112
pointField.H
Foam::surfaceWriter::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, surfaceWriter, word,(),())
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
Foam::surfaceWriter::New
static autoPtr< surfaceWriter > New(const word &writeType)
Return a reference to the selected surfaceWriter.
Definition: surfaceWriter.C:55
Foam::List
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: HashTable.H:59
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::surfaceWriter::~surfaceWriter
virtual ~surfaceWriter()
Destructor.
Definition: surfaceWriter.C:110
autoPtr.H