/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | \\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\/ M anipulation | ------------------------------------------------------------------------------- License This file is part of OpenFOAM. OpenFOAM is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. OpenFOAM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenFOAM. If not, see . \*---------------------------------------------------------------------------*/ #include "motionSolver.H" #include "Time.H" #include "polyMesh.H" #include "dlLibraryTable.H" // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // namespace Foam { defineTypeNameAndDebug(motionSolver, 0); defineRunTimeSelectionTable(motionSolver, dictionary); } // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * // Foam::motionSolver::motionSolver(const polyMesh& mesh) : IOdictionary ( IOobject ( "dynamicMeshDict", mesh.time().constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE ) ), mesh_(mesh), twoDPointCorrector_(mesh) {} // * * * * * * * * * * * * * * * * Selectors * * * * * * * * * * * * * * * * // Foam::autoPtr Foam::motionSolver::New(const polyMesh& mesh) { IOdictionary solverDict ( IOobject ( "dynamicMeshDict", mesh.time().constant(), mesh, IOobject::MUST_READ, IOobject::NO_WRITE, false ) ); Istream& msData = solverDict.lookup("solver"); word solverTypeName(msData); Info<< "Selecting motion solver: " << solverTypeName << endl; dlLibraryTable::open ( solverDict, "motionSolverLibs", dictionaryConstructorTablePtr_ ); if (!dictionaryConstructorTablePtr_) { FatalErrorIn ( "motionSolver::New(const polyMesh& mesh)" ) << "solver table is empty" << exit(FatalError); } dictionaryConstructorTable::iterator cstrIter = dictionaryConstructorTablePtr_->find(solverTypeName); if (cstrIter == dictionaryConstructorTablePtr_->end()) { FatalErrorIn ( "motionSolver::New(const polyMesh& mesh)" ) << "Unknown solver type " << solverTypeName << endl << endl << "Valid solver types are: " << endl << dictionaryConstructorTablePtr_->sortedToc() << exit(FatalError); } return autoPtr(cstrIter()(mesh, msData)); } // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * // Foam::motionSolver::~motionSolver() {} // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * // Foam::tmp Foam::motionSolver::newPoints() { solve(); return curPoints(); } void Foam::motionSolver::twoDCorrectPoints(pointField& p) const { twoDPointCorrector_.correctPoints(p); } void Foam::motionSolver::updateMesh(const mapPolyMesh& mpm) { twoDPointCorrector_.updateMesh(); } // ************************************************************************* //