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) 2022-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::meshObjects
26 
27 Description
28  Templated abstract base-class for optional mesh objects used to automate
29  their allocation to the mesh database and the mesh-modifier event-loop.
30 
31  MeshObject is templated on the type of mesh it is allocated to, the type of
32  the mesh object (DeletableMeshObject, MoveableMeshObject,
33  DistributeableMeshObject, TopoChangeableMeshObject) and the type of the
34  actual object it is created for example:
35 
36  \verbatim
37  class leastSquaresVectors
38  :
39  public MeshObject<fvMesh, MoveableMeshObject, leastSquaresVectors>
40  {
41  .
42  .
43  .
44  //- Delete the least square vectors when the mesh moves
45  virtual bool movePoints();
46  };
47  \endverbatim
48 
49  MeshObject types:
50 
51  - DeletableMeshObject:
52  mesh object to be deleted after any mesh change
53  - MoveableMeshObject:
54  mesh object to be updated after mesh motion otherwise deleted
55  - DistributeableMeshObject
56  mesh object to be updated after mesh redistribution or motion
57  otherwise deleted
58  - TopoChangeableMeshObject:
59  mesh object to be updated after mesh topology change,
60  mesh-to-mesh mapping, redistribution or motion otherwise deleted
61  - RepatchableMeshObject:
62  mesh object to be updated on patch or topology change,
63  mesh-to-mesh mapping, redistribution or motion otherwise deleted
64 
65  Note:
66  movePoints must be provided for MeshObjects of type MoveableMeshObject
67  and both movePoints and topoChange functions must exist, provided for
68  MeshObjects of type TopoChangeableMeshObject.
69 
70 SourceFiles
71  meshObject.C
72  meshObjects.C
73 
74 \*---------------------------------------------------------------------------*/
75 
76 #ifndef meshObjects_H
77 #define meshObjects_H
78 
79 #include "objectRegistry.H"
80 
81 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
82 
83 namespace Foam
84 {
85 
86 // Forward declarations
87 class polyTopoChangeMap;
88 class polyMeshMap;
89 class polyDistributionMap;
90 
91 /*---------------------------------------------------------------------------*\
92  Class meshObjects Declaration
93 \*---------------------------------------------------------------------------*/
94 
95 class meshObjects
96 {
97  //- Checkout and delete object if owned by registry
98  // otherwise error
99  template<class Mesh>
100  static void Delete(regIOobject&);
101 
102 
103 public:
104 
105  ClassName("meshObjects");
106 
107  template<class Mesh>
108  static void movePoints(objectRegistry&);
109 
110  template<class Mesh>
111  static void topoChange(objectRegistry&, const polyTopoChangeMap&);
112 
113  template<class Mesh>
114  static void mapMesh(objectRegistry&, const polyMeshMap&);
115 
116  template<class Mesh>
117  static void distribute(objectRegistry&, const polyDistributionMap&);
118 
119  template<class Mesh>
120  static void addPatch(objectRegistry&, const label patchi);
121 
122  template<class Mesh>
123  static void reorderPatches
124  (
126  const labelUList& newToOld,
127  const bool validBoundary
128  );
129 
130  template<class Mesh, template<class> class MeshObjectType>
131  static void clear(objectRegistry&);
132 
133  //- Clear all meshObjects derived from FromType up to (but not including)
134  // ToType. Used to clear e.g. all non-updateable meshObjects
135  template
136  <
137  class Mesh,
138  template<class> class FromType,
139  template<class> class ToType
140  >
141  static void clearUpto(objectRegistry&);
142 };
143 
144 
145 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
146 
147 } // End namespace Foam
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 #ifdef NoRepository
152  #include "meshObjectsTemplates.C"
153 #endif
154 
155 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
156 
157 #endif
158 
159 // ************************************************************************* //
Templated abstract base-class for optional mesh objects used to automate their allocation to the mesh...
Definition: meshObjects.H:95
static void clearUpto(objectRegistry &)
Clear all meshObjects derived from FromType up to (but not including)
static void movePoints(objectRegistry &)
ClassName("meshObjects")
static void mapMesh(objectRegistry &, const polyMeshMap &)
static void clear(objectRegistry &)
static void distribute(objectRegistry &, const polyDistributionMap &)
static void addPatch(objectRegistry &, const label patchi)
static void topoChange(objectRegistry &, const polyTopoChangeMap &)
static void reorderPatches(objectRegistry &, const labelUList &newToOld, const bool validBoundary)
Registry of regIOobjects.
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