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 | Copyright (C) 2011-2015 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  Class polyMeshModifier Declaration
60 \*---------------------------------------------------------------------------*/
61 
62 class polyMeshModifier
63 {
64  // Private data
65 
66  //- Name of modifier
67  word name_;
68 
69  //- Index of modifier
70  label index_;
71 
72  //- Reference to morph engine
74 
75  //- Activation switch
76  mutable Switch active_;
77 
78 
79  // Private Member Functions
80 
81  //- Disallow default bitwise copy construct
83 
84  //- Disallow default bitwise assignment
85  void operator=(const polyMeshModifier&);
86 
87 
88 public:
89 
90  // Static data members
91 
92  //- Runtime type information
93  TypeName("meshModifier");
94 
95 
96  // Declare run-time constructor selection tables
97 
99  (
100  autoPtr,
102  dictionary,
103  (
104  const word& name,
105  const dictionary& dict,
106  const label index,
107  const polyTopoChanger& mme
108  ),
109  (name, dict, index, mme)
110  );
111 
112 
113  // Constructors
114 
115  //- Construct from components
117  (
118  const word& name,
119  const label index,
120  const polyTopoChanger& mme,
121  const bool act
122  );
123 
124 
125  // Selectors
126 
127  //- Select constructed from dictionary
129  (
130  const word& name,
131  const dictionary& dict,
132  const label index,
133  const polyTopoChanger& mme
134  );
135 
136 
137  //- Destructor
138  virtual ~polyMeshModifier();
139 
140 
141  // Member Functions
142 
143  //- Return name of this modifier
144  const word& name() const
145  {
146  return name_;
147  }
148 
149  //- Return the index of this modifier
150  label index() const
151  {
152  return index_;
153  }
154 
155  //- Return reference to morph engine
156  const polyTopoChanger& topoChanger() const;
157 
158  //- Check for topology change
159  virtual bool changeTopology() const = 0;
160 
161  //- Insert the topological change instructions
162  virtual void setRefinement(polyTopoChange&) const = 0;
163 
164  //- Modify motion points to comply with the topological change
165  virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
166 
167  //- Force recalculation of locally stored data on topological change
168  virtual void updateMesh(const mapPolyMesh&) = 0;
169 
170 
171  // Activation and deactivation
172 
173  const Switch& active() const
174  {
175  return active_;
176  }
177 
178  //- Activate mesh modifier
179  void enable() const
180  {
181  active_ = true;
182  }
183 
184  //- Activate mesh modifier
185  void disable() const
186  {
187  active_ = false;
188  }
189 
190 
191  //- Write
192  virtual void write(Ostream&) const = 0;
193 
194  //- Write dictionary
195  virtual void writeDict(Ostream&) const = 0;
196 
197 
198  // Ostream Operator
199 
200  friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
201 };
202 
203 
204 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
205 
206 } // End namespace Foam
207 
208 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
209 
210 #endif
211 
212 // ************************************************************************* //
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:63
Foam::Switch
A simple wrapper around bool so that it can be read as a word: true/false, on/off,...
Definition: Switch.H:60
Foam::polyMeshModifier::active
const Switch & active() const
Definition: polyMeshModifier.H:172
Foam::word
A class for handling words, derived from string.
Definition: word.H:59
typeInfo.H
Foam::polyMeshModifier::topoChanger
const polyTopoChanger & topoChanger() const
Return reference to morph engine.
Definition: polyMeshModifier.C:69
Foam::polyMeshModifier::operator=
void operator=(const polyMeshModifier &)
Disallow default bitwise assignment.
Foam::polyTopoChanger
List of mesh modifiers defining the mesh dynamics.
Definition: polyTopoChanger.H:56
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:97
Foam::polyMeshModifier::index
label index() const
Return the index of this modifier.
Definition: polyMeshModifier.H:149
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:184
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:59
Foam::Field
Pre-declare SubField and related Field type.
Definition: Field.H:57
Foam::polyMeshModifier::active_
Switch active_
Activation switch.
Definition: polyMeshModifier.H:75
Foam::polyMeshModifier::modifyMotionPoints
virtual void modifyMotionPoints(pointField &motionPoints) const =0
Modify motion points to comply with the topological change.
Foam::polyMeshModifier::index_
label index_
Index of modifier.
Definition: polyMeshModifier.H:69
Switch.H
Foam::polyMeshModifier::topoChanger_
const polyTopoChanger & topoChanger_
Reference to morph engine.
Definition: polyMeshModifier.H:72
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 any number of values (e....
Definition: dictionary.H:137
Foam::polyMeshModifier::changeTopology
virtual bool changeTopology() const =0
Check for topology change.
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
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:32
Foam::polyMeshModifier
Virtual base class for mesh modifiers.
Definition: polyMeshModifier.H:61
Foam::polyMeshModifier::name
const word & name() const
Return name of this modifier.
Definition: polyMeshModifier.H:143
pointField.H
Foam::polyMeshModifier::enable
void enable() const
Activate mesh modifier.
Definition: polyMeshModifier.H:178
Foam::autoPtr
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:117
Foam::polyMeshModifier::polyMeshModifier
polyMeshModifier(const polyMeshModifier &)
Disallow default bitwise copy construct.
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:158
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
word.H
Foam::polyMeshModifier::name_
word name_
Name of modifier.
Definition: polyMeshModifier.H:66
autoPtr.H