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 a label, coordinates and scalar. It is used for
29 exchanging data over processors
33 \*---------------------------------------------------------------------------*/
35 #ifndef labelledPointScalar_H
36 #define labelledPointScalar_H
40 #include "contiguous.H"
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
47 /*---------------------------------------------------------------------------*\
48 Class labelledPointScalar Declaration
49 \*---------------------------------------------------------------------------*/
51 class labelledPointScalar
70 coords_(vector::zero),
74 //- Construct from point and label
75 labelledPointScalar(const label pl, const point& p, const scalar s)
83 ~labelledPointScalar()
87 //- return point label
88 inline label pointLabel() const
93 inline label& pointLabel()
98 //- return point coordinates
99 inline const point& coordinates() const
104 inline point& coordinates()
109 //- return scalar value
110 inline const scalar& scalarValue() const
115 inline scalar& scalarValue()
122 inline void operator=(const labelledPointScalar& lps)
124 pLabel_ = lps.pLabel_;
125 coords_ = lps.coords_;
126 weight_ = lps.weight_;
129 inline bool operator==(const labelledPointScalar& lps) const
131 if( pLabel_ == lps.pLabel_ )
137 inline bool operator!=(const labelledPointScalar& lps) const
139 return !this->operator==(lps);
143 friend Ostream& operator<<(Ostream& os, const labelledPointScalar& lps)
145 os << token::BEGIN_LIST;
146 os << lps.pLabel_ << token::SPACE;
147 os << lps.coords_ << token::SPACE;
148 os << lps.weight_ << token::END_LIST;
150 // Check state of Ostream
151 os.check("operator<<(Ostream&, const labelledPointScalarS&");
156 friend Istream& operator>>(Istream& is, labelledPointScalar& lps)
158 // Read beginning of labelledPointScalar
159 is.readBegin("labelledPointScalar");
165 // Read end of labelledPointScalar
166 is.readEnd("labelledPointScalar");
168 // Check state of Istream
169 is.check("operator>>(Istream&, labelledPointScalar");
175 //- Specify data associated with labelledPointScalar type is contiguous
177 inline bool contiguous<labelledPointScalar>() {return true;}
179 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 } // End namespace Foam
183 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
187 // ************************************************************************* //