specieElementI.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) 2016 OpenFOAM Foundation
9  Copyright (C) 2020 OpenCFD Ltd.
10 -------------------------------------------------------------------------------
11 License
12  This file is part of OpenFOAM.
13 
14  OpenFOAM is free software: you can redistribute it and/or modify it
15  under the terms of the GNU General Public License as published by
16  the Free Software Foundation, either version 3 of the License, or
17  (at your option) any later version.
18 
19  OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
20  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
21  FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22  for more details.
23 
24  You should have received a copy of the GNU General Public License
25  along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "token.H"
30 
31 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32 
34 :
35  name_(),
36  nAtoms_(0)
37 {}
38 
39 
40 inline Foam::specieElement::specieElement(const word& name, const label nAtoms)
41 :
42  name_(name),
43  nAtoms_(nAtoms)
44 {}
45 
46 
48 :
49  name_(is),
50  nAtoms_(readLabel(is))
51 {}
52 
53 
54 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
55 
56 inline const Foam::word& Foam::specieElement::name() const
57 {
58  return name_;
59 }
60 
61 
63 {
64  return name_;
65 }
66 
67 
68 inline Foam::label Foam::specieElement::nAtoms() const
69 {
70  return nAtoms_;
71 }
72 
73 
74 inline Foam::label& Foam::specieElement::nAtoms()
75 {
76  return nAtoms_;
77 }
78 
79 
80 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
81 
82 inline bool Foam::specieElement::operator==(const specieElement& se) const
83 {
84  return
85  (
86  nAtoms_ == se.nAtoms_
87  && name_ == se.name_
88  );
89 }
90 
91 
92 inline bool Foam::specieElement::operator!=(const specieElement& se) const
93 {
94  return !operator==(se);
95 }
96 
97 
98 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
99 
100 inline Foam::Ostream& Foam::operator<<(Ostream& os, const specieElement& se)
101 {
102  os << se.name() << token::SPACE << se.nAtoms();
103  return os;
104 }
105 
106 
107 // ************************************************************************* //
bool operator!=(const specieElement &) const
Inequality comparison.
virtual const fileName & name() const override
Read/write access to the name of the stream.
Definition: OSstream.H:128
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Definition: Istream.H:57
specieElement()
Default construct.
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:63
bool operator==(const specieElement &) const
Equality comparison.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
Definition: exprTraits.C:127
A class for handling words, derived from Foam::string.
Definition: word.H:63
const word & name() const
Return the name of the element.
Space [isspace].
Definition: token.H:131
label nAtoms() const
Return the number of atoms of this element in the specie.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
Definition: Ostream.H:56
OBJstream os(runTime.globalPath()/outputName)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:77
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)