motionSolver.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::motionSolver
26 
27 Description
28  Virtual base class for mesh motion solver.
29 
30 SourceFiles
31  motionSolver.C
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef motionSolver_H
36 #define motionSolver_H
37 
38 #include "IOdictionary.H"
39 #include "pointField.H"
40 
41 #include "Time.H"
42 #include "polyMesh.H"
43 #include "dictionaryEntry.H"
44 
45 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46 
47 namespace Foam
48 {
49 
50 // Forward class declarations
51 class polyMesh;
52 class mapPolyMesh;
53 
54 /*---------------------------------------------------------------------------*\
55  Class motionSolver Declaration
56 \*---------------------------------------------------------------------------*/
57 
58 class motionSolver
59 :
60  public IOdictionary
61 {
62  // Private data
63 
64  //- Reference to mesh
65  const polyMesh& mesh_;
66 
67  //- Model coefficients dictionary
68  dictionary coeffDict_;
69 
70 
71  // Private Member Functions
72 
73  //- De-register object if registered and assign to current
74  static IOobject stealRegistration(const IOdictionary& dict);
75 
76 
77 public:
78 
79  //- Runtime type information
80  TypeName("motionSolver");
81 
82 
83  // Declare run-time constructor selection tables
84 
86  (
87  autoPtr,
89  dictionary,
90  (const polyMesh& mesh, const IOdictionary& dict),
91  (mesh, dict)
92  );
93 
94 
95  // Selectors
96 
97  //- Select constructed from polyMesh
98  static autoPtr<motionSolver> New(const polyMesh&);
99 
100  //- Select constructed from polyMesh and dictionary. If dictionary
101  // was registered this will 'steal' that registration.
102  static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&);
103 
104  //- Class used for the construction of PtrLists of motionSolvers
105  class iNew
106  {
107  const polyMesh& mesh_;
108 
109  public:
110 
111  iNew(const polyMesh& mesh);
112 
114  };
115 
116 
117 
118  // Constructors
119 
120  //- Construct from polyMesh
121  motionSolver(const polyMesh& mesh);
122 
123  //- Construct from polyMesh and dictionary and type.
125  (
126  const polyMesh& mesh,
127  const IOdictionary&,
128  const word& type
129  );
130 
131  //- Clone function
132  virtual autoPtr<motionSolver> clone() const;
133 
134 
135  //- Destructor
136  virtual ~motionSolver();
137 
138 
139  // Member Functions
140 
141  //- Return reference to mesh
142  const polyMesh& mesh() const
143  {
144  return mesh_;
145  }
146 
147  //- Const access to the coefficients dictionary
148  const dictionary& coeffDict() const
149  {
150  return coeffDict_;
151  }
152 
153  //- Provide new points for motion. Solves for motion
154  virtual tmp<pointField> newPoints();
155 
156  //- Provide current points for motion. Uses current motion field
157  virtual tmp<pointField> curPoints() const = 0;
158 
159  virtual void twoDCorrectPoints(pointField&) const;
160 
161  //- Solve for motion
162  virtual void solve() = 0;
163 
164  //- Update local data for geometry changes
165  virtual void movePoints(const pointField&) = 0;
166 
167  //- Update local data for topology changes
168  virtual void updateMesh(const mapPolyMesh&) = 0;
169 
170  //- Write state using given format, version and compression
171  virtual bool writeObject
172  (
176  const bool valid
177  ) const;
178 
179  //- Read dynamicMeshDict dictionary
180  virtual bool read();
181 };
182 
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 } // End namespace Foam
187 
188 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
189 
190 #endif
191 
192 // ************************************************************************* //
Class used for the construction of PtrLists of motionSolvers.
Definition: motionSolver.H:104
dictionary dict
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:203
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
autoPtr< motionSolver > operator()(Istream &is) const
Definition: motionSolver.C:172
Virtual base class for mesh motion solver.
Definition: motionSolver.H:57
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:147
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:147
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp, const bool valid) const
Write state using given format, version and compression.
Definition: motionSolver.C:221
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:52
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:216
iNew(const polyMesh &mesh)
Definition: motionSolver.C:165
virtual void movePoints(const pointField &)=0
Update local data for geometry changes.
A class for handling words, derived from string.
Definition: word.H:59
virtual ~motionSolver()
Destructor.
Definition: motionSolver.C:197
motionSolver(const polyMesh &mesh)
Construct from polyMesh.
Definition: motionSolver.C:62
streamFormat
Enumeration for the format of data in the stream.
Definition: IOstream.H:86
virtual void solve()=0
Solve for motion.
virtual bool read()
Read dynamicMeshDict dictionary.
Definition: motionSolver.C:232
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
fileName::Type type(const fileName &, const bool followLink=true)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:481
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
declareRunTimeSelectionTable(autoPtr, motionSolver, dictionary,(const polyMesh &mesh, const IOdictionary &dict),(mesh, dict))
Version number type.
Definition: IOstream.H:96
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:141
A class for managing temporary objects.
Definition: PtrList.H:53
TypeName("motionSolver")
Runtime type information.
virtual autoPtr< motionSolver > clone() const
Clone function.
Definition: motionSolver.C:92
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:92
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:210
Namespace for OpenFOAM.