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 -------------------------------------------------------------------------------
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 Class
27  Foam::substance
28 
29 Description
30 
31 SourceFiles
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 
47 namespace Foam
48 {
49 
50 /*---------------------------------------------------------------------------*\
51  Class substance Declaration
52 \*---------------------------------------------------------------------------*/
53 
54 class substance
55 {
56  // Private data
57 
58  word name_;
59  scalar volFrac_;
60 
61 
62 public:
63 
64  // Constructors
65 
66  //- Construct null
67  substance()
68  {}
69 
70 
71  // Member Functions
72 
73  // Access
74 
75  const word& name() const
76  {
77  return name_;
78  }
79 
80  scalar volFrac() const
81  {
82  return volFrac_;
83  }
84 
85  bool operator==(const substance& s) const
86  {
87  return name_ == s.name_ && volFrac_ == s.volFrac_;
88  }
89 
90  bool operator!=(const substance& s) const
91  {
92  return !operator==(s);
93  }
94 
95 
96  // IOstream Operators
97 
98  friend Istream& operator>>(Istream& is, substance& s)
99  {
100  is >> s.name_ >> s.volFrac_;
101  return is;
102  }
103 
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 // ************************************************************************* //
Foam::substance
Definition: substance.H:53
Foam::substance::operator==
bool operator==(const substance &s) const
Definition: substance.H:84
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
s
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))
Definition: gmvOutputSpray.H:25
Foam::substance::operator>>
friend Istream & operator>>(Istream &is, substance &s)
Definition: substance.H:97
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
Istream.H
scalar.H
os
OBJstream os(runTime.globalPath()/outputName)
Foam
Namespace for OpenFOAM.
Definition: atmBoundaryLayer.C:33
Foam::substance::operator!=
bool operator!=(const substance &s) const
Definition: substance.H:89
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
Foam::substance::name
const word & name() const
Definition: substance.H:74
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
word.H
Foam::substance::volFrac
scalar volFrac() const
Definition: substance.H:79
Foam::substance::substance
substance()
Construct null.
Definition: substance.H:66
Foam::substance::operator<<
friend Ostream & operator<<(Ostream &os, const substance &s)
Definition: substance.H:103