starcdSurfaceWriter.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 OpenFOAM Foundation
9 Copyright (C) 2015-2022 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::surfaceWriters::starcdWriter
29
30Description
31 A surfaceWriter for STARCD files.
32
33 The formatOptions for starcd:
34 \table
35 Property | Description | Required | Default
36 compression | Use file compression | no | false
37 scale | Output geometry scaling | no | 1
38 transform | Output coordinate transform | no |
39 fieldLevel | Subtract field level before scaling | no | empty dict
40 fieldScale | Output field scaling | no | empty dict
41 \endtable
42
43 The geometry is written via the MeshedSurfaceProxy, the fields
44 are written in a trivial ASCII format with ID and VALUE as
45 so-called user data. These \c .usr files can be read into proSTAR
46 with these types of commands. For element data:
47 \verbatim
48 getuser FILENAME.usr cell scalar free
49 getuser FILENAME.usr cell vector free
50 \endverbatim
51 and for vertex data:
52 \verbatim
53 getuser FILENAME.usr vertex scalar free
54 getuser FILENAME.usr vertex vector free
55 \endverbatim
56
57 \section Output file locations
58
59 The \c rootdir normally corresponds to something like
60 \c postProcessing/<name>
61
62 \subsection Geometry
63 \verbatim
64 rootdir
65 `-- timeName
66 `-- surfaceName.{cel,vrt,inp}
67 \endverbatim
68
69 \subsection Fields
70 \verbatim
71 rootdir
72 `-- timeName
73 |-- <field0>_surfaceName.{usr}
74 `-- <field1>_surfaceName.{usr}
75 \endverbatim
76
77SourceFiles
78 starcdSurfaceWriter.C
79
80\*---------------------------------------------------------------------------*/
81
82#ifndef Foam_surfaceWriters_starcdWriter_H
83#define Foam_surfaceWriters_starcdWriter_H
84
85#include "surfaceWriter.H"
86
87// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
88
89namespace Foam
90{
91namespace surfaceWriters
92{
93
94/*---------------------------------------------------------------------------*\
95 Class starcdWriter Declaration
96\*---------------------------------------------------------------------------*/
97
98class starcdWriter
99:
100 public surfaceWriter
101{
102 // Private Data
103
104 //- Output stream option
105 IOstreamOption streamOpt_;
106
107
108 // Private Member Functions
109
110 //- Templated write operation
111 template<class Type>
112 fileName writeTemplate
113 (
114 const word& fieldName,
115 const Field<Type>& localValues
116 );
117
118
119public:
120
121 //- Declare type-name, virtual type (without debug switch)
122 TypeNameNoDebug("starcd");
123
124
125 // Constructors
126
127 //- Default construct
128 starcdWriter();
129
130 //- Construct with some output options
131 explicit starcdWriter(const dictionary& options);
132
133 //- Construct from components
135 (
136 const meshedSurf& surf,
137 const fileName& outputPath,
138 bool parallel = Pstream::parRun(),
139 const dictionary& options = dictionary()
140 );
141
142 //- Construct from components
144 (
145 const pointField& points,
146 const faceList& faces,
147 const fileName& outputPath,
148 bool parallel = Pstream::parRun(),
149 const dictionary& options = dictionary()
150 );
152
153 //- Destructor
154 virtual ~starcdWriter() = default;
155
156
157 // Member Functions
158
159 //- True if the surface format supports geometry in a separate file.
160 // False if geometry and field must be in a single file
161 virtual bool separateGeometry() const
162 {
163 return true;
164 }
165
166 //- Format uses faceIds as part of its output
167 virtual bool usesFaceIds() const // override
168 {
169 return true;
170 }
171
172 //- Write surface geometry to file.
173 virtual fileName write(); // override
174
181};
182
184// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185
186} // End namespace surfaceWriters
187} // End namespace Foam
188
189// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191#endif
192
193// ************************************************************************* //
Generic templated field type.
Definition: Field.H:82
The IOstreamOption is a simple container for options an IOstream can normally have.
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
A class for handling file names.
Definition: fileName.H:76
Abstract definition of a meshed surface defined by faces and points.
Definition: meshedSurf.H:50
Base class for surface writers.
A surfaceWriter for STARCD files.
virtual ~starcdWriter()=default
Destructor.
declareSurfaceWriterWriteMethod(sphericalTensor)
virtual bool usesFaceIds() const
Format uses faceIds as part of its output.
virtual bool separateGeometry() const
True if the surface format supports geometry in a separate file.
TypeNameNoDebug("starcd")
Declare type-name, virtual type (without debug switch)
virtual fileName write()
Write surface geometry to file.
A class for handling words, derived from Foam::string.
Definition: word.H:68
const pointField & points
Namespace for OpenFOAM.
#define declareSurfaceWriterWriteMethod(Type)
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68