ensightFaMesh.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) 2021-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::ensightFaMesh
28
29Description
30 Encapsulation of area meshes for writing in ensight format.
31
32Note
33 Currently restricted to a single faMesh representation.
34 The face elements are created from a specified subset of polyMesh
35 faces. The original ordering of these faces is retained in the
36 ensightFaces faceOrder().
37
38SourceFiles
39 ensightFaMesh.C
40 ensightFaMeshI.H
41
42\*---------------------------------------------------------------------------*/
43
44#ifndef Foam_fa_ensightMesh_H
45#define Foam_fa_ensightMesh_H
46
47#include "ensightFaces.H"
48
49// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
50
51namespace Foam
52{
53
54// Forward Declarations
55class faMesh;
56class ensightGeoFile;
57class ensightFaMesh;
58
59/*---------------------------------------------------------------------------*\
60 Class ensightMesh Declaration
61\*---------------------------------------------------------------------------*/
63class ensightFaMesh
64{
65 // Private Data
66
67 //- Reference to the finite-area mesh
68 const faMesh& mesh_;
69
70 //- Face elements for the area mesh (currently only one)
71 ensightFaces areaPart_;
72
73 //- Track if it needs an update
74 mutable bool needsUpdate_;
75
76 //- Output verbosity level
77 int verbose_;
78
79
80 // Private Member Functions
81
82 //- Clear all storage
83 void clear();
84
85 //- Enforce consistent index/part numbering
86 void renumber();
87
88 //- No copy construct
89 ensightFaMesh(const ensightFaMesh&) = delete;
90
91 //- No copy assignment
92 void operator=(const ensightFaMesh&) = delete;
93
94
95public:
96
97 // Constructors
98
99 //- Construct from mesh with all default options
100 explicit ensightFaMesh(const faMesh& mesh);
101
102
103 // Member Functions
104
105 //- Output verbosity level
106 int verbose() const noexcept;
107
108 //- Change the output verbosity level.
109 // \return old level
110 int verbose(const int level) noexcept;
111
112
113 // Access
114
115 //- Reference to the underlying faMesh
116 const faMesh& mesh() const noexcept
117 {
118 return mesh_;
119 }
120
121 //- Face elements for finite-area
122 const ensightFaces& areaPart() const noexcept
123 {
124 return areaPart_;
125 }
126
127
128 // Other
129
130 //- Does the content need an update?
131 bool needsUpdate() const noexcept
132 {
133 return needsUpdate_;
134 }
135
136 //- Mark as needing an update.
137 // May also free up unneeded data.
138 // Return false if already marked as expired.
139 inline bool expire();
140
141 //- Update for new mesh
142 void correct();
143
144
145 // Output
146
147 //- Write geometry to file. Normally in parallel
148 void write
149 (
151 bool parallel = Pstream::parRun()
152 ) const;
153
154 //- Write geometry to file. Normally in parallel
155 inline void write
156 (
158 bool parallel = Pstream::parRun()
159 ) const;
160};
161
162
163// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
164
165} // End namespace Foam
166
167// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168
169#include "ensightFaMeshI.H"
170
171#endif
172
173// ************************************************************************* //
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
Encapsulation of area meshes for writing in ensight format.
Definition: ensightFaMesh.H:63
const ensightFaces & areaPart() const noexcept
Face elements for finite-area.
bool needsUpdate() const noexcept
Does the content need an update?
const faMesh & mesh() const noexcept
Reference to the underlying faMesh.
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:83
int verbose() const noexcept
Output verbosity level.
Definition: ensightFaMesh.C:69
bool expire()
Mark as needing an update.
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:75
Specialized Ensight output with extra geometry file header.
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:100
patchWriters clear()
OBJstream os(runTime.globalPath()/outputName)
Namespace for OpenFOAM.
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
const direction noexcept
Definition: Scalar.H:223
runTime write()