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 OpenCFD Ltd.
9 -------------------------------------------------------------------------------
10 License
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 
26 Class
27  Foam::surfaceWriters::x3dWriter
28 
29 Description
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  \endtable
38 
39  \heading Output file locations
40 
41  The \c rootdir normally corresponds to something like
42  \c postProcessing/<name>
43 
44  \subheading Geometry
45  \verbatim
46  rootdir
47  `-- timeName
48  `-- surfaceName.x3d
49  \endverbatim
50 
51  \subheading Fields
52  \verbatim
53  rootdir
54  `-- timeName
55  |-- <field0>_surfaceName.x3d
56  `-- <field1>_surfaceName.x3d
57  \endverbatim
58 
59 SourceFiles
60  x3dSurfaceWriter.C
61 
62 \*---------------------------------------------------------------------------*/
63 
64 #ifndef x3dSurfaceWriter_H
65 #define x3dSurfaceWriter_H
66 
67 #include "surfaceWriter.H"
68 #include "X3DsurfaceFormatCore.H"
69 #include "colourTable.H"
70 #include "MinMax.H"
71 
72 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
73 
74 namespace Foam
75 {
76 namespace surfaceWriters
77 {
78 
79 /*---------------------------------------------------------------------------*\
80  Class x3dWriter Declaration
81 \*---------------------------------------------------------------------------*/
82 
83 class x3dWriter
84 :
85  public surfaceWriter,
86  protected fileFormats::X3DsurfaceFormatCore
87 {
88  // Private Data
89 
90  //- Range of values
91  // The lower/upper limits for the colour table output
92  // Undefined means calculate from the data
93  scalarMinMax range_;
94 
95  //- Selected colour table
96  const colourTable* colourTablePtr_;
97 
98 
99  // Private Member Functions
100 
101  //- Templated write operation
102  template<class Type>
103  fileName writeTemplate
104  (
105  const word& fieldName,
106  const Field<Type>& localValues
107  );
108 
109 
110 public:
111 
112  //- Runtime type information
113  TypeNameNoDebug("x3d");
114 
115 
116  // Constructors
117 
118  //- Construct null
119  x3dWriter();
120 
121  //- Construct with some output options
122  explicit x3dWriter(const dictionary& options);
123 
124  //- Construct from components
125  x3dWriter
126  (
127  const meshedSurf& surf,
128  const fileName& outputPath,
129  bool parallel = Pstream::parRun(),
130  const dictionary& options = dictionary()
131  );
132 
133  //- Construct from components
134  x3dWriter
135  (
136  const pointField& points,
137  const faceList& faces,
138  const fileName& outputPath,
139  bool parallel = Pstream::parRun(),
140  const dictionary& options = dictionary()
141  );
142 
143 
144  //- Destructor
145  virtual ~x3dWriter() = default;
146 
147 
148  // Member Functions
149 
150  //- Write surface geometry to file.
151  virtual fileName write(); // override
152 
159 };
160 
161 
162 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
163 
164 } // End namespace surfaceWriters
165 } // End namespace Foam
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 #endif
170 
171 // ************************************************************************* //
Foam::Tensor< scalar >
Foam::surfaceWriters::x3dWriter
A surfaceWriter for X3D files.
Definition: x3dSurfaceWriter.H:97
Foam::SymmTensor< scalar >
Foam::fileFormats::X3DsurfaceFormatCore
Internal class used by the X3DsurfaceFormat.
Definition: X3DsurfaceFormatCore.H:52
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
MinMax.H
surfaceWriter.H
Foam::surfaceWriters::x3dWriter::~x3dWriter
virtual ~x3dWriter()=default
Destructor.
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::surfaceWriters::x3dWriter::x3dWriter
x3dWriter()
Construct null.
Definition: x3dSurfaceWriter.C:91
colourTable.H
Foam::scalarMinMax
MinMax< scalar > scalarMinMax
A scalar min/max range.
Definition: MinMax.H:117
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
X3DsurfaceFormatCore.H
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::SphericalTensor< scalar >
Foam::surfaceWriters::x3dWriter::TypeNameNoDebug
TypeNameNoDebug("x3d")
Runtime type information.
Foam::surfaceWriters::x3dWriter::write
virtual fileName write()
Write surface geometry to file.
Definition: x3dSurfaceWriter.C:177
Foam::Vector< scalar >
Foam::List< face >
points
const pointField & points
Definition: gmvOutputHeader.H:1
Foam::colourTable
Base class for generating a colour table from node points.
Definition: colourTable.H:79
Foam::surfaceWriters::x3dWriter::declareSurfaceWriterWriteMethod
declareSurfaceWriterWriteMethod(label)
Foam::MinMax< scalar >