polyMeshModifier.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) 2011-2020 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::polyMeshModifier
26 
27 Description
28  Virtual base class for mesh modifiers.
29 
30 SourceFiles
31  polyMeshModifier.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef polyMeshModifier_H
36 #define polyMeshModifier_H
37 
38 #include "label.H"
39 #include "word.H"
40 #include "Switch.H"
41 #include "typeInfo.H"
42 #include "runTimeSelectionTables.H"
43 #include "autoPtr.H"
44 #include "pointField.H"
45 #include "faceList.H"
46 #include "cellList.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 // Forward declaration of classes
54 class polyTopoChanger;
55 class polyTopoChange;
56 class mapPolyMesh;
57 
58 
59 // Forward declaration of friend functions and operators
60 
61 class polyMeshModifier;
62 
63 Ostream& operator<<(Ostream&, const polyMeshModifier&);
64 
65 
66 /*---------------------------------------------------------------------------*\
67  Class polyMeshModifier Declaration
68 \*---------------------------------------------------------------------------*/
69 
70 class polyMeshModifier
71 {
72  // Private Data
73 
74  //- Name of modifier
75  word name_;
76 
77  //- Index of modifier
78  label index_;
79 
80  //- Reference to morph engine
81  const polyTopoChanger& topoChanger_;
82 
83  //- Activation switch
84  mutable Switch active_;
85 
86 
87 public:
88 
89  // Static Data Members
90 
91  //- Runtime type information
92  TypeName("meshModifier");
93 
94 
95  // Declare run-time constructor selection tables
96 
98  (
99  autoPtr,
101  dictionary,
102  (
103  const word& name,
104  const dictionary& dict,
105  const label index,
106  const polyTopoChanger& mme
107  ),
108  (name, dict, index, mme)
109  );
110 
111 
112  // Constructors
113 
114  //- Construct from components
116  (
117  const word& name,
118  const label index,
119  const polyTopoChanger& mme,
120  const bool act
121  );
122 
123  //- Disallow default bitwise copy construction
124  polyMeshModifier(const polyMeshModifier&) = delete;
125 
126 
127  // Selectors
128 
129  //- Select constructed from dictionary
131  (
132  const word& name,
133  const dictionary& dict,
134  const label index,
135  const polyTopoChanger& mme
136  );
137 
138 
139  //- Destructor
140  virtual ~polyMeshModifier();
141 
142 
143  // Member Functions
144 
145  //- Return name of this modifier
146  const word& name() const
147  {
148  return name_;
149  }
150 
151  //- Return the index of this modifier
152  label index() const
153  {
154  return index_;
155  }
156 
157  //- Return reference to morph engine
158  const polyTopoChanger& topoChanger() const;
159 
160  //- Check for topology change
161  virtual bool changeTopology() const = 0;
162 
163  //- Insert the topological change instructions
164  virtual void setRefinement(polyTopoChange&) const = 0;
165 
166  //- Modify motion points to comply with the topological change
167  virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
168 
169  //- Force recalculation of locally stored data on topological change
170  virtual void updateMesh(const mapPolyMesh&) = 0;
171 
172 
173  // Activation and deactivation
175  const Switch& active() const
176  {
177  return active_;
178  }
179 
180  //- Activate mesh modifier
181  void enable() const
182  {
183  active_ = true;
184  }
185 
186  //- Activate mesh modifier
187  void disable() const
188  {
189  active_ = false;
190  }
191 
192 
193  //- Write
194  virtual void write(Ostream&) const = 0;
195 
196  //- Write dictionary
197  virtual void writeDict(Ostream&) const = 0;
198 
199 
200  // Member Operators
201 
202  //- Disallow default bitwise assignment
203  void operator=(const polyMeshModifier&) = delete;
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 // ************************************************************************* //
dictionary dict
virtual void writeDict(Ostream &) const =0
Write dictionary.
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
void disable() const
Activate mesh modifier.
polyMeshModifier(const word &name, const label index, const polyTopoChanger &mme, const bool act)
Construct from components.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
void enable() const
Activate mesh modifier.
A simple wrapper around bool so that it can be read as a word: true/false, on/off, yes/no, y/n, t/f, or none/any.
Definition: Switch.H:60
static autoPtr< polyMeshModifier > New(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme)
Select constructed from dictionary.
TypeName("meshModifier")
Runtime type information.
const Switch & active() const
virtual void write(Ostream &) const =0
Write.
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
declareRunTimeSelectionTable(autoPtr, polyMeshModifier, dictionary,(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme),(name, dict, index, mme))
void operator=(const polyMeshModifier &)=delete
Disallow default bitwise assignment.
virtual void updateMesh(const mapPolyMesh &)=0
Force recalculation of locally stored data on topological change.
List of mesh modifiers defining the mesh dynamics.
A class for handling words, derived from string.
Definition: word.H:59
friend Ostream & operator<<(Ostream &, const polyMeshModifier &)
Virtual base class for mesh modifiers.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
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.
Direct mesh changes based on v1.3 polyTopoChange syntax.
Ostream & operator<<(Ostream &, const ensightPart &)
virtual void setRefinement(polyTopoChange &) const =0
Insert the topological change instructions.
virtual ~polyMeshModifier()
Destructor.
virtual bool changeTopology() const =0
Check for topology change.
const word & name() const
Return name of this modifier.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Macros to ease declaration of run-time selection tables.
label index() const
Return the index of this modifier.
Namespace for OpenFOAM.