fvMeshTopoChanger.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) 2021-2023 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::fvMeshTopoChanger
26 
27 Description
28  Abstract base class for fvMesh topology changers.
29 
30  These classes apply topology changes to the mesh,
31  e.g. refinement/unrefinement, layer addition/removal, mesh-to-mesh mapping
32  etc.
33 
34 SourceFiles
35  fvMeshTopoChanger.C
36  fvMeshTopoChangerNew.C
37 
38 \*---------------------------------------------------------------------------*/
39 
40 #ifndef fvMeshTopoChanger_H
41 #define fvMeshTopoChanger_H
42 
43 #include "fvMesh.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class fvMeshTopoChanger Declaration
52 \*---------------------------------------------------------------------------*/
53 
55 {
56  // Private Data
57 
58  //- Non-const fvMesh reference to allow update
59  fvMesh& mesh_;
60 
61  //- The dynamicMeshDict
62  dictionary dynamicMeshDict_;
63 
64 
65 public:
66 
67  //- Runtime type information
68  TypeName("fvMeshTopoChanger");
69 
70 
71  // Declare run-time constructor selection table
72 
74  (
75  autoPtr,
77  fvMesh,
78  (fvMesh& mesh, const dictionary& dict),
79  (mesh, dict)
80  );
81 
82 
83  //- Helper class to update the velocity boundary conditions
84  // following mesh motion
86  {
87  // Private Data
88 
89  const fvMesh& mesh_;
90 
91  wordList velocityFields_;
92 
93  public:
94 
95  // Constructors
96 
98  (
99  const fvMesh& mesh,
100  const dictionary& dict
101  );
102 
103 
104  // Member Functions
105 
106  void update() const;
107  };
108 
109 
110  // Constructors
111 
112  //- Construct from fvMesh
113  explicit fvMeshTopoChanger(fvMesh&);
114 
115  //- Disallow default bitwise copy construction
116  fvMeshTopoChanger(const fvMeshTopoChanger&) = delete;
117 
118 
119  // Selectors
120 
121  //- Select, construct and return the fvMeshTopoChanger
123 
124  //- Select, construct and return the fvMeshTopoChanger
126 
127 
128  //- Destructor
129  virtual ~fvMeshTopoChanger();
130 
131 
132  // Member Functions
133 
134  //- Return the fvMesh
135  fvMesh& mesh()
136  {
137  return mesh_;
138  }
139 
140  //- Return the fvMesh
141  const fvMesh& mesh() const
142  {
143  return mesh_;
144  }
145 
146  //- Is mesh dynamic, i.e. might it change?
147  // Defaults to true, set to false in the fvMeshTopoChangers::none
148  virtual bool dynamic() const
149  {
150  return true;
151  }
152 
153  //- Update the mesh for both mesh motion and topology change
154  virtual bool update() = 0;
155 
156  //- Update corresponding to the given map
157  virtual void topoChange(const polyTopoChangeMap&) = 0;
158 
159  //- Update from another mesh using the given map
160  virtual void mapMesh(const polyMeshMap&) = 0;
161 
162  //- Update corresponding to the given distribution map
163  virtual void distribute(const polyDistributionMap&) = 0;
164 
165  //- Write the mover state
166  virtual bool write(const bool write = true) const
167  {
168  return true;
169  }
170 
171 
172  // Member Operators
173 
174  //- Disallow default bitwise assignment
175  void operator=(const fvMeshTopoChanger&) = delete;
176 };
177 
178 
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
180 
181 } // End namespace Foam
182 
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 
185 #endif
186 
187 // ************************************************************************* //
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
Helper class to update the velocity boundary conditions.
velocityMotionCorrection(const fvMesh &mesh, const dictionary &dict)
Abstract base class for fvMesh topology changers.
virtual void mapMesh(const polyMeshMap &)=0
Update from another mesh using the given map.
virtual void distribute(const polyDistributionMap &)=0
Update corresponding to the given distribution map.
TypeName("fvMeshTopoChanger")
Runtime type information.
void operator=(const fvMeshTopoChanger &)=delete
Disallow default bitwise assignment.
virtual bool dynamic() const
Is mesh dynamic, i.e. might it change?
virtual ~fvMeshTopoChanger()
Destructor.
virtual bool update()=0
Update the mesh for both mesh motion and topology change.
fvMesh & mesh()
Return the fvMesh.
fvMeshTopoChanger(fvMesh &)
Construct from fvMesh.
declareRunTimeSelectionTable(autoPtr, fvMeshTopoChanger, fvMesh,(fvMesh &mesh, const dictionary &dict),(mesh, dict))
static autoPtr< fvMeshTopoChanger > New(fvMesh &, const dictionary &dict)
Select, construct and return the fvMeshTopoChanger.
virtual bool write(const bool write=true) const
Write the mover state.
virtual void topoChange(const polyTopoChangeMap &)=0
Update corresponding to the given map.
Mesh data needed to do the Finite Volume discretisation.
Definition: fvMesh.H:101
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.
Namespace for OpenFOAM.
dictionary dict