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/>.
26
27\*---------------------------------------------------------------------------*/
28
29#include "token.H"
30
31// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
32
34:
35 name_(),
36 nAtoms_(0)
37{}
38
39
40inline 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
68inline Foam::label Foam::specieElement::nAtoms() const
69{
70 return nAtoms_;
71}
72
73
74inline Foam::label& Foam::specieElement::nAtoms()
75{
76 return nAtoms_;
77}
78
79
80// * * * * * * * * * * * * * * * Member Operators * * * * * * * * * * * * * //
81
83{
84 return
85 (
86 nAtoms_ == se.nAtoms_
87 && name_ == se.name_
88 );
89}
90
91
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// ************************************************************************* //
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:64
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:62
friend bool operator!=(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:106
friend bool operator==(const refineCell &rc1, const refineCell &rc2)
Definition: refineCell.H:97
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.
@ SPACE
Space [isspace].
Definition: token.H:125
A class for handling words, derived from Foam::string.
Definition: word.H:68
OBJstream os(runTime.globalPath()/outputName)
label readLabel(const char *buf)
Parse entire buffer as a label, skipping leading/trailing whitespace.
Definition: label.H:66
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Definition: boundaryPatch.C:83
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
Definition: exprTraits.C:59