initial commit for version 1.6.x patch release
[OpenFOAM-1.6.x.git] / src / engine / enginePiston / enginePiston.C
blobc5fa7c9f15c810ab30f969ec72b2c2b3ba9e131e
1 /*---------------------------------------------------------------------------*\
2   =========                 |
3   \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4    \\    /   O peration     |
5     \\  /    A nd           | Copyright (C) 1991-2009 OpenCFD Ltd.
6      \\/     M anipulation  |
7 -------------------------------------------------------------------------------
8 License
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
19     for more details.
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 "engineTime.H"
29 #include "polyMesh.H"
30 #include "interpolateXY.H"
32 // * * * * * * * * * * * * * * * * Constructors  * * * * * * * * * * * * * * //
34 // Construct from components
35 Foam::enginePiston::enginePiston
37     const polyMesh& mesh,
38     const word& pistonPatchName,
39     const autoPtr<coordinateSystem>& pistonCS,
40     const scalar minLayer,
41     const scalar maxLayer
44     mesh_(mesh),
45     engineDB_(refCast<const engineTime>(mesh.time())),
46     patchID_(pistonPatchName, mesh.boundaryMesh()),
47     csPtr_(pistonCS),
48     minLayer_(minLayer),
49     maxLayer_(maxLayer)
53 // Construct from dictionary
54 Foam::enginePiston::enginePiston
56     const polyMesh& mesh,
57     const dictionary& dict
60     mesh_(mesh),
61     engineDB_(refCast<const engineTime>(mesh_.time())),
62     patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
63     csPtr_
64     (
65         coordinateSystem::New
66         (
67             "coordinateSystem",
68             dict.subDict("coordinateSystem")
69         )
70     ),
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 // ************************************************************************* //