1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 \\ / A nd | Copyright (C) 1991-2009 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 the
13 Free Software Foundation; either version 2 of the License, or (at your
14 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, write to the Free Software Foundation,
23 Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 \*---------------------------------------------------------------------------*/
27 #include "enginePiston.H"
28 #include <engine/engineTime.H>
29 #include <OpenFOAM/polyMesh.H>
30 #include <OpenFOAM/interpolateXY.H>
32 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 // Construct from components
35 Foam::enginePiston::enginePiston
38 const word& pistonPatchName,
39 const autoPtr<coordinateSystem>& pistonCS,
40 const scalar minLayer,
45 engineDB_(refCast<const engineTime>(mesh.time())),
46 patchID_(pistonPatchName, mesh.boundaryMesh()),
53 // Construct from dictionary
54 Foam::enginePiston::enginePiston
57 const dictionary& dict
61 engineDB_(refCast<const engineTime>(mesh_.time())),
62 patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
68 dict.subDict("coordinateSystem")
71 minLayer_(readScalar(dict.lookup("minLayer"))),
72 maxLayer_(readScalar(dict.lookup("maxLayer")))
76 // * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
79 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
81 void Foam::enginePiston::writeDict(Ostream& os) const
83 os << nl << token::BEGIN_BLOCK
84 << "patch " << patchID_.name() << token::END_STATEMENT << nl
85 << "minLayer " << minLayer_ << token::END_STATEMENT << nl
86 << "maxLayer " << maxLayer_ << token::END_STATEMENT << nl
87 << token::END_BLOCK << endl;
91 // ************************ vim: set sw=4 sts=4 et: ************************ //