enginePiston.C
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
4  \\ / O peration |
5  \\ / A nd | www.openfoam.com
6  \\/ M anipulation |
7 -------------------------------------------------------------------------------
8  Copyright (C) 2011-2013 OpenFOAM Foundation
9 -------------------------------------------------------------------------------
10 License
11  This file is part of OpenFOAM.
12 
13  OpenFOAM is free software: you can redistribute it and/or modify it
14  under the terms of the GNU General Public License as published by
15  the Free Software Foundation, either version 3 of the License, or
16  (at your option) any later version.
17 
18  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
19  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
20  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21  for more details.
22 
23  You should have received a copy of the GNU General Public License
24  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 
26 \*---------------------------------------------------------------------------*/
27 
28 #include "enginePiston.H"
29 #include "engineTime.H"
30 #include "polyMesh.H"
31 #include "interpolateXY.H"
32 
33 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
34 
35 Foam::enginePiston::enginePiston
36 (
37  const polyMesh& mesh,
38  const word& pistonPatchName,
39  const autoPtr<coordinateSystem>& pistonCS,
40  const scalar minLayer,
41  const scalar maxLayer
42 )
43 :
44  mesh_(mesh),
45  engineDB_(refCast<const engineTime>(mesh.time())),
46  patchID_(pistonPatchName, mesh.boundaryMesh()),
47  csysPtr_(pistonCS),
48  minLayer_(minLayer),
49  maxLayer_(maxLayer)
50 {}
51 
52 
53 Foam::enginePiston::enginePiston
54 (
55  const polyMesh& mesh,
56  const dictionary& dict
57 )
58 :
59  mesh_(mesh),
60  engineDB_(refCast<const engineTime>(mesh_.time())),
61  patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
62  csysPtr_
63  (
64  coordinateSystem::New(mesh_, dict, coordinateSystem::typeName_())
65  ),
66  minLayer_(dict.get<scalar>("minLayer")),
67  maxLayer_(dict.get<scalar>("maxLayer"))
68 {}
69 
70 
71 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
72 
74 {
76  << "patch " << patchID_.name() << token::END_STATEMENT << nl
77  << "minLayer " << minLayer_ << token::END_STATEMENT << nl
78  << "maxLayer " << maxLayer_ << token::END_STATEMENT << nl
79  << token::END_BLOCK << endl;
80 }
81 
82 
83 // ************************************************************************* //
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::endl
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:369
polyMesh.H
Foam::polyMesh
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:77
Foam::DynamicID::name
const wordRe & name() const noexcept
The selector name.
Definition: DynamicID.H:111
Foam::enginePiston::writeDict
void writeDict(Ostream &) const
Write dictionary.
Definition: enginePiston.C:73
interpolateXY.H
Interpolates y values from one curve to another with a different x distribution.
Foam::token::END_STATEMENT
End entry [isseparator].
Definition: token.H:154
Foam::token::END_BLOCK
End block [isseparator].
Definition: token.H:160
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:123
os
OBJstream os(runTime.globalPath()/outputName)
mesh
dynamicFvMesh & mesh
Definition: createDynamicFvMesh.H:6
Foam::token::BEGIN_BLOCK
Begin block [isseparator].
Definition: token.H:159
Foam::New
tmp< DimensionedField< TypeR, GeoMesh > > New(const tmp< DimensionedField< TypeR, GeoMesh >> &tdf1, const word &name, const dimensionSet &dimensions)
Global function forwards to reuseTmpDimensionedField::New.
Definition: DimensionedFieldReuseFunctions.H:105
Foam::autoPtr
Pointer management similar to std::unique_ptr, with some additional methods and type checking.
Definition: HashPtrTable.H:53
Foam::nl
constexpr char nl
Definition: Ostream.H:404
engineTime.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
enginePiston.H