pointMeshMover.C
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-2026 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 \*---------------------------------------------------------------------------*/
25 
26 #include "pointMeshMover.H"
27 #include "polyMesh.H"
28 #include "dictionaryEntry.H"
29 #include "twoDPointCorrector.H"
30 
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
37 }
38 
39 
40 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 
43 :
44  mesh_(mesh)
45 {}
46 
47 
49 {
51  return autoPtr<pointMeshMover>(nullptr);
52 }
53 
54 
55 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
56 
58 (
59  const polyMesh& mesh,
60  const dictionary& dict
61 )
62 {
64  (
65  {pointMeshMover::typeName, "motionSolver"}, word::null
66  );
67 
68  if (type == word::null)
69  {
70  type = dict.lookup<word>("type");
71  }
72 
73  Info<< indentOrNl << "Selecting pointMeshMover: " << type << endl;
74 
75  libs.open
76  (
77  dict,
78  "libs",
79  dictionaryConstructorTablePtr_
80  );
81 
82  if (!dictionaryConstructorTablePtr_)
83  {
85  << "solver table is empty"
86  << exit(FatalIOError);
87  }
88 
89  dictionaryConstructorTable::iterator cstrIter =
90  dictionaryConstructorTablePtr_->find(type);
91 
92  if (cstrIter == dictionaryConstructorTablePtr_->end())
93  {
95  << "Unknown solver type "
96  << type << nl << nl
97  << "Valid solver types are:" << endl
98  << dictionaryConstructorTablePtr_->sortedToc()
99  << exit(FatalIOError);
100  }
101 
103  (
104  cstrIter()(mesh, dict.optionalTypeDict(type))
105  );
106 }
107 
108 
109 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
110 
112 {}
113 
114 
115 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
116 
118 {
120 }
121 
122 
124 {
125  return true;
126 }
127 
128 
129 // ************************************************************************* //
static twoDPointCorrector & New(const word &name, const polyMesh &mesh)
Construct and return the named DemandDrivenMeshObject.
A list of keywords followed by any number of values (e.g. words and numbers) or sub-dictionaries.
Definition: dictionary.H:162
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:669
T lookupOrDefaultBackwardsCompatible(const wordList &, const T &) const
Find and return a T, trying a list of keywords in sequence,.
const dictionary & optionalTypeDict(const word &typeName) const
Find and return an optional type sub-dictionary.
Definition: dictionary.C:921
bool open(const fileName &libName, const bool verbose=true)
Open the named library, optionally with warnings if problems occur.
Abstract base class for pointMesh movers.
virtual ~pointMeshMover()
Destructor.
static autoPtr< pointMeshMover > New(const polyMesh &, const dictionary &)
Select constructed from polyMesh and dictionary.
pointMeshMover(const polyMesh &mesh, const word &type)
Construct from polyMesh and dictionary and type.
virtual autoPtr< pointMeshMover > clone() const
Clone function.
virtual void twoDCorrectPoints(pointField &) const
Correct point field for reduced-dimensionality cases.
virtual bool write() const
Optionally write motion state information for restart.
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:78
void correctPoints(pointField &p) const
Correct motion points.
A class for handling words, derived from string.
Definition: word.H:63
static const word null
An empty word.
Definition: word.H:78
Foam::fvMesh mesh(Foam::IOobject(regionName, runTime.name(), runTime, Foam::IOobject::MUST_READ), false)
#define NotImplemented
Issue a FatalErrorIn for a function not currently implemented.
Definition: error.H:381
#define FatalIOErrorInFunction(ios)
Report an error message using Foam::FatalIOError.
Definition: error.H:346
Namespace for OpenFOAM.
errorManipArg< error, int > exit(error &err, const int errNo=1)
Definition: errorManip.H:124
dlLibraryTable libs
Table of loaded dynamic libraries.
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:288
String typeName(const std::type_info &info)
Return the un-mangled name given the standard type info.
messageStream Info
defineRunTimeSelectionTable(fvConstraint, dictionary)
IOerror FatalIOError
Ostream & indentOrNl(Ostream &os)
Indent stream or add newline if indent level == 0.
Definition: Ostream.H:250
defineTypeNameAndDebug(atmosphericBoundaryLayer, 0)
static const char nl
Definition: Ostream.H:297
fileType type(const fileName &, const bool checkVariants=true, const bool followLink=true)
Return the file type: directory or file.
Definition: POSIX.C:488
dictionary dict
volScalarField & p