motionSolver.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-2013 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 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
42 
43 namespace Foam
44 {
45 
46 // Forward class declarations
47 class polyMesh;
48 class mapPolyMesh;
49 
50 /*---------------------------------------------------------------------------*\
51  Class motionSolver Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class motionSolver
55 :
56  public IOdictionary
57 {
58 
59 private:
60 
61  // Private data
62 
63  //- Reference to mesh
64  const polyMesh& mesh_;
65 
66  //- Model coefficients dictionary
67  dictionary coeffDict_;
68 
69 
70  // Private Member Functions
71 
72  //- De-register object if registered and assign to current
73  static IOobject stealRegistration(const IOdictionary& dict);
74 
75 public:
76 
77  //- Runtime type information
78  TypeName("motionSolver");
79 
80 
81  // Declare run-time constructor selection tables
82 
84  (
85  autoPtr,
87  dictionary,
88  (const polyMesh& mesh, const IOdictionary& dict),
89  (mesh, dict)
90  );
91 
92 
93  // Selectors
94 
95  //- Select constructed from polyMesh
96  static autoPtr<motionSolver> New(const polyMesh&);
97 
98  //- Select constructed from polyMesh and dictionary. If dictionary
99  // was registered this will 'steal' that registration.
100  static autoPtr<motionSolver> New(const polyMesh&, const IOdictionary&);
101 
102 
103  // Constructors
104 
105  //- Construct from polyMesh
106  motionSolver(const polyMesh& mesh);
107 
108  //- Construct from polyMesh and dictionary and type.
110  (
111  const polyMesh& mesh,
112  const IOdictionary&,
113  const word& type
114  );
115 
116 
117  //- Destructor
118  virtual ~motionSolver();
119 
120 
121  // Member Functions
122 
123  //- Return reference to mesh
124  const polyMesh& mesh() const
125  {
126  return mesh_;
127  }
128 
129  //- Const access to the coefficients dictionary
130  const dictionary& coeffDict() const
131  {
132  return coeffDict_;
133  }
134 
135  //- Provide new points for motion. Solves for motion
136  virtual tmp<pointField> newPoints();
137 
138  //- Provide current points for motion. Uses current motion field
139  virtual tmp<pointField> curPoints() const = 0;
140 
141  virtual void twoDCorrectPoints(pointField&) const;
142 
143  //- Solve for motion
144  virtual void solve() = 0;
145 
146  //- Update local data for geometry changes
147  virtual void movePoints(const pointField&) = 0;
148 
149  //- Update local data for topology changes
150  virtual void updateMesh(const mapPolyMesh&) = 0;
151 
152  //- Write state using given format, version and compression
153  virtual bool writeObject
154  (
158  ) const;
159 
160  //- Read dynamicMeshDict dictionary
161  virtual bool read();
162 };
163 
164 
165 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
166 
167 } // End namespace Foam
168 
169 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
170 
171 #endif
172 
173 // ************************************************************************* //
dictionary dict
const dictionary & coeffDict() const
Const access to the coefficients dictionary.
Definition: motionSolver.H:129
virtual tmp< pointField > newPoints()
Provide new points for motion. Solves for motion.
Definition: motionSolver.C:161
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:137
virtual void twoDCorrectPoints(pointField &) const
Definition: motionSolver.C:168
Virtual base class for mesh motion solver.
Definition: motionSolver.H:53
static autoPtr< motionSolver > New(const polyMesh &)
Select constructed from polyMesh.
Definition: motionSolver.C:135
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:158
IOdictionary is derived from dictionary and IOobject to give the dictionary automatic IO functionalit...
Definition: IOdictionary.H:53
virtual void updateMesh(const mapPolyMesh &)=0
Update local data for topology changes.
Definition: motionSolver.C:174
virtual bool writeObject(IOstream::streamFormat fmt, IOstream::versionNumber ver, IOstream::compressionType cmp) const
Write state using given format, version and compression.
Definition: motionSolver.C:179
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:155
motionSolver(const polyMesh &mesh)
Construct from polyMesh.
Definition: motionSolver.C:62
const polyMesh & mesh() const
Return reference to mesh.
Definition: motionSolver.H:123
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:189
compressionType
Enumeration for the format of data in the stream.
Definition: IOstream.H:193
virtual tmp< pointField > curPoints() const =0
Provide current points for motion. Uses current motion field.
fileName::Type type(const fileName &)
Return the file type: DIRECTORY or FILE.
Definition: POSIX.C:461
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:53
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
A class for managing temporary objects.
Definition: PtrList.H:54
TypeName("motionSolver")
Runtime type information.
IOobject defines the attributes of an object for which implicit objectRegistry management is supporte...
Definition: IOobject.H:91
Namespace for OpenFOAM.