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 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 fa_ensightMesh_H
45 #define 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 
77  // Private Member Functions
78 
79  //- Clear all storage
80  void clear();
81 
82  //- Enforce consistent index/part numbering
83  void renumber();
84 
85  //- No copy construct
86  ensightFaMesh(const ensightFaMesh&) = delete;
87 
88  //- No copy assignment
89  void operator=(const ensightFaMesh&) = delete;
90 
91 
92 public:
93 
94  // Constructors
95 
96  //- Construct from mesh with all default options
97  explicit ensightFaMesh(const faMesh& mesh);
98 
99 
100  // Member Functions
101 
102  // Access
103 
104  //- Reference to the underlying faMesh
105  const faMesh& mesh() const noexcept
106  {
107  return mesh_;
108  }
109 
110  //- Face elements for finite-area
111  const ensightFaces& areaPart() const noexcept
112  {
113  return areaPart_;
114  }
115 
116 
117  // Other
118 
119  //- Does the content need an update?
120  bool needsUpdate() const noexcept
121  {
122  return needsUpdate_;
123  }
124 
125  //- Mark as needing an update.
126  // May also free up unneeded data.
127  // Return false if already marked as expired.
128  inline bool expire();
129 
130  //- Update for new mesh
131  void correct();
132 
133 
134  // Output
135 
136  //- Write geometry to file. Normally in parallel
137  void write
138  (
140  bool parallel = Pstream::parRun()
141  ) const;
142 
143  //- Write geometry to file. Normally in parallel
144  inline void write
145  (
147  bool parallel = Pstream::parRun()
148  ) const;
149 };
150 
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 } // End namespace Foam
155 
156 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
157 
158 #include "ensightFaMeshI.H"
159 
160 #endif
161 
162 // ************************************************************************* //
Foam::ensightFaMesh::expire
bool expire()
Mark as needing an update.
Definition: ensightFaMeshI.H:30
ensightFaces.H
Foam::ensightFaces
Sorting/classification of faces (2D) into corresponding ensight types.
Definition: ensightFaces.H:71
Foam::ensightFaMesh::needsUpdate
bool needsUpdate() const noexcept
Does the content need an update?
Definition: ensightFaMesh.H:119
Foam::ensightGeoFile
Specialized Ensight output with extra geometry file header.
Definition: ensightGeoFile.H:48
Foam::ensightFaMesh
Encapsulation of area meshes for writing in ensight format.
Definition: ensightFaMesh.H:62
Foam::ensightFaMesh::correct
void correct()
Update for new mesh.
Definition: ensightFaMesh.C:68
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::ensightFaMesh::mesh
const faMesh & mesh() const noexcept
Reference to the underlying faMesh.
Definition: ensightFaMesh.H:104
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::renumber
IntListType renumber(const labelUList &oldToNew, const IntListType &input)
Renumber the values (not the indices) of a list.
Definition: ListOpsTemplates.C:37
clear
patchWriters clear()
Foam::UPstream::parRun
static bool & parRun() noexcept
Test if this a parallel run.
Definition: UPstream.H:433
ensightFaMeshI.H
Foam::faMesh
Finite area mesh. Used for 2-D non-Euclidian finite area method.
Definition: faMesh.H:82
Foam::ensightFaMesh::write
void write(ensightGeoFile &os, bool parallel=Pstream::parRun()) const
Write geometry to file. Normally in parallel.
Definition: ensightFaMesh.C:103
Foam::ensightFaMesh::areaPart
const ensightFaces & areaPart() const noexcept
Face elements for finite-area.
Definition: ensightFaMesh.H:110