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 -------------------------------------------------------------------------------
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 \*---------------------------------------------------------------------------*/
27 
28 #include "token.H"
29 
30 // * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
31 
33 {}
34 
35 
36 inline Foam::specieElement::specieElement(const word& name, const label nAtoms)
37 :
38  name_(name),
39  nAtoms_(nAtoms)
40 {}
41 
42 
44 :
45  name_(is),
46  nAtoms_(readLabel(is))
47 {}
48 
49 
50 // * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
51 
53 {
54  return name_;
55 }
56 
57 
59 {
60  return name_;
61 }
62 
63 
65 {
66  return nAtoms_;
67 }
68 
69 
71 {
72  return nAtoms_;
73 }
74 
75 
76 // * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
77 
78 inline bool Foam::specieElement::operator==(const specieElement& se) const
79 {
80  return
81  (
82  nAtoms_ == se.nAtoms_
83  && name_ == se.name_
84  );
85 }
86 
87 
88 inline bool Foam::specieElement::operator!=(const specieElement& se) const
89 {
90  return !operator==(se);
91 }
92 
93 
94 // * * * * * * * * * * * * * * * Ostream Operator * * * * * * * * * * * * * //
95 
97 {
98  os << se.name() << token::SPACE << se.nAtoms();
99  return os;
100 }
101 
102 
103 // ************************************************************************* //
token.H
Foam::word
A class for handling words, derived from Foam::string.
Definition: word.H:62
Foam::specieElement::name
const word & name() const
Return the name of the element.
Definition: specieElementI.H:52
Foam::specieElement::specieElement
specieElement()
Construct null.
Definition: specieElementI.H:32
Foam::specieElement::nAtoms
label nAtoms() const
Return the number of atoms of this element in the specie.
Definition: specieElementI.H:64
Foam::label
intWM_LABEL_SIZE_t label
A label is an int32_t or int64_t as specified by the pre-processor macro WM_LABEL_SIZE.
Definition: label.H:62
Foam::specieElement::operator==
bool operator==(const specieElement &) const
Equality comparison.
Definition: specieElementI.H:78
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
Foam::name
word name(const complex &c)
Return string representation of complex.
Definition: complex.C:76
Foam::readLabel
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:70
Foam::token::SPACE
Space [isspace].
Definition: token.H:112
Foam::specieElement
Definition: specieElement.H:54
Foam::specieElement::operator!=
bool operator!=(const specieElement &) const
Inequality comparison.
Definition: specieElementI.H:88
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:56
Foam::operator<<
Ostream & operator<<(Ostream &, const boundaryPatch &)
Definition: boundaryPatch.C:102