foamSurfaceWriter.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 | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2015-2019 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::surfaceWriters::foamWriter
29 
30 Description
31  A surfaceWriter for OpenFOAM surfaces
32 
33  \heading Output file locations
34 
35  The \c rootdir normally corresponds to something like
36  \c postProcessing/<name>
37 
38  \subheading Geometry
39  \verbatim
40  rootdir
41  `-- timeName
42  `-- surfaceName
43  |-- "points"
44  |-- "faceCentres"
45  `-- "faces"
46  \endverbatim
47 
48  \subheading Fields
49  \verbatim
50  rootdir
51  `-- timeName
52  `-- surfaceName
53  |-- scalarField
54  | |-- field
55  | `-- field
56  |-- vectorField
57  |-- field
58  `-- field
59  \endverbatim
60 
61 SourceFiles
62  foamSurfaceWriter.C
63 
64 \*---------------------------------------------------------------------------*/
65 
66 #ifndef foamSurfaceWriter_H
67 #define foamSurfaceWriter_H
68 
69 #include "surfaceWriter.H"
70 
71 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
72 
73 namespace Foam
74 {
75 namespace surfaceWriters
76 {
77 
78 /*---------------------------------------------------------------------------*\
79  Class foamWriter Declaration
80 \*---------------------------------------------------------------------------*/
81 
82 class foamWriter
83 :
84  public surfaceWriter
85 {
86  // Private Member Functions
87 
88  //- Templated write operation
89  template<class Type>
90  fileName writeTemplate
91  (
92  const word& fieldName,
93  const Field<Type>& localValues
94  );
95 
96 
97 public:
98 
99  //- Runtime type information
100  TypeNameNoDebug("foam");
101 
102 
103  // Constructors
104 
105  //- Construct null
106  foamWriter();
107 
108  //- Construct with some output options
109  explicit foamWriter(const dictionary& options);
110 
111  //- Construct from components
112  foamWriter
113  (
114  const meshedSurf& surf,
115  const fileName& outputPath,
116  bool parallel = Pstream::parRun(),
117  const dictionary& options = dictionary()
118  );
119 
120  //- Construct from components
121  foamWriter
122  (
123  const pointField& points,
124  const faceList& faces,
125  const fileName& outputPath,
126  bool parallel = Pstream::parRun(),
127  const dictionary& options = dictionary()
128  );
129 
130 
131  //- Destructor
132  virtual ~foamWriter() = default;
133 
134 
135  // Member Functions
136 
137  //- The surface format has geometry in a separate file.
138  virtual bool separateGeometry() const
139  {
140  return true;
141  }
142 
143  //- Write surface geometry to file.
144  virtual fileName write(); // override
145 
152 };
153 
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 } // End namespace surfaceWriters
158 } // End namespace Foam
159 
160 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
161 
162 #endif
163 
164 // ************************************************************************* //
Foam::surfaceWriters::foamWriter::separateGeometry
virtual bool separateGeometry() const
The surface format has geometry in a separate file.
Definition: foamSurfaceWriter.H:137
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::surfaceWriters::foamWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: foamSurfaceWriter.C:95
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::surfaceWriter
Base class for surface writers.
Definition: surfaceWriter.H:111
Foam::fileName
A class for handling file names.
Definition: fileName.H:69
Foam::UPstream::parRun
static bool & parRun()
Is this a parallel run?
Definition: UPstream.H:414
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
Foam::surfaceWriters::foamWriter::TypeNameNoDebug
TypeNameNoDebug("foam")
Runtime type information.
surfaceWriter.H
Foam::surfaceWriters::foamWriter
A surfaceWriter for OpenFOAM surfaces.
Definition: foamSurfaceWriter.H:81
Foam::surfaceWriters::foamWriter::foamWriter
foamWriter()
Construct null.
Definition: foamSurfaceWriter.C:49
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::surfaceWriters::foamWriter::declareSurfaceWriterWriteMethod
declareSurfaceWriterWriteMethod(label)
Foam::Vector< scalar >
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::surfaceWriters::foamWriter::~foamWriter
virtual ~foamWriter()=default
Destructor.