externalDisplacementMeshMover.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) 2013-2014 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::externalDisplacementMeshMover
28 
29 Description
30  Virtual base class for mesh movers with externally provided displacement
31  field giving the boundary conditions. Move the mesh from the current
32  location to a new location (so modify the mesh; v.s. motionSolver that
33  only returns the new location).
34 
35  All mesh movers are expected to read the dictionary settings at invocation
36  of move(), i.e. not cache any settings.
37 
38 SourceFiles
39  externalDisplacementMeshMover.C
40 
41 \*---------------------------------------------------------------------------*/
42 
43 #ifndef externalDisplacementMeshMover_H
44 #define externalDisplacementMeshMover_H
45 
46 #include "pointFields.H"
47 
48 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
49 
50 namespace Foam
51 {
52 
53 class mapPolyMesh;
54 
55 /*---------------------------------------------------------------------------*\
56  Class externalDisplacementMeshMover Declaration
57 \*---------------------------------------------------------------------------*/
58 
60 {
61 protected:
62 
63  // Protected data
64 
65  //- Baffles in the mesh
67 
68  //- Reference to point motion field
70 
71  //- In dry-run mode?
72  const bool dryRun_;
73 
74 
75  // Protected Member functions
76 
77  //- Extract fixed-value patchfields
79 
80  //- Construct patch on selected patches
82  (
83  const polyMesh&,
84  const labelList&
85  );
86 
87 
88 private:
89 
90  // Private Member Functions
91 
92  //- No copy construct
94  (
96  ) = delete;
97 
98  //- No copy assignment
99  void operator=(const externalDisplacementMeshMover&) = delete;
100 
101 
102 public:
103 
104  //- Runtime type information
105  TypeName("externalDisplacementMeshMover");
106 
107 
108  // Declare run-time New selection table
109 
111  (
112  autoPtr,
114  dictionary,
115  (
116  const dictionary& dict,
117  const List<labelPair>& baffles,
119  const bool dryRun
120  ),
121  (dict, baffles, pointDisplacement, dryRun)
122  );
123 
124 
125  // Constructors
126 
127  //- Construct from dictionary and displacement field. Dictionary is
128  // allowed to go out of scope!
130  (
131  const dictionary& dict,
132  const List<labelPair>& baffles,
134  const bool dryRun
135  );
136 
137 
138  // Selectors
139 
140  //- Return a reference to the selected meshMover model
142  (
143  const word& type,
144  const dictionary& dict,
145  const List<labelPair>& baffles,
147  const bool dryRun = false
148  );
149 
150 
151  //- Destructor
153 
154 
155  // Member Functions
156 
157  // Access
158 
159  //- Return reference to the point motion displacement field
161  {
162  return pointDisplacement_;
163  }
164 
165  //- Return const reference to the point motion displacement field
166  const pointVectorField& pointDisplacement() const
167  {
168  return pointDisplacement_;
169  }
170 
171  const pointMesh& pMesh() const
172  {
173  return pointDisplacement_.mesh();
174  }
175 
176  const polyMesh& mesh() const
177  {
178  return pMesh()();
179  }
181 
182  // Mesh mover
183 
184  //- Move mesh using current pointDisplacement boundary values
185  // and current dictionary settings. Return true if successful
186  // (errors on checkFaces less than allowable). Updates
187  // pointDisplacement.
188  virtual bool move
189  (
190  const dictionary&,
191  const label nAllowableErrors,
192  labelList& checkFaces
193  ) = 0;
194 
195  //- Update local data for geometry changes
196  virtual void movePoints(const pointField&);
197 
198  //- Update local data for topology changes
199  virtual void updateMesh(const mapPolyMesh&);
200 };
201 
202 
203 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
204 
205 } // End namespace Foam
206 
207 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
208 
209 #endif
210 
211 // ************************************************************************* //
dictionary dict
virtual void movePoints(const pointField &)
Update local data for geometry changes.
TypeName("externalDisplacementMeshMover")
Runtime type information.
A list of keyword definitions, which are a keyword followed by a number of values (eg...
Definition: dictionary.H:129
A 1D array of objects of type <T>, where the size of the vector is known and used for subscript bound...
Definition: BitOps.H:56
Class containing mesh-to-mesh mapping information after a change in polyMesh topology.
Definition: mapPolyMesh.H:157
declareRunTimeSelectionTable(autoPtr, externalDisplacementMeshMover, dictionary,(const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement, const bool dryRun),(dict, baffles, pointDisplacement, dryRun))
fileName::Type type(const fileName &name, const bool followLink=true)
Return the file type: DIRECTORY or FILE, normally following symbolic links.
Definition: POSIX.C:799
pointVectorField & pointDisplacement()
Return reference to the point motion displacement field.
A class for handling words, derived from Foam::string.
Definition: word.H:63
virtual bool move(const dictionary &, const label nAllowableErrors, labelList &checkFaces)=0
Move mesh using current pointDisplacement boundary values.
const Mesh & mesh() const noexcept
Return mesh.
pointVectorField & pointDisplacement_
Reference to point motion field.
virtual void updateMesh(const mapPolyMesh &)
Update local data for topology changes.
Virtual base class for mesh movers with externally provided displacement field giving the boundary co...
List< labelPair > baffles_
Baffles in the mesh.
static autoPtr< externalDisplacementMeshMover > New(const word &type, const dictionary &dict, const List< labelPair > &baffles, pointVectorField &pointDisplacement, const bool dryRun=false)
Return a reference to the selected meshMover model.
Pointer management similar to std::unique_ptr, with some additional methods and type checking...
Definition: HashPtrTable.H:48
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
static autoPtr< indirectPrimitivePatch > getPatch(const polyMesh &, const labelList &)
Construct patch on selected patches.
static labelList getFixedValueBCs(const pointVectorField &)
Extract fixed-value patchfields.
Namespace for OpenFOAM.