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-2024 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::ensightFaMesh
28 
29 Description
30  Encapsulation of area meshes for writing in ensight format.
31 
32 Note
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 
38 SourceFiles
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 
51 namespace Foam
52 {
53 
54 // Forward Declarations
55 class faMesh;
56 class ensightGeoFile;
57 class ensightFaMesh;
58 
59 /*---------------------------------------------------------------------------*\
60  Class ensightMesh Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class 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 
89 public:
90 
91  // Generated Methods
92 
93  //- No copy construct
94  ensightFaMesh(const ensightFaMesh&) = delete;
95 
96  //- No copy assignment
97  void operator=(const ensightFaMesh&) = delete;
98 
99 
100  // Constructors
101 
102  //- Construct from mesh with all default options
103  explicit ensightFaMesh(const faMesh& mesh);
104 
105 
106  // Member Functions
107 
108  //- Output verbosity level
109  int verbose() const noexcept;
110 
111  //- Change the output verbosity level.
112  // \return old level
113  int verbose(const int level) noexcept;
114 
115 
116  // Access
117 
118  //- Reference to the underlying faMesh
119  const faMesh& mesh() const noexcept
120  {
121  return mesh_;
122  }
123 
124  //- Face elements for finite-area
125  const ensightFaces& areaPart() const noexcept
126  {
127  return areaPart_;
128  }
129 
130 
131  // Other
132 
133  //- Does the content need an update?
134  bool needsUpdate() const noexcept
135  {
136  return needsUpdate_;
137  }
138 
139  //- Mark as needing an update.
140  // May also free up unneeded data.
141  // Return false if already marked as expired.
142  inline bool expire();
143 
144  //- Update for new mesh
145  void correct();
146 
148  // Output
149 
150  //- Write geometry to file (normally in parallel).
151  //- Adds beginGeometry() marker.
152  void write
153  (
155  bool parallel = UPstream::parRun()
156  ) const;
157 
158  //- Write geometry to file (normally in parallel).
159  //- Adds beginGeometry() marker.
160  FOAM_DEPRECATED_FOR(2024-05, "write(ensightGeoFile&, ...")
161  inline void write
162  (
164  bool parallel = UPstream::parRun()
165  ) const;
166 };
167 
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 } // End namespace Foam
172 
173 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
174 
175 #include "ensightFaMeshI.H"
176 
177 #endif
178 
179 // ************************************************************************* //
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition: faMesh.H:133
void write(ensightGeoFile &os, bool parallel=UPstream::parRun()) const
Write geometry to file (normally in parallel). Adds beginGeometry() marker.
int verbose() const noexcept
Output verbosity level.
Definition: ensightFaMesh.C:62
Encapsulation of area meshes for writing in ensight format.
Definition: ensightFaMesh.H:58
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values within a list.
ensightFaMesh(const ensightFaMesh &)=delete
No copy construct.
A variant of ensightFile (Ensight writing) that includes the extra geometry file header information...
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:1061
bool needsUpdate() const noexcept
Does the content need an update?
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:66
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
Definition: NamedEnum.H:65
const faMesh & mesh() const noexcept
Reference to the underlying faMesh.
const direction noexcept
Definition: Scalar.H:258
OBJstream os(runTime.globalPath()/outputName)
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:76
surface1 clear()
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
const ensightFaces & areaPart() const noexcept
Face elements for finite-area.
bool expire()
Mark as needing an update.
Inter-processor communications stream.
Definition: UPstream.H:65
void operator=(const ensightFaMesh &)=delete
No copy assignment.
Namespace for OpenFOAM.