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 
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 
101 {
102  os << se.name() << token::SPACE << se.nAtoms();
103  return os;
104 }
105 
106 
107 // ************************************************************************* //
token.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:65
Foam::specieElement::name
const word & name() const
Return the name of the element.
Definition: specieElementI.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
Foam::specieElement::specieElement
specieElement()
Default construct.
Definition: specieElementI.H:33
Foam::specieElement::nAtoms
label nAtoms() const
Return the number of atoms of this element in the specie.
Definition: specieElementI.H:68
Foam::specieElement::operator==
bool operator==(const specieElement &) const
Equality comparison.
Definition: specieElementI.H:82
Foam::operator==
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:61
os
OBJstream os(runTime.globalPath()/outputName)
Foam::readLabel
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
Foam::token::SPACE
Space [isspace].
Definition: token.H:125
Foam::specieElement
Definition: specieElement.H:55
Foam::specieElement::operator!=
bool operator!=(const specieElement &) const
Inequality comparison.
Definition: specieElementI.H:92
Foam::name
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56