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-2018 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  // Private Member Functions
88 
89  //- Disallow default bitwise copy construct
91 
92  //- Disallow default bitwise assignment
93  void operator=(const polyMeshModifier&);
94 
95 
96 public:
97 
98  // Static data members
99 
100  //- Runtime type information
101  TypeName("meshModifier");
102 
103 
104  // Declare run-time constructor selection tables
105 
107  (
108  autoPtr,
110  dictionary,
111  (
112  const word& name,
113  const dictionary& dict,
114  const label index,
115  const polyTopoChanger& mme
116  ),
117  (name, dict, index, mme)
118  );
119 
120 
121  // Constructors
122 
123  //- Construct from components
125  (
126  const word& name,
127  const label index,
128  const polyTopoChanger& mme,
129  const bool act
130  );
131 
132 
133  // Selectors
134 
135  //- Select constructed from dictionary
137  (
138  const word& name,
139  const dictionary& dict,
140  const label index,
141  const polyTopoChanger& mme
142  );
143 
144 
145  //- Destructor
146  virtual ~polyMeshModifier();
147 
148 
149  // Member Functions
150 
151  //- Return name of this modifier
152  const word& name() const
153  {
154  return name_;
155  }
156 
157  //- Return the index of this modifier
158  label index() const
159  {
160  return index_;
161  }
162 
163  //- Return reference to morph engine
164  const polyTopoChanger& topoChanger() const;
165 
166  //- Check for topology change
167  virtual bool changeTopology() const = 0;
168 
169  //- Insert the topological change instructions
170  virtual void setRefinement(polyTopoChange&) const = 0;
171 
172  //- Modify motion points to comply with the topological change
173  virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
174 
175  //- Force recalculation of locally stored data on topological change
176  virtual void updateMesh(const mapPolyMesh&) = 0;
177 
178 
179  // Activation and deactivation
181  const 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 // ************************************************************************* //
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.
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
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.
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))
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:53
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.