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