substance.H
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 OpenFOAM Foundation
9-------------------------------------------------------------------------------
10License
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
26Class
27 Foam::substance
28
29Description
30
31SourceFiles
32 substanceI.H
33 substance.C
34 substanceIO.C
35
36\*---------------------------------------------------------------------------*/
37
38#ifndef substance_H
39#define substance_H
40
41#include "scalar.H"
42#include "word.H"
43#include "Istream.H"
44
45// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
46
47namespace Foam
48{
49
50/*---------------------------------------------------------------------------*\
51 Class substance Declaration
52\*---------------------------------------------------------------------------*/
54class substance
55{
56 // Private data
57
58 word name_;
59 scalar volFrac_;
60
61
62public:
63
64 // Constructors
65
66 //- Construct null
67 substance()
68 {}
69
70
71 // Member Functions
72
73 // Access
75 const word& name() const
76 {
77 return name_;
78 }
80 scalar volFrac() const
81 {
82 return volFrac_;
83 }
85 bool operator==(const substance& s) const
86 {
87 return name_ == s.name_ && volFrac_ == s.volFrac_;
88 }
90 bool operator!=(const substance& s) const
91 {
92 return !operator==(s);
93 }
94
95
96 // IOstream Operators
98 friend Istream& operator>>(Istream& is, substance& s)
99 {
100 is >> s.name_ >> s.volFrac_;
101 return is;
102 }
104 friend Ostream& operator<<(Ostream& os, const substance& s)
105 {
106 os << s.name_ << token::SPACE << s.volFrac_;
107 return os;
108 }
109};
110
111
112// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
113
114} // End namespace Foam
115
116// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
117
118#endif
119
120// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
bool operator!=(const substance &s) const
Definition: substance.H:89
const word & name() const
Definition: substance.H:74
friend Ostream & operator<<(Ostream &os, const substance &s)
Definition: substance.H:103
bool operator==(const substance &s) const
Definition: substance.H:84
scalar volFrac() const
Definition: substance.H:79
friend Istream & operator>>(Istream &is, substance &s)
Definition: substance.H:97
substance()
Construct null.
Definition: substance.H:66
@ SPACE
Space [isspace].
Definition: token.H:125
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Namespace for OpenFOAM.