MeshObjects.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration | Website: https://openfoam.org
5  \\ / A nd | Copyright (C) 2011-2026 OpenFOAM Foundation
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8 License
9  This file is part of OpenFOAM.
10 
11  OpenFOAM is free software: you can redistribute it and/or modify it
12  under the terms of the GNU General Public License as published by
13  the Free Software Foundation, either version 3 of the License, or
14  (at your option) any later version.
15 
16  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
19  for more details.
20 
21  You should have received a copy of the GNU General Public License
22  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
23 
24 Class
25  Foam::DeletableMeshObject
26 
27 Description
28  MeshObject types:
29 
30  - DeletableMeshObject:
31  mesh object to be deleted after any mesh change
32  - MoveableMeshObject:
33  mesh object to be updated after mesh motion otherwise deleted
34  - DistributeableMeshObject
35  mesh object to be updated after mesh redistribution or motion
36  otherwise deleted
37  - TopoChangeableMeshObject:
38  mesh object to be updated after mesh topology change,
39  mesh-to-mesh mapping, redistribution or motion otherwise deleted
40  - RepatchableMeshObject:
41  mesh object to be updated on patch or topology change,
42  mesh-to-mesh mapping, redistribution or motion otherwise deleted
43  - PermanentMeshObject:
44  mesh object to be updated on patch or topology change,
45  mesh-to-mesh mapping, redistribution or motion and never deleted
46 
47 \*---------------------------------------------------------------------------*/
48 
49 #ifndef MeshObjects_H
50 #define MeshObjects_H
51 
52 #include "regIOobject.H"
53 
54 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
55 
56 namespace Foam
57 {
58 
59 // Forward declarations
60 class polyTopoChangeMap;
61 class polyMeshMap;
62 class polyDistributionMap;
63 class meshObjects;
64 
65 /*---------------------------------------------------------------------------*\
66  Class DeletableMeshObject Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 template<class Mesh>
71 {
72  //- Reference to the regIOobject of the base-class
73  regIOobject& io_;
74 
75  //- The regIOobject reference is used by the meshObjects functions
76  friend class meshObjects;
77 
78 public:
79 
80  template<class Type>
81  DeletableMeshObject(Type& mo)
82  :
83  io_(mo)
84  {}
85 
86  //- Virtual destructor to make class polymorphic
87  virtual ~DeletableMeshObject() = default;
88 };
89 
90 
91 /*---------------------------------------------------------------------------*\
92  Class MoveableMeshObject Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 template<class Mesh>
97 :
98  public DeletableMeshObject<Mesh>
99 {
100 public:
101 
102  template<class Type>
103  MoveableMeshObject(Type& mo)
104  :
105  DeletableMeshObject<Mesh>(mo)
106  {}
107 
108  //- Update for mesh motion
109  virtual bool movePoints() = 0;
110 };
111 
112 
113 /*---------------------------------------------------------------------------*\
114  Class DistributeableMeshObject Declaration
115 \*---------------------------------------------------------------------------*/
116 
117 template<class Mesh>
119 :
120  public MoveableMeshObject<Mesh>
121 {
122 public:
123 
124  template<class Type>
125  DistributeableMeshObject(Type& mo)
126  :
127  MoveableMeshObject<Mesh>(mo)
128  {}
129 
130  //- Redistribute or update using the given distribution map
131  virtual void distribute(const polyDistributionMap& map) = 0;
132 };
133 
134 
135 /*---------------------------------------------------------------------------*\
136  Class TopoChangeableMeshObject Declaration
137 \*---------------------------------------------------------------------------*/
138 
139 template<class Mesh>
141 :
142  public DistributeableMeshObject<Mesh>
143 {
144 public:
145 
146  template<class Type>
147  TopoChangeableMeshObject(Type& mo)
148  :
149  DistributeableMeshObject<Mesh>(mo)
150  {}
151 
152  //- Update topology using the given map
153  virtual void topoChange(const polyTopoChangeMap& map) = 0;
154 
155  //- Update from another mesh using the given map
156  virtual void mapMesh(const polyMeshMap& map) = 0;
157 
158  //- Swap mesh
159  // For run-time mesh replacement and mesh to mesh mapping
160  virtual void swap(Mesh& otherMesh)
161  {}
162 };
163 
164 
165 /*---------------------------------------------------------------------------*\
166  Class RepatchableMeshObject Declaration
167 \*---------------------------------------------------------------------------*/
168 
169 template<class Mesh>
171 :
172  public TopoChangeableMeshObject<Mesh>
173 {
174 public:
175 
176  template<class Type>
177  RepatchableMeshObject(Type& mo)
178  :
179  TopoChangeableMeshObject<Mesh>(mo)
180  {}
181 
182  //- Reordered/removed trailing patches. If validBoundary call is parallel
183  // synced and all add the same patch with same settings
184  virtual void reorderPatches
185  (
186  const labelUList& newToOld,
187  const bool validBoundary
188  ) = 0;
189 
190  //- Inserted patch at patchi
191  virtual void addPatch(const label patchi) = 0;
192 };
193 
194 
195 
196 /*---------------------------------------------------------------------------*\
197  Class PermanentMeshObject Declaration
198 \*---------------------------------------------------------------------------*/
199 
200 template<class Mesh>
202 :
203  public RepatchableMeshObject<Mesh>
204 {
205 public:
206 
207  template<class Type>
208  PermanentMeshObject(Type& mo)
209  :
210  RepatchableMeshObject<Mesh>(mo)
211  {}
212 
213  //- Reset
214  virtual void reset() = 0;
215 
216  //- Clear all but permanent registered meshObjects
217  virtual void clear() = 0;
218 };
219 
220 
221 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
222 
223 } // End namespace Foam
224 
225 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
226 
227 #endif
228 
229 // ************************************************************************* //
MeshObject types:
Definition: MeshObjects.H:70
virtual ~DeletableMeshObject()=default
Virtual destructor to make class polymorphic.
virtual void distribute(const polyDistributionMap &map)=0
Redistribute or update using the given distribution map.
virtual bool movePoints()=0
Update for mesh motion.
virtual void reset()=0
Reset.
virtual void clear()=0
Clear all but permanent registered meshObjects.
virtual void addPatch(const label patchi)=0
Inserted patch at patchi.
virtual void reorderPatches(const labelUList &newToOld, const bool validBoundary)=0
Reordered/removed trailing patches. If validBoundary call is parallel.
virtual void topoChange(const polyTopoChangeMap &map)=0
Update topology using the given map.
virtual void mapMesh(const polyMeshMap &map)=0
Update from another mesh using the given map.
virtual void swap(Mesh &otherMesh)
Swap mesh.
Definition: MeshObjects.H:159
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: meshObjects.H:95
Class containing mesh-to-mesh mapping information after a mesh distribution where we send parts of me...
Class containing mesh-to-mesh mapping information.
Definition: polyMeshMap.H:51
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:55
label patchi
Namespace for OpenFOAM.
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:59