polyTopoChanger.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2016 OpenFOAM Foundation
9  Copyright (C) 2017-2022 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 Class
28  Foam::polyTopoChanger
29 
30 Description
31  List of mesh modifiers defining the mesh dynamics.
32 
33 SourceFiles
34  polyTopoChanger.C
35 
36 \*---------------------------------------------------------------------------*/
37 
38 #ifndef Foam_polyTopoChanger_H
39 #define Foam_polyTopoChanger_H
40 
41 #include "regIOobject.H"
42 #include "PtrList.H"
43 #include "polyMeshModifier.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward Declarations
51 class polyMesh;
52 class mapPolyMesh;
53 class polyBoundaryMesh;
54 class polyTopoChanger;
55 
56 Ostream& operator<<(Ostream&, const polyTopoChanger&);
57 
58 
59 /*---------------------------------------------------------------------------*\
60  Class polyTopoChanger Declaration
61 \*---------------------------------------------------------------------------*/
62 
63 class polyTopoChanger
64 :
65  public PtrList<polyMeshModifier>,
66  public regIOobject
67 {
68  // Private Member Functions
69 
70  //- Read if IOobject flags set, set modifiers. Return true if read.
71  bool readContents();
72 
73  //- No copy construct
74  polyTopoChanger(const polyTopoChanger&) = delete;
75 
76  //- No copy assignment
77  void operator=(const polyTopoChanger&) = delete;
78 
79 
80 protected:
81 
82  // Protected data
83 
84  //- Reference to mesh
85  polyMesh& mesh_;
86 
87 public:
88 
89  //- Runtime type information
90  TypeName("polyTopoChanger");
91 
92 
93  // Constructors
94 
95  //- Read construct given IOobject and a polyMesh
97 
98  //- Read construct for given polyMesh and read-option
100 
101  //- Read construct for given polyMesh.
102  // Uses read-option READ_IF_PRESENT
103  explicit polyTopoChanger(polyMesh& mesh);
104 
105 
106  //- Destructor
107  virtual ~polyTopoChanger() = default;
108 
109 
110  // Member functions
111 
112  //- Return the mesh reference
113  const polyMesh& mesh() const
114  {
115  return mesh_;
116  }
117 
118  //- Return a list of patch types
119  wordList types() const;
120 
121  //- Return a list of patch names
122  wordList names() const;
123 
124  //- Is topology change required
125  bool changeTopology() const;
126 
127  //- Return topology change request
130  //- Modify point motion
131  void modifyMotionPoints(pointField&) const;
132 
134  (
135  const bool inflate,
136  const bool syncParallel = true,
137  const bool orderCells = false,
138  const bool orderPoints = false
139  );
140 
141  //- Force recalculation of locally stored data on topological change
142  void update(const mapPolyMesh& m);
143 
144  //- Add given set of topology modifiers to the topoChanger
146 
147  //- Find modifier given a name
148  label findModifierID(const word& modName) const;
149 
150 
151  //- writeData member function required by regIOobject
152  bool writeData(Ostream&) const;
153 
154 
155  // Member Operators
156 
157  bool operator!=(const polyTopoChanger&) const;
158  bool operator==(const polyTopoChanger&) const;
159 
160 
161  // Ostream Operator
162 
163  friend Ostream& operator<<(Ostream&, const polyTopoChanger&);
164 };
165 
166 
167 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
168 
169 } // End namespace Foam
170 
171 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
172 
173 #endif
174 
175 // ************************************************************************* //
autoPtr< polyTopoChange > topoChangeRequest() const
Return topology change request.
void update(const mapPolyMesh &m)
Force recalculation of locally stored data on topological change.
virtual ~polyTopoChanger()=default
Destructor.
bool operator!=(const polyTopoChanger &) const
polyMesh & mesh_
Reference to mesh.
label findModifierID(const word &modName) const
Find modifier given a name.
autoPtr< mapPolyMesh > changeMesh(const bool inflate, const bool syncParallel=true, const bool orderCells=false, const bool orderPoints=false)
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
bool changeTopology() const
Is topology change required.
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from Foam::string.
Definition: word.H:63
void modifyMotionPoints(pointField &) const
Modify point motion.
wordList types() const
Return a list of patch types.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
bool writeData(Ostream &) const
writeData member function required by regIOobject
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
A list of pointers to objects of type <T>, with allocation/deallocation management of the pointers...
Definition: List.H:55
regIOobject is an abstract class derived from IOobject to handle automatic object registration with t...
Definition: regIOobject.H:66
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
TypeName("polyTopoChanger")
Runtime type information.
bool operator==(const polyTopoChanger &) const
IOobject io("surfaceFilmProperties", mesh.time().constant(), mesh, IOobject::READ_IF_PRESENT, IOobject::NO_WRITE, IOobject::NO_REGISTER)
const polyMesh & mesh() const
Return the mesh reference.
void addTopologyModifiers(const List< polyMeshModifier *> &tm)
Add given set of topology modifiers to the topoChanger.
Defines the attributes of an object for which implicit objectRegistry management is supported...
Definition: IOobject.H:172
friend Ostream & operator<<(Ostream &, const polyTopoChanger &)
Namespace for OpenFOAM.
wordList names() const
Return a list of patch names.
readOption
Enumeration defining read preferences.