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 -------------------------------------------------------------------------------
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::polyMeshModifier
29 
30 Description
31  Virtual base class for mesh modifiers.
32 
33 SourceFiles
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"
45 #include "runTimeSelectionTables.H"
46 #include "autoPtr.H"
47 #include "pointField.H"
48 #include "faceList.H"
49 #include "cellList.H"
50 
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
52 
53 namespace Foam
54 {
55 
56 // Forward Declarations
57 class polyTopoChanger;
58 class polyTopoChange;
59 class mapPolyMesh;
60 class polyMeshModifier;
61 
62 Ostream& operator<<(Ostream&, const polyMeshModifier&);
63 
64 
65 /*---------------------------------------------------------------------------*\
66  Class polyMeshModifier Declaration
67 \*---------------------------------------------------------------------------*/
68 
69 class polyMeshModifier
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 
95 public:
96 
97  // Static data members
98 
99  //- Runtime type information
100  TypeName("meshModifier");
101 
102 
103  // Declare run-time constructor selection tables
104 
106  (
107  autoPtr,
109  dictionary,
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
207 
208  friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
209 };
210 
211 
212 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
213 
214 } // End namespace Foam
215 
216 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
217 
218 #endif
219 
220 // ************************************************************************* //
Foam::polyMeshModifier::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, polyMeshModifier, dictionary,(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme),(name, dict, index, mme))
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:77
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
typeInfo.H
Foam::polyMeshModifier::topoChanger
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Definition: polyMeshModifier.C:63
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:62
Foam::polyMeshModifier::writeDict
virtual void writeDict(Ostream &) const =0
Write dictionary.
Foam::polyTopoChange
Direct mesh changes based on v1.3 polyTopoChange syntax.
Definition: polyTopoChange.H:99
Foam::polyMeshModifier::index
label index() const
Return the index of this modifier.
Definition: polyMeshModifier.H:156
faceList.H
Foam::polyMeshModifier::updateMesh
virtual void updateMesh(const mapPolyMesh &)=0
Force recalculation of locally stored data on topological change.
Foam::polyMeshModifier::write
virtual void write(Ostream &) const =0
Write.
Foam::polyMeshModifier::disable
void disable() const
Activate mesh modifier.
Definition: polyMeshModifier.H:192
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::polyMeshModifier::setRefinement
virtual void setRefinement(polyTopoChange &) const =0
Insert the topological change instructions.
Foam::Field< vector >
Foam::polyMeshModifier::modifyMotionPoints
virtual void modifyMotionPoints(pointField &motionPoints) const =0
Modify motion points to comply with the topological change.
Foam::polyMeshModifier::active
Switch active() const
If modifier activate?
Definition: polyMeshModifier.H:180
Switch.H
cellList.H
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::polyMeshModifier::operator<<
friend Ostream & operator<<(Ostream &, const polyMeshModifier &)
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
Foam::polyMeshModifier::changeTopology
virtual bool changeTopology() const =0
Check for topology change.
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::polyMeshModifier::New
static autoPtr< polyMeshModifier > New(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme)
Select constructed from dictionary.
Definition: polyMeshModifierNew.C:35
Foam::polyMeshModifier
Virtual base class for mesh modifiers.
Definition: polyMeshModifier.H:68
Foam::polyMeshModifier::name
const word & name() const
Return name of this modifier.
Definition: polyMeshModifier.H:150
pointField.H
Foam::polyMeshModifier::enable
void enable() const
Activate mesh modifier.
Definition: polyMeshModifier.H:186
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
runTimeSelectionTables.H
Macros to ease declaration of run-time selection tables.
label.H
Foam::polyMeshModifier::TypeName
TypeName("meshModifier")
Runtime type information.
Foam::polyMeshModifier::~polyMeshModifier
virtual ~polyMeshModifier()=default
Destructor.
Foam::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:161
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
autoPtr.H