1 /*---------------------------------------------------------------------------*\
3 \\ / F ield | cfMesh: A library for mesh generation
5 \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6 \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
9 This file is part of cfMesh.
11 cfMesh is free software; you can redistribute it and/or modify it
12 under the terms of the GNU General Public License as published by the
13 Free Software Foundation; either version 3 of the License, or (at your
14 option) any later version.
16 cfMesh is distributed in the hope that it will be useful, but WITHOUT
17 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
21 You should have received a copy of the GNU General Public License
22 along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
28 A class containing point label and its coordinates. It is used for
29 exchanging data over processors
33 \*---------------------------------------------------------------------------*/
35 #ifndef labelledScalar_H
36 #define labelledScalar_H
40 #include "contiguous.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class labelledScalar Declaration
49 \*---------------------------------------------------------------------------*/
70 //- Construct from label and value
71 labelledScalar(const label sl, const scalar s)
82 //- return scalar label
83 inline label scalarLabel() const
89 inline const scalar& value() const
96 inline void operator=(const labelledScalar& ls)
102 inline bool operator==(const labelledScalar& ls) const
104 if( sLabel_ == ls.sLabel_ )
110 inline bool operator<(const labelledScalar& ls) const
112 if( value_ < ls.value_ )
118 inline bool operator<=(const labelledScalar& ls) const
120 if( value_ <= ls.value_ )
126 inline bool operator>(const labelledScalar& ls) const
128 if( value_ > ls.value_ )
134 inline bool operator>=(const labelledScalar& ls) const
136 if( value_ >= ls.value_ )
142 inline bool operator!=(const labelledScalar& ls) const
144 return !this->operator==(ls);
148 friend Ostream& operator<<(Ostream& os, const labelledScalar& ls)
150 os << token::BEGIN_LIST;
151 os << ls.sLabel_ << token::SPACE;
152 os << ls.value_ << token::END_LIST;
154 // Check state of Ostream
155 os.check("operator<<(Ostream&, const labelledScalar&");
160 friend Istream& operator>>(Istream& is, labelledScalar& ls)
162 // Read beginning of labelledScalar
163 is.readBegin("labelledScalar");
168 // Read end of labelledScalar
169 is.readEnd("labelledScalar");
171 // Check state of Istream
172 is.check("operator>>(Istream&, labelledScalar");
178 //- Specify data associated with labelledScalar type is contiguous
180 inline bool contiguous<labelledScalar>() {return true;}
182 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
184 } // End namespace Foam
186 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
190 // ************************************************************************* //