specie.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-2017 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 "specie.H"
29 #include "constants.H"
30 
31 /* * * * * * * * * * * * * * * public constants * * * * * * * * * * * * * * */
32 
33 namespace Foam
34 {
35  defineTypeNameAndDebug(specie, 0);
36 }
37 
38 
39 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
40 
42 :
43  name_(dict.dictName()),
44  Y_(dict.subDict("specie").lookupOrDefault<scalar>("massFraction", 1)),
45  molWeight_(dict.subDict("specie").get<scalar>("molWeight"))
46 {}
47 
48 
49 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
50 
52 {
53  // Entries in dictionary format
54  {
55  os.beginBlock("specie");
56  os.writeEntryIfDifferent<scalar>("massFraction", 1, Y_);
57  os.writeEntry("molWeight", molWeight_);
58  os.endBlock();
59  }
60 }
61 
62 
63 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
64 
66 {
67  st.write(os);
68  os.check(FUNCTION_NAME);
69  return os;
70 }
71 
72 
73 // ************************************************************************* //
Foam::Ostream::writeEntryIfDifferent
Ostream & writeEntryIfDifferent(const word &key, const T &value1, const T &value2)
Write a keyword/value entry only when the two values differ.
Definition: Ostream.H:231
Foam::specie::write
void write(Ostream &os) const
Write to Ostream.
Definition: specie.C:51
dictName
const word dictName("blockMeshDict")
Foam::Ostream::beginBlock
virtual Ostream & beginBlock(const keyType &kw)
Write begin block group with the given name.
Definition: Ostream.C:91
specie.H
Foam::specie
Base class of the thermophysical property types.
Definition: specie.H:67
dict
dictionary dict
Definition: searchingEngine.H:14
Foam::Ostream::endBlock
virtual Ostream & endBlock()
Write end block group.
Definition: Ostream.C:109
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:51
Foam::dictionary
A list of keyword definitions, which are a keyword followed by a number of values (eg,...
Definition: dictionary.H:121
Foam::specie::specie
specie(const scalar Y, const scalar molWeight)
Construct from components without name.
Definition: specieI.H:51
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
constants.H
FUNCTION_NAME
#define FUNCTION_NAME
Definition: messageStream.H:261
Foam::Ostream::writeEntry
Ostream & writeEntry(const keyType &key, const T &value)
Write a keyword/value entry.
Definition: Ostream.H:219
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::defineTypeNameAndDebug
defineTypeNameAndDebug(combustionModel, 0)
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102