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 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 Class
27  Foam::polyMeshModifier
28 
29 Description
30  Virtual base class for mesh modifiers.
31 
32 SourceFiles
33  polyMeshModifier.C
34 
35 \*---------------------------------------------------------------------------*/
36 
37 #ifndef polyMeshModifier_H
38 #define polyMeshModifier_H
39 
40 #include "label.H"
41 #include "word.H"
42 #include "Switch.H"
43 #include "typeInfo.H"
44 #include "runTimeSelectionTables.H"
45 #include "autoPtr.H"
46 #include "pointField.H"
47 #include "faceList.H"
48 #include "cellList.H"
49 
50 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
51 
52 namespace Foam
53 {
54 
55 // Forward declaration of classes
56 class polyTopoChanger;
57 class polyTopoChange;
58 class mapPolyMesh;
59 
60 
61 // Forward declaration of friend functions and operators
62 
63 class polyMeshModifier;
64 
65 Ostream& operator<<(Ostream&, const polyMeshModifier&);
66 
67 
68 /*---------------------------------------------------------------------------*\
69  Class polyMeshModifier Declaration
70 \*---------------------------------------------------------------------------*/
71 
72 class polyMeshModifier
73 {
74  // Private data
75 
76  //- Name of modifier
77  word name_;
78 
79  //- Index of modifier
80  label index_;
81 
82  //- Reference to morph engine
83  const polyTopoChanger& topoChanger_;
84 
85  //- Activation switch
86  mutable Switch active_;
87 
88 
89  // Private Member Functions
90 
91  //- No copy construct
92  polyMeshModifier(const polyMeshModifier&) = delete;
93 
94  //- No copy assignment
95  void operator=(const polyMeshModifier&) = delete;
96 
97 
98 public:
99 
100  // Static data members
101 
102  //- Runtime type information
103  TypeName("meshModifier");
104 
105 
106  // Declare run-time constructor selection tables
107 
109  (
110  autoPtr,
112  dictionary,
113  (
114  const word& name,
115  const dictionary& dict,
116  const label index,
117  const polyTopoChanger& mme
118  ),
119  (name, dict, index, mme)
120  );
121 
122 
123  // Constructors
124 
125  //- Construct from components
127  (
128  const word& name,
129  const label index,
130  const polyTopoChanger& mme,
131  const bool act
132  );
133 
134 
135  // Selectors
136 
137  //- Select constructed from dictionary
139  (
140  const word& name,
141  const dictionary& dict,
142  const label index,
143  const polyTopoChanger& mme
144  );
145 
146 
147  //- Destructor
148  virtual ~polyMeshModifier();
149 
150 
151  // Member Functions
152 
153  //- Return name of this modifier
154  const word& name() const
155  {
156  return name_;
157  }
158 
159  //- Return the index of this modifier
160  label index() const
161  {
162  return index_;
163  }
164 
165  //- Return reference to morph engine
166  const polyTopoChanger& topoChanger() const;
167 
168  //- Check for topology change
169  virtual bool changeTopology() const = 0;
170 
171  //- Insert the topological change instructions
172  virtual void setRefinement(polyTopoChange&) const = 0;
173 
174  //- Modify motion points to comply with the topological change
175  virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
176 
177  //- Force recalculation of locally stored data on topological change
178  virtual void updateMesh(const mapPolyMesh&) = 0;
179 
180 
181  // Activation and deactivation
182 
183  const Switch& active() const
184  {
185  return active_;
186  }
187 
188  //- Activate mesh modifier
189  void enable() const
190  {
191  active_ = true;
192  }
193 
194  //- Activate mesh modifier
195  void disable() const
196  {
197  active_ = false;
198  }
199 
200 
201  //- Write
202  virtual void write(Ostream&) const = 0;
203 
204  //- Write dictionary
205  virtual void writeDict(Ostream&) const = 0;
206 
207 
208  // Ostream Operator
209 
210  friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
211 };
212 
213 
214 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
215 
216 } // End namespace Foam
217 
218 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
219 
220 #endif
221 
222 // ************************************************************************* //
Foam::polyMeshModifier::declareRunTimeSelectionTable
declareRunTimeSelectionTable(autoPtr, polyMeshModifier, dictionary,(const word &name, const dictionary &dict, const label index, const polyTopoChanger &mme),(name, dict, index, mme))
Foam::polyMeshModifier::~polyMeshModifier
virtual ~polyMeshModifier()
Destructor.
Definition: polyMeshModifier.C:65
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:70
Foam::polyMeshModifier::active
const Switch & active() const
Definition: polyMeshModifier.H:182
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
typeInfo.H
Foam::polyMeshModifier::topoChanger
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Definition: polyMeshModifier.C:71
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:67
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:100
Foam::polyMeshModifier::index
label index() const
Return the index of this modifier.
Definition: polyMeshModifier.H:159
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:194
Foam::polyMeshModifier::setRefinement
virtual void setRefinement(polyTopoChange &) const =0
Insert the topological change instructions.
Foam::label
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:62
Foam::Field< vector >
Foam::polyMeshModifier::modifyMotionPoints
virtual void modifyMotionPoints(pointField &motionPoints) const =0
Modify motion points to comply with the topological change.
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:121
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:71
Foam::polyMeshModifier::name
const word & name() const
Return name of this modifier.
Definition: polyMeshModifier.H:153
pointField.H
Foam::polyMeshModifier::enable
void enable() const
Activate mesh modifier.
Definition: polyMeshModifier.H:188
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::mapPolyMesh
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:160
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102
autoPtr.H