x3dSurfaceWriter.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) 2019-2022 OpenCFD Ltd.
9-------------------------------------------------------------------------------
10License
11 This file is part of OpenFOAM.
12
13 OpenFOAM is free software: you can redistribute it and/or modify it
14 under the terms of the GNU General Public License as published by
15 the Free Software Foundation, either version 3 of the License, or
16 (at your option) any later version.
17
18 OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 for more details.
22
23 You should have received a copy of the GNU General Public License
24 along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25
26Class
27 Foam::surfaceWriters::x3dWriter
28
29Description
30 A surfaceWriter for X3D files.
31
32 The formatOptions for x3d:
33 \table
34 Property | Description | Required | Default
35 range | The min/max range for colour table | no | automatic
36 colourMap | The colour map for rendering | no | coolToWarm
37 compression | Use file compression | no | false
38 scale | Output geometry scaling | no | 1
39 transform | Output coordinate transform | no |
40 fieldLevel | Subtract field level before scaling | no | empty dict
41 fieldScale | Output field scaling | no | empty dict
42 \endtable
43
44 \section Output file locations
45
46 The \c rootdir normally corresponds to something like
47 \c postProcessing/<name>
48
49 \subsection Geometry
50 \verbatim
51 rootdir
52 `-- timeName
53 `-- surfaceName.x3d
54 \endverbatim
55
56 \subsection Fields
57 \verbatim
58 rootdir
59 `-- timeName
60 |-- <field0>_surfaceName.x3d
61 `-- <field1>_surfaceName.x3d
62 \endverbatim
63
64Note
65 The range is applied after any field scaling.
66
67SourceFiles
68 x3dSurfaceWriter.C
69
70\*---------------------------------------------------------------------------*/
71
72#ifndef Foam_surfaceWriters_x3dWriter_H
73#define Foam_surfaceWriters_x3dWriter_H
74
75#include "surfaceWriter.H"
77#include "colourTable.H"
78#include "MinMax.H"
79
80// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
81
82namespace Foam
83{
84namespace surfaceWriters
85{
86
87/*---------------------------------------------------------------------------*\
88 Class x3dWriter Declaration
89\*---------------------------------------------------------------------------*/
90
91class x3dWriter
92:
93 public surfaceWriter,
94 protected fileFormats::X3DsurfaceFormatCore
95{
96 // Private Data
97
98 //- Output stream option
99 IOstreamOption streamOpt_;
100
101 //- Range of values
102 // The lower/upper limits for the colour table output
103 // Undefined means calculate from the data
104 scalarMinMax range_;
105
106 //- Selected colour table
107 const colourTable* colourTablePtr_;
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
121public:
122
123 //- Declare type-name, virtual type (without debug switch)
124 TypeNameNoDebug("x3d");
125
126
127 // Constructors
128
129 //- Default construct
131
132 //- Construct with some output options
133 explicit x3dWriter(const dictionary& options);
134
135 //- Construct from components
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
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 ~x3dWriter() = default;
157
158
159 // Member Functions
160
161 //- Write surface geometry to file.
162 virtual fileName write(); // override
170};
171
172
173// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174
175} // End namespace surfaceWriters
176} // End namespace Foam
177
178// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
179
180#endif
181
182// ************************************************************************* //
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
Base class for generating a colour table from node points.
Definition: colourTable.H:80
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Internal class used by the X3DsurfaceFormat.
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 X3D files.
virtual ~x3dWriter()=default
Destructor.
TypeNameNoDebug("x3d")
Declare type-name, virtual type (without debug switch)
declareSurfaceWriterWriteMethod(symmTensor)
declareSurfaceWriterWriteMethod(sphericalTensor)
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.
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition: MinMax.H:117
#define declareSurfaceWriterWriteMethod(Type)
#define TypeNameNoDebug(TypeNameString)
Declare a ClassNameNoDebug() with extra virtual type info.
Definition: typeInfo.H:68