Loading...
Searching...
No Matches
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-------------------------------------------------------------------------------
11License
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/>.
27\*---------------------------------------------------------------------------*/
28
29#include "token.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
34:
35 name_(),
36 nAtoms_(0)
37{}
38
39
41:
42 name_(name),
43 nAtoms_(nAtoms)
44{}
45
46
48:
49 name_(is),
50 nAtoms_(readLabel(is))
51{}
52
53
54// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
56inline const Foam::word& Foam::specieElement::name() const
57{
58 return name_;
59}
60
63{
64 return name_;
65}
66
68inline Foam::label Foam::specieElement::nAtoms() const
69{
70 return nAtoms_;
71}
72
73
74inline Foam::label& Foam::specieElement::nAtoms()
76 return nAtoms_;
77}
78
79
80// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
81
82inline bool Foam::specieElement::operator==(const specieElement& se) const
83{
84 return
85 (
86 nAtoms_ == se.nAtoms_
87 && name_ == se.name_
88 );
89}
90
91
92inline bool Foam::specieElement::operator!=(const specieElement& se) const
94 return !operator==(se);
95}
96
97
98// * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
99
100inline 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// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition Istream.H:60
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition Ostream.H:59
bool operator==(const specieElement &) const
Equality comparison.
label nAtoms() const
Return the number of atoms of this element in the specie.
specieElement()
Default construct.
const word & name() const
Return the name of the element.
bool operator!=(const specieElement &) const
Inequality comparison.
@ SPACE
Space [isspace].
Definition token.H:144
A class for handling words, derived from Foam::string.
Definition word.H:66
OBJstream os(runTime.globalPath()/outputName)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition label.H:63
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces).
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)