Loading...
Searching...
No Matches
faMeshesRegistry.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) 2023-2025 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::faMeshesRegistry
28
29Description
30 A MeshObject registry on top of a polyMesh that provides
31 an objectRegistry for holding multiple faMesh objects.
32
33 Directory structure for fields/meshes (default region):
34 \verbatim
35 .
36 |-- constant
37 | `-- finite-area
38 | `-- faMesh
39 | |-- faceLabels
40 | |-- ...
41 | `-- faBoundary
42 |-- system
43 | `-- finite-area
44 | |-- faMeshDefiniton
45 | |-- faSchemes
46 | `-- faSolution
47 `-- instance
48 `-- finite-area
49 |-- U
50 |-- p
51 `-- ...
52 \endverbatim
53
54 Directory structure for fields/meshes (multi-regions):
55 \verbatim
56 .
57 |-- constant
58 | `-- finite-area
59 | |-- regionName1
60 | | `-- faMesh
61 | | `-- ...
62 | `-- regionNameN
63 | `-- faMesh
64 | `-- ...
65 |-- system
66 | `-- finite-area
67 | |-- regionName1
68 | | |-- faMeshDefiniton
69 | | |-- faSchemes
70 | | `-- faSolution
71 | `-- regionNameN
72 | `-- ...
73 |
74 `-- instance
75 `-- finite-area
76 |-- regionName1
77 | `-- ...
78 `-- regionNameN
79 `-- ...
80 \endverbatim
81
82SourceFiles
83 faMeshesRegistry.C
84
85\*---------------------------------------------------------------------------*/
86
87#ifndef Foam_faMeshesRegistry_H
88#define Foam_faMeshesRegistry_H
89
90#include "MeshObject.H"
91#include "polyMesh.H"
92
93// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
94
95namespace Foam
96{
97
98// Forward Declarations
99class faMesh;
101/*---------------------------------------------------------------------------*\
102 Class faMeshesRegistry Declaration
103\*---------------------------------------------------------------------------*/
104
106:
107 public MeshObject<polyMesh, UpdateableMeshObject, faMeshesRegistry>
108{
109 // Data Types
110
111 //- The MeshObject type
112 typedef MeshObject
113 <
114 polyMesh,
117 > MeshObject_type;
118
119
120 // Private Member Data
121
122 //- The sub-registry of finite-area objects (meshes),
123 //- anchored on the polyMesh parent. Name: "finite-area",
124 objectRegistry objects_;
125
126
127public:
128
129 //- Runtime type information.
130 TypeName("faMeshesRegistry");
132 // Generated Methods
133
134 //- No copy construct
135 faMeshesRegistry(const faMeshesRegistry&) = delete;
136
137 //- No copy assignment
138 void operator=(const faMeshesRegistry&) = delete;
139
140
141 // Constructors
142
143 //- Construct as singleton on the polyMesh registry
144 explicit faMeshesRegistry(const polyMesh& mesh);
145
146
147 // Factory Methods
148
149 //- Return the registry of objects on the singleton.
150 // Same as New(mesh).thisDb()
151 FOAM_NO_DANGLING_REFERENCE //< Reference stored in registry
152 static const objectRegistry& Registry(const polyMesh& mesh)
153 {
155 }
156
157
158 // Database
159
160 // It redirects to the private objects but uses some
161 // objectRegistry method naming
163 //- The registry of the objects
164 const objectRegistry& thisDb() const noexcept
165 {
166 return objects_;
167 }
168
169 //- Local relative to time
170 const fileName& dbDir() const
171 {
172 return objects_.dbDir();
173 }
174
175 //- The polyMesh reference
176 const polyMesh& mesh() const noexcept
177 {
178 return MeshObject_type::mesh();
179 }
180
181
182 // Topological Change
183
184 //- Is mesh moving - ie, is polyMesh moving
185 bool moving() const { return MeshObject_type::mesh().moving(); }
186
187 //- Update after mesh motion
188 virtual bool movePoints();
189
190 //- Update after topo change
191 virtual void updateMesh(const mapPolyMesh& mpm);
193
194 // Write
195
196 //- Write items (eg, faMesh) held in the registry
197 virtual bool writeObject
198 (
199 IOstreamOption streamOpt,
200 const bool writeOnProc = true
201 ) const;
202};
204
205// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206
207} // End namespace Foam
208
209
210// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
211
212#endif
213
214// ************************************************************************* //
A simple container for options an IOstream can normally have.
static FOAM_NO_DANGLING_REFERENCE const faMeshesRegistry & New(const polyMesh &mesh, Args &&... args)
Finite area mesh (used for 2-D non-Euclidian finite area method) defined using a patch of faces on a ...
Definition faMesh.H:140
virtual bool movePoints()
Update after mesh motion.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write items (eg, faMesh) held in the registry.
faMeshesRegistry(const faMeshesRegistry &)=delete
No copy construct.
const fileName & dbDir() const
Local relative to time.
static FOAM_NO_DANGLING_REFERENCE const objectRegistry & Registry(const polyMesh &mesh)
Return the registry of objects on the singleton.
TypeName("faMeshesRegistry")
Runtime type information.
void operator=(const faMeshesRegistry &)=delete
No copy assignment.
virtual void updateMesh(const mapPolyMesh &mpm)
Update after topo change.
const objectRegistry & thisDb() const noexcept
The registry of the objects.
const polyMesh & mesh() const noexcept
The polyMesh reference.
bool moving() const
Is mesh moving - ie, is polyMesh moving.
A class for handling file names.
Definition fileName.H:75
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Registry of regIOobjects.
virtual const fileName & dbDir() const
Local directory path of this objectRegistry relative to the time.
Mesh consisting of general polyhedral cells.
Definition polyMesh.H:79
bool moving() const noexcept
Is mesh moving.
Definition polyMesh.H:732
Namespace for OpenFOAM.
const direction noexcept
Definition scalarImpl.H:265
#define FOAM_NO_DANGLING_REFERENCE
Definition stdFoam.H:80
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition typeInfo.H:68