polyMeshModifier.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) 2020 OpenCFD Ltd.
10-------------------------------------------------------------------------------
11License
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
27Class
28 Foam::polyMeshModifier
29
30Description
31 Virtual base class for mesh modifiers.
32
33SourceFiles
34 polyMeshModifier.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef polyMeshModifier_H
39#define polyMeshModifier_H
40
41#include "label.H"
42#include "word.H"
43#include "Switch.H"
44#include "typeInfo.H"
46#include "autoPtr.H"
47#include "pointField.H"
48#include "faceList.H"
49#include "cellList.H"
50
51// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52
53namespace Foam
54{
55
56// Forward Declarations
57class polyTopoChanger;
58class polyTopoChange;
59class mapPolyMesh;
60class polyMeshModifier;
61
62Ostream& operator<<(Ostream&, const polyMeshModifier&);
63
64
65/*---------------------------------------------------------------------------*\
66 Class polyMeshModifier Declaration
67\*---------------------------------------------------------------------------*/
70{
71 // Private data
72
73 //- Name of modifier
74 word name_;
75
76 //- Index of modifier
77 label index_;
78
79 //- Reference to morph engine
80 const polyTopoChanger& topoChanger_;
81
82 //- Activation switch
83 mutable Switch active_;
84
85
86 // Private Member Functions
87
88 //- No copy construct
89 polyMeshModifier(const polyMeshModifier&) = delete;
90
91 //- No copy assignment
92 void operator=(const polyMeshModifier&) = delete;
93
94
95public:
96
97 // Static data members
98
99 //- Runtime type information
100 TypeName("meshModifier");
101
102
103 // Declare run-time constructor selection tables
106 (
107 autoPtr,
110 (
111 const word& name,
112 const dictionary& dict,
113 const label index,
114 const polyTopoChanger& mme
115 ),
116 (name, dict, index, mme)
117 );
118
119
120 // Constructors
121
122 //- Construct from components
124 (
125 const word& name,
126 const label index,
127 const polyTopoChanger& mme,
128 const bool act
129 );
130
131
132 // Selectors
133
134 //- Select constructed from dictionary
136 (
137 const word& name,
138 const dictionary& dict,
139 const label index,
140 const polyTopoChanger& mme
141 );
142
143
144 //- Destructor
145 virtual ~polyMeshModifier() = default;
146
147
148 // Member Functions
149
150 //- Return name of this modifier
151 const word& name() const
152 {
153 return name_;
154 }
155
156 //- Return the index of this modifier
157 label index() const
158 {
159 return index_;
160 }
161
162 //- Return reference to morph engine
163 const polyTopoChanger& topoChanger() const;
164
165 //- Check for topology change
166 virtual bool changeTopology() const = 0;
167
168 //- Insert the topological change instructions
169 virtual void setRefinement(polyTopoChange&) const = 0;
170
171 //- Modify motion points to comply with the topological change
172 virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
173
174 //- Force recalculation of locally stored data on topological change
175 virtual void updateMesh(const mapPolyMesh&) = 0;
176
177
178 // Activation and deactivation
179
180 //- If modifier activate?
181 Switch active() const
182 {
183 return active_;
184 }
185
186 //- Activate mesh modifier
187 void enable() const
188 {
189 active_ = true;
190 }
191
192 //- Activate mesh modifier
193 void disable() const
194 {
195 active_ = false;
196 }
197
198
199 //- Write
200 virtual void write(Ostream&) const = 0;
201
202 //- Write dictionary
203 virtual void writeDict(Ostream&) const = 0;
204
205
206 // Ostream Operator
208 friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
209};
210
211
212// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213
214} // End namespace Foam
215
216// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217
218#endif
219
220// ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:78
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: autoPtr.H:66
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:126
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:162
Virtual base class for mesh modifiers.
virtual void write(Ostream &) const =0
Write.
void disable() const
Activate mesh modifier.
virtual void writeDict(Ostream &) const =0
Write dictionary.
virtual ~polyMeshModifier()=default
Destructor.
declareRunTimeSelectionTable(autoPtr, polyMeshModifier, dictionary,(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme),(name, dict, index, mme))
label index() const
Return the index of this modifier.
const word & name() const
Return name of this modifier.
virtual void setRefinement(polyTopoChange &) const =0
Insert the topological change instructions.
virtual bool changeTopology() const =0
Check for topology change.
void enable() const
Activate mesh modifier.
TypeName("meshModifier")
Runtime type information.
Switch active() const
If modifier activate?
static autoPtr< polyMeshModifier > New(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme)
Select constructed from dictionary.
friend Ostream & operator<<(Ostream &, const polyMeshModifier &)
virtual void modifyMotionPoints(pointField &motionPoints) const =0
Modify motion points to comply with the topological change.
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
virtual void updateMesh(const mapPolyMesh &)=0
Force recalculation of locally stored data on topological change.
Direct mesh changes based on v1.3 polyTopoChange syntax.
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from Foam::string.
Definition: word.H:68
Namespace for OpenFOAM.
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
runTime write()
Macros to ease declaration of run-time selection tables.
#define declareRunTimeSelectionTable(ptrWrapper, baseType, argNames, argList, parList)
Declare a run-time selection (variables and adder classes)
dictionary dict
#define TypeName(TypeNameString)
Declare a ClassName() with extra virtual type info.
Definition: typeInfo.H:73