labelledMeshOctreeCubeCoordinates.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  labelledMeshOctreeCubeCoordinates
26 
27 Description
28  A class containing point label and meshOctreeCubeCoordinates.
29  It is used for exchanging data over processors
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef labelledMeshOctreeCubeCoordinates_H
36 #define labelledMeshOctreeCubeCoordinates_H
37 
38 #include "label.H"
40 #include "contiguous.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class labelledMeshOctreeCubeCoordinates Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53  // Private data
54  //- label
55  label cLabel_;
56 
57  //- cube coordinates
59 
60  public:
61 
62  // Constructors
63  //- Null construct
65  :
66  cLabel_(-1),
67  coordinates_()
68  {}
69 
70  //- Construct from label and cube coordinates
72  (
73  const label cl,
75  )
76  :
77  cLabel_(cl),
78  coordinates_(cc)
79  {}
80 
81  // Destructor
83  {}
84 
85  // Member functions
86  //- return cube label
87  inline label cubeLabel() const
88  {
89  return cLabel_;
90  }
91 
92  //- return the value
93  inline const meshOctreeCubeCoordinates& coordinates() const
94  {
95  return coordinates_;
96  }
97 
98  // Member operators
99 
100  inline void operator=(const labelledMeshOctreeCubeCoordinates& lcc)
101  {
102  cLabel_ = lcc.cLabel_;
104  }
105 
106  inline bool operator==
107  (
109  ) const
110  {
111  if( cLabel_ == lcc.cLabel_ )
112  return true;
113 
114  return false;
115  }
116 
117  inline bool operator!=
118  (
120  ) const
121  {
122  return !this->operator==(lcc);
123  }
124 
125  // Friend operators
126  friend Ostream& operator<<
127  (
128  Ostream& os,
130  )
131  {
132  os << token::BEGIN_LIST;
133  os << lcc.cLabel_ << token::SPACE;
134  os << lcc.coordinates_ << token::END_LIST;
135 
136  // Check state of Ostream
137  os.check
138  (
139  "operator<<(Ostream&, const labelledMeshOctreeCubeCoordinates&"
140  );
141 
142  return os;
143  }
144 
145  friend Istream& operator>>
146  (
147  Istream& is,
149  )
150  {
151  // Read beginning of labelledMeshOctreeCubeCoordinates
152  is.readBegin("labelledMeshOctreeCubeCoordinates");
153 
154  is >> lcc.cLabel_;
155  is >> lcc.coordinates_;
156 
157  // Read end of labelledMeshOctreeCubeCoordinates
158  is.readEnd("labelledMeshOctreeCubeCoordinates");
159 
160  // Check state of Istream
161  is.check("operator>>(Istream&, labelledMeshOctreeCubeCoordinates");
162 
163  return is;
164  }
165 };
166 
167 //- Specify data associated with labelledMeshOctreeCubeCoordinates
168 //- type is contiguous
169 template<>
170 inline bool contiguous<labelledMeshOctreeCubeCoordinates>() {return true;}
171 
172 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
173 
174 } // End namespace Foam
175 
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
177 
178 #endif
179 
180 // ************************************************************************* //
Foam::labelledMeshOctreeCubeCoordinates::cLabel_
label cLabel_
label
Definition: labelledMeshOctreeCubeCoordinates.H:54
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
Foam::labelledMeshOctreeCubeCoordinates::operator==
bool operator==(const labelledMeshOctreeCubeCoordinates &lcc) const
Definition: labelledMeshOctreeCubeCoordinates.H:106
Foam::meshOctreeCubeCoordinates
Definition: meshOctreeCubeCoordinates.H:55
Foam::labelledMeshOctreeCubeCoordinates::coordinates
const meshOctreeCubeCoordinates & coordinates() const
return the value
Definition: labelledMeshOctreeCubeCoordinates.H:92
Foam::labelledMeshOctreeCubeCoordinates::cubeLabel
label cubeLabel() const
return cube label
Definition: labelledMeshOctreeCubeCoordinates.H:86
Foam::labelledMeshOctreeCubeCoordinates::coordinates_
meshOctreeCubeCoordinates coordinates_
cube coordinates
Definition: labelledMeshOctreeCubeCoordinates.H:57
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
meshOctreeCubeCoordinates.H
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam::labelledMeshOctreeCubeCoordinates
Definition: labelledMeshOctreeCubeCoordinates.H:50
Foam::labelledMeshOctreeCubeCoordinates::~labelledMeshOctreeCubeCoordinates
~labelledMeshOctreeCubeCoordinates()
Definition: labelledMeshOctreeCubeCoordinates.H:81
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
Foam::labelledMeshOctreeCubeCoordinates::labelledMeshOctreeCubeCoordinates
labelledMeshOctreeCubeCoordinates()
Null construct.
Definition: labelledMeshOctreeCubeCoordinates.H:63
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
label.H
contiguous.H
Template function to specify if the data of a type are contiguous.
Foam::labelledMeshOctreeCubeCoordinates::operator=
void operator=(const labelledMeshOctreeCubeCoordinates &lcc)
Definition: labelledMeshOctreeCubeCoordinates.H:99
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::contiguous< labelledMeshOctreeCubeCoordinates >
bool contiguous< labelledMeshOctreeCubeCoordinates >()
Definition: labelledMeshOctreeCubeCoordinates.H:169
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95