enginePiston.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-2021 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 "enginePiston.H"
27 
28 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
29 
31 (
32  const fvMeshMover& meshMover,
33  const word& pistonPatchName,
34  const autoPtr<coordinateSystem>& pistonCS,
35  const scalar minLayer,
36  const scalar maxLayer
37 )
38 :
39  meshMover_(refCast<const fvMeshMovers::engine>(meshMover)),
40  patchID_(pistonPatchName, meshMover_.mesh().boundaryMesh()),
41  csPtr_(pistonCS),
42  minLayer_(minLayer),
43  maxLayer_(maxLayer)
44 {}
45 
46 
48 (
49  const fvMeshMover& meshMover,
50  const dictionary& dict
51 )
52 :
53  meshMover_(refCast<const fvMeshMovers::engine>(meshMover)),
54  patchID_(dict.lookup("patch"), meshMover_.mesh().boundaryMesh()),
55  csPtr_
56  (
58  (
59  meshMover_.mesh(),
60  dict.subDict("coordinateSystem")
61  )
62  ),
63  minLayer_(dict.lookup<scalar>("minLayer")),
64  maxLayer_(dict.lookup<scalar>("maxLayer"))
65 {}
66 
67 
68 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
69 
71 {
72  os << nl << token::BEGIN_BLOCK
73  << "patch " << patchID_.name() << token::END_STATEMENT << nl
74  << "minLayer " << minLayer_ << token::END_STATEMENT << nl
75  << "maxLayer " << maxLayer_ << token::END_STATEMENT << nl
76  << token::END_BLOCK << endl;
77 }
78 
79 
80 // ************************************************************************* //
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:57
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: autoPtr.H:51
Base class for other coordinate system specifications.
A list of keyword definitions, which are a keyword followed by any number of values (e....
Definition: dictionary.H:160
enginePiston(const fvMeshMover &meshMover, const word &pistonPatchName, const autoPtr< coordinateSystem > &pistonCS, const scalar minLayer, const scalar maxLayer)
Construct from components.
Definition: enginePiston.C:31
void writeDict(Ostream &) const
Write dictionary.
Definition: enginePiston.C:70
Abstract base class for fvMesh movers.
Definition: fvMeshMover.H:53
@ BEGIN_BLOCK
Definition: token.H:110
@ END_BLOCK
Definition: token.H:111
@ END_STATEMENT
Definition: token.H:105
A class for handling words, derived from string.
Definition: word.H:62
To & refCast(From &r)
Reference type cast template function.
Definition: typeInfo.H:111
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
static const char nl
Definition: Ostream.H:260
dictionary dict