refLabelledPointScalar.H
Go to the documentation of this file.
1 /*---------------------------------------------------------------------------*\
2  ========= |
3  \\ / F ield | cfMesh: A library for mesh generation
4  \\ / O peration |
5  \\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
6  \\/ M anipulation | Copyright (C) Creative Fields, Ltd.
7 -------------------------------------------------------------------------------
8 License
9  This file is part of cfMesh.
10 
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.
15 
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
19  for more details.
20 
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/>.
23 
24 Class
25  refLabelledPointScalar
26 
27 Description
28  A class containing a label and labelledPointScalar. It is used for
29  exchanging data over processors
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef refLabelledPointScalar_H
36 #define refLabelledPointScalar_H
37 
38 #include "labelledPointScalar.H"
39 
40 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
41 
42 namespace Foam
43 {
44 
45 /*---------------------------------------------------------------------------*\
46  Class refLabelledPointScalar Declaration
47 \*---------------------------------------------------------------------------*/
48 
50 {
51  // Private data
52  //- point label
53  label pLabel_;
54 
55  //- labelledPointScalar
57 
58  public:
59 
60  // Constructors
61  //- Null construct
63  :
64  pLabel_(-1),
65  lps_()
66  {}
67 
68  //- Construct from label and labelledPointScalar
70  :
71  pLabel_(pl),
72  lps_(lps)
73  {}
74 
75  // Destructor
77  {}
78 
79  // Member functions
80  //- return object label
81  inline label objectLabel() const
82  {
83  return pLabel_;
84  }
85 
86  //- return labelledPointScalar
87  inline const labelledPointScalar& lps() const
88  {
89  return lps_;
90  }
91 
92  // Member operators
93 
94  inline void operator=(const refLabelledPointScalar& lps)
95  {
97  lps_ = lps.lps_;
98  }
99 
100  inline bool operator==(const refLabelledPointScalar& lps) const
101  {
102  if( pLabel_ == lps.pLabel_ )
103  return true;
104 
105  return false;
106  }
107 
108  inline bool operator!=(const refLabelledPointScalar& lps) const
109  {
110  return !this->operator==(lps);
111  }
112 
113  // Friend operators
115  {
116  os << token::BEGIN_LIST;
117  os << lps.pLabel_ << token::SPACE;
118  os << lps.lps_ << token::END_LIST;
119 
120  // Check state of Ostream
121  os.check("operator<<(Ostream&, const labelledPointScalarS&");
122 
123  return os;
124  }
125 
127  {
128  // Read beginning of refLabelledPointScalar
129  is.readBegin("refLabelledPointScalar");
130 
131  is >> lps.pLabel_;
132  is >> lps.lps_;
133 
134  // Read end of refLabelledPointScalar
135  is.readEnd("refLabelledPointScalar");
136 
137  // Check state of Istream
138  is.check("operator>>(Istream&, refLabelledPointScalar");
139 
140  return is;
141  }
142 };
143 
144 //- Specify data associated with refLabelledPointScalar type is contiguous
145 template<>
146 inline bool contiguous<refLabelledPointScalar>() {return true;}
147 
148 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
149 
150 } // End namespace Foam
151 
152 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
153 
154 #endif
155 
156 // ************************************************************************* //
Foam::refLabelledPointScalar::operator>>
friend Istream & operator>>(Istream &is, refLabelledPointScalar &lps)
Definition: refLabelledPointScalar.H:125
Foam::refLabelledPointScalar::~refLabelledPointScalar
~refLabelledPointScalar()
Definition: refLabelledPointScalar.H:75
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
Foam::refLabelledPointScalar
Definition: refLabelledPointScalar.H:48
Foam::refLabelledPointScalar::pLabel_
label pLabel_
point label
Definition: refLabelledPointScalar.H:52
Foam::refLabelledPointScalar::refLabelledPointScalar
refLabelledPointScalar()
Null construct.
Definition: refLabelledPointScalar.H:61
Foam::refLabelledPointScalar::operator!=
bool operator!=(const refLabelledPointScalar &lps) const
Definition: refLabelledPointScalar.H:107
Foam::refLabelledPointScalar::operator=
void operator=(const refLabelledPointScalar &lps)
Definition: refLabelledPointScalar.H:93
Foam::refLabelledPointScalar::lps_
labelledPointScalar lps_
labelledPointScalar
Definition: refLabelledPointScalar.H:55
Foam::refLabelledPointScalar::operator==
bool operator==(const refLabelledPointScalar &lps) const
Definition: refLabelledPointScalar.H:99
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:59
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::labelledPointScalar::pLabel_
label pLabel_
point label
Definition: labelledPointScalar.H:54
Foam::refLabelledPointScalar::refLabelledPointScalar
refLabelledPointScalar(const label pl, const labelledPointScalar &lps)
Construct from label and labelledPointScalar.
Definition: refLabelledPointScalar.H:68
Foam::contiguous< refLabelledPointScalar >
bool contiguous< refLabelledPointScalar >()
Specify data associated with refLabelledPointScalar type is contiguous.
Definition: refLabelledPointScalar.H:145
Foam::labelledPointScalar
Definition: labelledPointScalar.H:50
Foam::refLabelledPointScalar::objectLabel
label objectLabel() const
return object label
Definition: refLabelledPointScalar.H:80
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::refLabelledPointScalar::lps
const labelledPointScalar & lps() const
return labelledPointScalar
Definition: refLabelledPointScalar.H:86
labelledPointScalar.H
Foam::Ostream
An Ostream is an abstract base class for all output systems (streams, files, token lists,...
Definition: Ostream.H:53
Foam::Istream::readBegin
Istream & readBegin(const char *funcName)
Definition: Istream.C:88
Foam::refLabelledPointScalar::operator<<
friend Ostream & operator<<(Ostream &os, const refLabelledPointScalar &lps)
Definition: refLabelledPointScalar.H:113
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95