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-2024 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 
44 \*---------------------------------------------------------------------------*/
45 
46 #ifndef MeshObjects_H
47 #define MeshObjects_H
48 
49 #include "regIOobject.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward declarations
57 class polyTopoChangeMap;
58 class polyMeshMap;
59 class polyDistributionMap;
60 class meshObjects;
61 
62 /*---------------------------------------------------------------------------*\
63  Class DeletableMeshObject Declaration
64 \*---------------------------------------------------------------------------*/
65 
66 template<class Mesh>
68 {
69  //- Reference to the regIOobject of the base-class
70  regIOobject& io_;
71 
72  //- The regIOobject reference is used by the meshObjects functions
73  friend class meshObjects;
74 
75 public:
76 
77  template<class Type>
78  DeletableMeshObject(Type& mo)
79  :
80  io_(mo)
81  {}
82 
83  //- Virtual destructor to make class polymorphic
84  virtual ~DeletableMeshObject() = default;
85 };
86 
87 
88 /*---------------------------------------------------------------------------*\
89  Class MoveableMeshObject Declaration
90 \*---------------------------------------------------------------------------*/
91 
92 template<class Mesh>
94 :
95  public DeletableMeshObject<Mesh>
96 {
97 public:
98 
99  template<class Type>
100  MoveableMeshObject(Type& mo)
101  :
102  DeletableMeshObject<Mesh>(mo)
103  {}
104 
105  //- Update for mesh motion
106  virtual bool movePoints() = 0;
107 };
108 
109 
110 /*---------------------------------------------------------------------------*\
111  Class DistributeableMeshObject Declaration
112 \*---------------------------------------------------------------------------*/
113 
114 template<class Mesh>
116 :
117  public MoveableMeshObject<Mesh>
118 {
119 public:
120 
121  template<class Type>
122  DistributeableMeshObject(Type& mo)
123  :
124  MoveableMeshObject<Mesh>(mo)
125  {}
126 
127  //- Redistribute or update using the given distribution map
128  virtual void distribute(const polyDistributionMap& map) = 0;
129 };
130 
131 
132 /*---------------------------------------------------------------------------*\
133  Class TopoChangeableMeshObject Declaration
134 \*---------------------------------------------------------------------------*/
135 
136 template<class Mesh>
138 :
139  public DistributeableMeshObject<Mesh>
140 {
141 public:
142 
143  template<class Type>
144  TopoChangeableMeshObject(Type& mo)
145  :
146  DistributeableMeshObject<Mesh>(mo)
147  {}
148 
149  //- Update topology using the given map
150  virtual void topoChange(const polyTopoChangeMap& map) = 0;
151 
152  //- Update from another mesh using the given map
153  virtual void mapMesh(const polyMeshMap& map) = 0;
154 };
155 
156 
157 /*---------------------------------------------------------------------------*\
158  Class RepatchableMeshObject Declaration
159 \*---------------------------------------------------------------------------*/
160 
161 template<class Mesh>
163 :
164  public TopoChangeableMeshObject<Mesh>
165 {
166 public:
167 
168  template<class Type>
169  RepatchableMeshObject(Type& mo)
170  :
171  TopoChangeableMeshObject<Mesh>(mo)
172  {}
173 
174  //- Reordered/removed trailing patches. If validBoundary call is parallel
175  // synced and all add the same patch with same settings
176  virtual void reorderPatches
177  (
178  const labelUList& newToOld,
179  const bool validBoundary
180  ) = 0;
181 
182  //- Inserted patch at patchi
183  virtual void addPatch(const label patchi) = 0;
184 };
185 
186 
187 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
188 
189 } // End namespace Foam
190 
191 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
192 
193 #endif
194 
195 // ************************************************************************* //
MeshObject types:
Definition: MeshObjects.H:67
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.
MoveableMeshObject(Type &mo)
Definition: MeshObjects.H:99
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.
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