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-2020 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 #include "engineTime.H"
28 #include "polyMesh.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 (
34  const polyMesh& mesh,
35  const word& pistonPatchName,
36  const autoPtr<coordinateSystem>& pistonCS,
37  const scalar minLayer,
38  const scalar maxLayer
39 )
40 :
41  mesh_(mesh),
42  engineDB_(refCast<const engineTime>(mesh.time())),
43  patchID_(pistonPatchName, mesh.boundaryMesh()),
44  csPtr_(pistonCS),
45  minLayer_(minLayer),
46  maxLayer_(maxLayer)
47 {}
48 
49 
51 (
52  const polyMesh& mesh,
53  const dictionary& dict
54 )
55 :
56  mesh_(mesh),
57  engineDB_(refCast<const engineTime>(mesh_.time())),
58  patchID_(dict.lookup("patch"), mesh.boundaryMesh()),
59  csPtr_
60  (
62  (
63  mesh_,
64  dict.subDict("coordinateSystem")
65  )
66  ),
67  minLayer_(dict.lookup<scalar>("minLayer")),
68  maxLayer_(dict.lookup<scalar>("maxLayer"))
69 {}
70 
71 
72 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
73 
75 {
76  os << nl << token::BEGIN_BLOCK
77  << "patch " << patchID_.name() << token::END_STATEMENT << nl
78  << "minLayer " << minLayer_ << token::END_STATEMENT << nl
79  << "maxLayer " << maxLayer_ << token::END_STATEMENT << nl
80  << token::END_BLOCK << endl;
81 }
82 
83 
84 // ************************************************************************* //
const polyBoundaryMesh & boundaryMesh() const
Return boundary mesh.
Definition: polyMesh.H:434
enginePiston(const polyMesh &mesh, const word &pistonPatchName, const autoPtr< coordinateSystem > &pistonCS, const scalar minLayer, const scalar maxLayer)
Construct from components.
Definition: enginePiston.C:33
A list of keyword definitions, which are a keyword followed by any number of values (e...
Definition: dictionary.H:156
Ostream & endl(Ostream &os)
Add newline and flush stream.
Definition: Ostream.H:251
const dictionary & subDict(const word &) const
Find and return a sub-dictionary.
Definition: dictionary.C:982
autoPtr< BasicCompressibleMomentumTransportModel > New(const volScalarField &rho, const volVectorField &U, const surfaceScalarField &phi, const typename BasicCompressibleMomentumTransportModel::transportModel &transport)
A class for handling words, derived from string.
Definition: word.H:59
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:54
void writeDict(Ostream &) const
Write dictionary.
Definition: enginePiston.C:74
static const char nl
Definition: Ostream.H:260
const Time & time() const
Return time.
An auto-pointer similar to the STL auto_ptr but with automatic casting to a reference to the type and...
Definition: PtrList.H:52
Mesh consisting of general polyhedral cells.
Definition: polyMesh.H:74
const wordRe & name() const
Return name.
Definition: DynamicID.H:95
ITstream & lookup(const word &, bool recursive=false, bool patternMatch=true) const
Find and return an entry data stream.
Definition: dictionary.C:844