meshOctreeCubeCoordinatesScalar.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  meshOctreCubeCoordinatesScalar
26 
27 Description
28  A class containing meshOctreeCubeCoordinates and a scalar value.
29  It is used for exchanging data over processors
30 
31 SourceFiles
32 
33 \*---------------------------------------------------------------------------*/
34 
35 #ifndef meshOctreeCubeCoordinatesScalar_H
36 #define meshOctreeCubeCoordinatesScalar_H
37 
38 #include "scalar.H"
40 #include "contiguous.H"
41 
42 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
43 
44 namespace Foam
45 {
46 
47 /*---------------------------------------------------------------------------*\
48  Class meshOctreeCubeCoordinatesScalar Declaration
49 \*---------------------------------------------------------------------------*/
50 
52 {
53  // Private data
54  //- scalar
55  scalar sValue_;
56 
57  //- cube coordinates
59 
60  public:
61 
62  // Constructors
63  //- Null construct
65  :
66  sValue_(0.0),
67  coordinates_()
68  {}
69 
70  //- Construct from label and cube coordinates
72  (
73  const scalar s,
75  )
76  :
77  sValue_(s),
78  coordinates_(cc)
79  {}
80 
81  // Destructor
83  {}
84 
85  // Member functions
86  //- return cube label
87  inline scalar scalarValue() const
88  {
89  return sValue_;
90  }
91 
92  //- return the value
93  inline const meshOctreeCubeCoordinates& coordinates() const
94  {
95  return coordinates_;
96  }
97 
98  // Member operators
99 
100  inline bool operator<(const meshOctreeCubeCoordinatesScalar& scc) const
101  {
102  if( coordinates_ < scc.coordinates_ )
103  return true;
104 
105  return false;
106  }
107 
108  inline void operator=(const meshOctreeCubeCoordinatesScalar& scc)
109  {
110  sValue_ = scc.sValue_;
112  }
113 
114  inline bool operator==
115  (
117  ) const
118  {
119  if( coordinates_ == scc.coordinates_ )
120  return true;
121 
122  return false;
123  }
124 
125  inline bool operator!=
126  (
128  ) const
129  {
130  return !this->operator==(scc);
131  }
132 
133  // Friend operators
134  friend Ostream& operator<<
135  (
136  Ostream& os,
138  )
139  {
140  os << token::BEGIN_LIST;
141  os << scc.sValue_ << token::SPACE;
142  os << scc.coordinates_ << token::END_LIST;
143 
144  // Check state of Ostream
145  os.check
146  (
147  "operator<<(Ostream&, const meshOctreCubeCoordinatesScalar&"
148  );
149 
150  return os;
151  }
152 
153  friend Istream& operator>>
154  (
155  Istream& is,
157  )
158  {
159  // Read beginning of meshOctreCubeCoordinatesScalar
160  is.readBegin("meshOctreCubeCoordinatesScalar");
161 
162  is >> scc.sValue_;
163  is >> scc.coordinates_;
164 
165  // Read end of meshOctreCubeCoordinatesScalar
166  is.readEnd("meshOctreCubeCoordinatesScalar");
167 
168  // Check state of Istream
169  is.check("operator>>(Istream&, meshOctreCubeCoordinatesScalar");
170 
171  return is;
172  }
173 };
174 
175 //- Specify data associated with meshOctreCubeCoordinatesScalar
176 //- type is contiguous
177 template<>
178 inline bool contiguous<meshOctreeCubeCoordinatesScalar>() {return true;}
179 
180 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
181 
182 } // End namespace Foam
183 
184 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
185 
186 #endif
187 
188 // ************************************************************************* //
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
Foam::meshOctreeCubeCoordinatesScalar::scalarValue
scalar scalarValue() const
return cube label
Definition: meshOctreeCubeCoordinatesScalar.H:86
Foam::contiguous< meshOctreeCubeCoordinatesScalar >
bool contiguous< meshOctreeCubeCoordinatesScalar >()
Definition: meshOctreeCubeCoordinatesScalar.H:177
Foam::meshOctreeCubeCoordinates
Definition: meshOctreeCubeCoordinates.H:55
Foam::meshOctreeCubeCoordinatesScalar::coordinates_
meshOctreeCubeCoordinates coordinates_
cube coordinates
Definition: meshOctreeCubeCoordinatesScalar.H:57
Foam::meshOctreeCubeCoordinatesScalar
Definition: meshOctreeCubeCoordinatesScalar.H:50
Foam::Istream
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Definition: Istream.H:57
Foam::meshOctreeCubeCoordinatesScalar::operator==
bool operator==(const meshOctreeCubeCoordinatesScalar &scc) const
Definition: meshOctreeCubeCoordinatesScalar.H:114
meshOctreeCubeCoordinates.H
Foam::IOstream::check
virtual bool check(const char *operation) const
Check IOstream status for given operation.
Definition: IOstream.C:92
Foam::meshOctreeCubeCoordinatesScalar::~meshOctreeCubeCoordinatesScalar
~meshOctreeCubeCoordinatesScalar()
Definition: meshOctreeCubeCoordinatesScalar.H:81
scalar.H
Foam
Namespace for OpenFOAM.
Definition: combustionModel.C:30
s
gmvFile<< "tracers "<< particles.size()<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().x()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().y()<< " ";}gmvFile<< nl;forAllConstIter(Cloud< passiveParticle >, particles, iter){ gmvFile<< iter().position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::meshOctreeCubeCoordinatesScalar::operator<
bool operator<(const meshOctreeCubeCoordinatesScalar &scc) const
Definition: meshOctreeCubeCoordinatesScalar.H:99
contiguous.H
Template function to specify if the data of a type are contiguous.
Foam::meshOctreeCubeCoordinatesScalar::coordinates
const meshOctreeCubeCoordinates & coordinates() const
return the value
Definition: meshOctreeCubeCoordinatesScalar.H:92
Foam::meshOctreeCubeCoordinatesScalar::meshOctreeCubeCoordinatesScalar
meshOctreeCubeCoordinatesScalar()
Null construct.
Definition: meshOctreeCubeCoordinatesScalar.H:63
Foam::meshOctreeCubeCoordinatesScalar::sValue_
scalar sValue_
scalar
Definition: meshOctreeCubeCoordinatesScalar.H:54
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::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95
Foam::meshOctreeCubeCoordinatesScalar::operator=
void operator=(const meshOctreeCubeCoordinatesScalar &scc)
Definition: meshOctreeCubeCoordinatesScalar.H:107