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-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::faMeshesRegistry
28 
29 Description
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 
82 SourceFiles
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 
95 namespace Foam
96 {
97 
98 // Forward Declarations
99 class faMesh;
101 /*---------------------------------------------------------------------------*\
102  Class faMeshesRegistry Declaration
103 \*---------------------------------------------------------------------------*/
104 
105 class faMeshesRegistry
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 
127 public:
128 
129  //- Runtime type information.
130  TypeName("faMeshesRegistry");
131 
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  // Database
148 
149  //- Return the object registry
150  const objectRegistry& thisDb() const noexcept
151  {
152  return objects_;
153  }
154 
155  //- The polyMesh reference
156  const polyMesh& mesh() const noexcept
157  {
158  return MeshObject_type::mesh();
159  }
160 
161 
162  // Topological Change
163 
164  //- Is mesh moving - ie, is polyMesh moving
165  bool moving() const { return MeshObject_type::mesh().moving(); }
166 
167  //- Update after mesh motion
168  virtual bool movePoints();
169 
170  //- Update after topo change
171  virtual void updateMesh(const mapPolyMesh& mpm);
172 
173 
174  // Write
175 
176  //- Write items (eg, faMesh) held in the registry
177  virtual bool writeObject
178  (
179  IOstreamOption streamOpt,
180  const bool writeOnProc = true
181  ) const;
182 };
183 
184 
185 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
186 
187 } // End namespace Foam
188 
189 
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
191 
192 #endif
193 
194 // ************************************************************************* //
TypeName("faMeshesRegistry")
Runtime type information.
A simple container for options an IOstream can normally have.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: MeshObject.H:152
virtual void updateMesh(const mapPolyMesh &mpm)
Update after topo change.
bool moving() const
Is mesh moving - ie, is polyMesh moving.
const polyMesh & mesh() const noexcept
Reference to the mesh.
Definition: MeshObject.H:255
virtual bool movePoints()
Update after mesh motion.
const direction noexcept
Definition: Scalar.H:258
void operator=(const faMeshesRegistry &)=delete
No copy assignment.
bool moving() const noexcept
Is mesh moving.
Definition: polyMesh.H:732
const objectRegistry & thisDb() const noexcept
Return the object registry.
virtual bool writeObject(IOstreamOption streamOpt, const bool writeOnProc=true) const
Write items (eg, faMesh) held in the registry.
A MeshObject registry on top of a polyMesh that provides an objectRegistry for holding multiple faMes...
const polyMesh & mesh() const noexcept
The polyMesh reference.
faMeshesRegistry(const faMeshesRegistry &)=delete
No copy construct.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:75
Registry of regIOobjects.
Namespace for OpenFOAM.
UpdateableMeshObject(const word &objName, const objectRegistry &obr)
Construct from name and instance on registry.
Definition: MeshObject.H:352