Loading...
Searching...
No Matches
ensightCoordSetWriter.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) 2021-2023 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::coordSetWriters::ensightCoordSetWriter
29
30Description
31 A coordSetWriter for Ensight format.
32
33 \verbatim
34 formatOptions
35 {
36 ensight
37 {
38 format ascii;
39 collateTimes true;
40 }
41 }
42 \endverbatim
43
44 Format options:
45 \table
46 Property | Description | Required | Default
47 format | ascii/binary | no | binary
48 collateTimes | use common geometry for times | no | true
49 timeFormat | Time format (ensight case) | no | scientific
50 timePrecision | Time precision (ensight case) | no | 5
51 \endtable
52 \endtable
53
54SourceFiles
55 ensightCoordSetWriter.C
56
57\*---------------------------------------------------------------------------*/
58
59#ifndef Foam_coordSetWriters_ensightWriter_H
60#define Foam_coordSetWriters_ensightWriter_H
61
62#include "coordSetWriter.H"
63#include "ensightCase.H"
65
66// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
67
68namespace Foam
69{
70
71// Forward Declarations
72class ensightGeoFile;
73
74namespace coordSetWriters
75{
76
77/*---------------------------------------------------------------------------*\
78 Class ensightWriter Declaration
79\*---------------------------------------------------------------------------*/
80
81class ensightWriter
82:
83 public coordSetWriter
84{
85 // Data Types
86
87 //- Types of element output
88 enum elemOutputType
89 {
90 NO_ELEMENTS = 0,
91 WRITE_POINTS = 1,
92 WRITE_LINES = 2
93 };
94
95
96 // Private Data
97
98 //- Ensight case options
99 ensightCase::options caseOpts_;
101 //- Collate times (default: true)
102 bool collateTimes_;
103
104 //- Cached information for times, geometry, fields (collated)
106
107
108 // Private Member Functions
109
110 //- Write geometry
111 void writeGeometry
112 (
114 elemOutputType elemOutput
115 ) const;
116
117 //- Write geometry
118 fileName writeCollated(const bool writeTracks);
119
120 //- Write geometry
121 fileName writeUncollated(const bool writeTracks);
122
123 //- Templated write operation - one file per timestep
124 template<class Type>
125 fileName writeCollated
126 (
127 const word& fieldName,
128 const UPtrList<const Field<Type>>& fieldPtrs,
129 elemOutputType elemOutput
130 );
131
132 //- Templated write operation - all time steps in single file
133 template<class Type>
134 fileName writeUncollated
135 (
136 const word& fieldName,
137 const UPtrList<const Field<Type>>& fieldPtrs,
138 elemOutputType elemOutput
139 );
140
141 //- Templated write operation
142 template<class Type>
143 fileName writeTemplate
144 (
145 const word& fieldName,
146 const Field<Type>& values
147 );
148
149 //- Templated write operation
150 template<class Type>
151 fileName writeTemplate
152 (
153 const word& fieldName,
154 const List<Field<Type>>& fieldValues
155 );
156
157
158public:
159
160 //- Runtime type information (no debug)
161 TypeNameNoDebug("ensight");
162
163
164 // Constructors
165
166 //- Default construct
168
169 //- Default construct with specified options
170 explicit ensightWriter(const dictionary& options);
171
172 //- Construct from components
174 (
175 const coordSet& coords,
176 const fileName& outputPath,
177 const dictionary& options = dictionary()
178 );
179
180 //- Construct from components
182 (
183 const UPtrList<coordSet>& tracks,
184 const fileName& outputPath,
185 const dictionary& options = dictionary()
186 );
187
188
189 //- Destructor. Calls close()
190 virtual ~ensightWriter();
191
192
193 // Member Functions
194
195 //- Finish output, clears output times.
196 // Later reuse will rebuild times from fieldsDict file cache.
197 virtual void close(bool force = false); // override
198
199
200 // Write
201
202 //- Expected (characteristic) output file name - information only
203 // \warning incorrect for uncollated output!
204 virtual fileName path() const; // override
205
212};
213
214
215// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
216
217} // End namespace coordSetWriters
218} // End namespace Foam
219
220// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
221
222#endif
223
224// ************************************************************************* //
writer writeGeometry()
Generic templated field type that is much like a Foam::List except that it is expected to hold numeri...
Definition Field.H:172
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition List.H:72
A list of pointers to objects of type <T>, without allocation/deallocation management of the pointers...
Definition UPtrList.H:101
coordSetWriter(const coordSetWriter &)=delete
No copy construct.
virtual ~ensightWriter()
Destructor. Calls close().
declareCoordSetWriterWriteMethod(sphericalTensor)
virtual fileName path() const
Expected (characteristic) output file name - information only.
virtual void close(bool force=false)
Finish output, clears output times.
TypeNameNoDebug("ensight")
Runtime type information (no debug).
Holds list of sampling positions.
Definition coordSet.H:52
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition dictionary.H:133
Configuration options for the ensightCase.
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information.
State information for writers with collated times.
A class for handling file names.
Definition fileName.H:75
A class for handling words, derived from Foam::string.
Definition word.H:66
#define declareCoordSetWriterWriteMethod(Type)
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
Tensor< scalar > tensor
Definition symmTensor.H:57
Vector< scalar > vector
Definition vector.H:57
SphericalTensor< scalar > sphericalTensor
SphericalTensor of scalars, i.e. SphericalTensor<scalar>.
SymmTensor< scalar > symmTensor
SymmTensor of scalars, i.e. SymmTensor<scalar>.
Definition symmTensor.H:55
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition typeInfo.H:61