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-2020 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  \verbatim
34  formatOptions
35  {
36  foam
37  {
38  format ascii;
39  compression true;
40  }
41  }
42  \endverbatim
43 
44  Format options:
45  \table
46  Property | Description | Required | Default
47  format | ascii/binary | no | ascii
48  compression | output file compression | no | false
49  \endtable
50 
51  \heading Output file locations
52 
53  The \c rootdir normally corresponds to something like
54  \c postProcessing/<name>
55 
56  \subheading Geometry
57  \verbatim
58  rootdir
59  `-- timeName
60  `-- surfaceName
61  |-- "points"
62  |-- "faceCentres"
63  `-- "faces"
64  \endverbatim
65 
66  \subheading Fields
67  \verbatim
68  rootdir
69  `-- timeName
70  `-- surfaceName
71  |-- scalarField
72  | |-- field
73  | `-- field
74  |-- vectorField
75  |-- field
76  `-- field
77  \endverbatim
78 
79 SourceFiles
80  foamSurfaceWriter.C
81 
82 \*---------------------------------------------------------------------------*/
83 
84 #ifndef foamSurfaceWriter_H
85 #define foamSurfaceWriter_H
86 
87 #include "surfaceWriter.H"
88 
89 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
90 
91 namespace Foam
92 {
93 namespace surfaceWriters
94 {
95 
96 /*---------------------------------------------------------------------------*\
97  Class foamWriter Declaration
98 \*---------------------------------------------------------------------------*/
99 
100 class foamWriter
101 :
102  public surfaceWriter
103 {
104  // Private Data
105 
106  //- Output stream option
107  IOstreamOption streamOpt_;
108 
109 
110  // Private Member Functions
111 
112  //- Templated write operation
113  template<class Type>
114  fileName writeTemplate
115  (
116  const word& fieldName,
117  const Field<Type>& localValues
118  );
119 
120 
121 public:
122 
123  //- Declare type-name, virtual type (without debug switch)
124  TypeNameNoDebug("foam");
125 
126 
127  // Constructors
128 
129  //- Default construct
130  foamWriter();
131 
132  //- Construct with some output options
133  explicit foamWriter(const dictionary& options);
134 
135  //- Construct from components
136  foamWriter
137  (
138  const meshedSurf& surf,
139  const fileName& outputPath,
140  bool parallel = Pstream::parRun(),
141  const dictionary& options = dictionary()
142  );
143 
144  //- Construct from components
145  foamWriter
146  (
147  const pointField& points,
148  const faceList& faces,
149  const fileName& outputPath,
150  bool parallel = Pstream::parRun(),
151  const dictionary& options = dictionary()
152  );
153 
154 
155  //- Destructor
156  virtual ~foamWriter() = default;
157 
158 
159  // Member Functions
160 
161  //- The surface format has geometry in a separate file.
162  virtual bool separateGeometry() const
163  {
164  return true;
165  }
166 
167  //- Write surface geometry to file.
168  virtual fileName write(); // override
169 
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace surfaceWriters
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
Foam::surfaceWriters::foamWriter::separateGeometry
virtual bool separateGeometry() const
The surface format has geometry in a separate file.
Definition: foamSurfaceWriter.H:176
Foam::Tensor< scalar >
Foam::SymmTensor< scalar >
Foam::surfaceWriters::foamWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: foamSurfaceWriter.C:102
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:415
Foam::meshedSurf
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:49
Foam::surfaceWriters::foamWriter::TypeNameNoDebug
TypeNameNoDebug("foam")
Declare type-name, virtual type (without debug switch)
surfaceWriter.H
Foam::surfaceWriters::foamWriter
A surfaceWriter for OpenFOAM surfaces.
Definition: foamSurfaceWriter.H:114
Foam::surfaceWriters::foamWriter::foamWriter
foamWriter()
Default construct.
Definition: foamSurfaceWriter.C:50
Foam::Field
Generic templated field type.
Definition: Field.H:63
Foam::IOstreamOption
The IOstreamOption is a simple container for options an IOstream can normally have.
Definition: IOstreamOption.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.