1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 2004-2011 OpenCFD Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of OpenFOAM.
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.
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
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/>.
24 \*---------------------------------------------------------------------------*/
26 #include "motionSolver.H"
29 #include "dlLibraryTable.H"
31 // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
35 defineTypeNameAndDebug(motionSolver, 0);
36 defineRunTimeSelectionTable(motionSolver, dictionary);
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
41 Foam::motionSolver::motionSolver(const polyMesh& mesh)
48 mesh.time().constant(),
50 IOobject::MUST_READ_IF_MODIFIED,
55 twoDPointCorrector_(mesh)
59 // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * //
61 Foam::autoPtr<Foam::motionSolver> Foam::motionSolver::New(const polyMesh& mesh)
63 IOdictionary solverDict
68 mesh.time().constant(),
70 IOobject::MUST_READ_IF_MODIFIED,
76 Istream& msData = solverDict.lookup("solver");
78 const word solverTypeName(msData);
80 Info<< "Selecting motion solver: " << solverTypeName << endl;
82 const_cast<Time&>(mesh.time()).libs().open
86 dictionaryConstructorTablePtr_
89 if (!dictionaryConstructorTablePtr_)
93 "motionSolver::New(const polyMesh& mesh)"
94 ) << "solver table is empty"
98 dictionaryConstructorTable::iterator cstrIter =
99 dictionaryConstructorTablePtr_->find(solverTypeName);
101 if (cstrIter == dictionaryConstructorTablePtr_->end())
105 "motionSolver::New(const polyMesh& mesh)"
106 ) << "Unknown solver type "
107 << solverTypeName << nl << nl
108 << "Valid solver types are:" << endl
109 << dictionaryConstructorTablePtr_->sortedToc()
113 return autoPtr<motionSolver>(cstrIter()(mesh, msData));
117 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
119 Foam::motionSolver::~motionSolver()
123 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
125 Foam::tmp<Foam::pointField> Foam::motionSolver::newPoints()
132 void Foam::motionSolver::twoDCorrectPoints(pointField& p) const
134 twoDPointCorrector_.correctPoints(p);
138 void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm)
140 twoDPointCorrector_.updateMesh();
144 // ************************************************************************* //