FreeFOAM The Cross-Platform CFD Toolkit
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) 1991-2010 OpenCFD Ltd.
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 <OpenFOAM/label.H>
39 #include <OpenFOAM/word.H>
40 #include <OpenFOAM/Switch.H>
41 #include <OpenFOAM/typeInfo.H>
43 #include <OpenFOAM/autoPtr.H>
44 #include <OpenFOAM/pointField.H>
45 #include <OpenFOAM/faceList.H>
46 #include <OpenFOAM/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 
63 {
64  // Private data
65 
66  //- Name of zone
67  word name_;
68 
69  //- Index of zone
70  label index_;
71 
72  //- Reference to morph engine
73  const polyTopoChanger& topoChanger_;
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 
139  virtual ~polyMeshModifier();
140 
141 
142  // Member Functions
143 
144  //- Return name
145  const word& name() const
146  {
147  return name_;
148  }
149 
150  //- Return the index of this patch in the boundaryMesh
151  label index() const
152  {
153  return index_;
154  }
155 
156  //- Return reference to morph engine
157  const polyTopoChanger& topoChanger() const;
158 
159  //- Check for topology change
160  virtual bool changeTopology() const = 0;
161 
162  //- Insert the topological change instructions
163  virtual void setRefinement(polyTopoChange&) const = 0;
164 
165  //- Modify motion points to comply with the topological change
166  virtual void modifyMotionPoints(pointField& motionPoints) const = 0;
167 
168  //- Force recalculation of locally stored data on topological change
169  virtual void updateMesh(const mapPolyMesh&) = 0;
170 
171 
172  // Activation and deactivation
173 
174  const Switch& active() const
175  {
176  return active_;
177  }
178 
179  //- Activate mesh modifier
180  void enable() const
181  {
182  active_ = true;
183  }
184 
185  //- Activate mesh modifier
186  void disable() const
187  {
188  active_ = false;
189  }
190 
191 
192  //- Write
193  virtual void write(Ostream&) const = 0;
194 
195  //- Write dictionary
196  virtual void writeDict(Ostream&) const = 0;
197 
198 
199  // Ostream Operator
200 
201  friend Ostream& operator<<(Ostream&, const polyMeshModifier&);
202 };
203 
204 
205 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
206 
207 } // End namespace Foam
208 
209 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
210 
211 #endif
212 
213 // ************************ vim: set sw=4 sts=4 et: ************************ //