meshOctreeCubeBasicI.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 Description
25 
26 
27 \*---------------------------------------------------------------------------*/
28 
29 #include "meshOctreeCubeBasic.H"
30 
31 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
32 
33 namespace Foam
34 {
35 
36 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
37 
39 :
41  cubeType_(UNKNOWN),
42  procNo_(ALLPROCS)
43 {}
44 
46 (
48 )
49 :
51  cubeType_(UNKNOWN),
52  procNo_(ALLPROCS)
53 {}
54 
56 (
57  const meshOctreeCubeCoordinates& cc,
58  const direction cubeType,
59  const short procNo
60 )
61 :
63  cubeType_(cubeType),
64  procNo_(procNo)
65 {}
66 
67 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
68 // Member functions
69 
71 {
72  cubeType_ = ct;
73 }
74 
76 {
77  return cubeType_;
78 }
79 
80 inline short meshOctreeCubeBasic::procNo() const
81 {
82  return procNo_;
83 }
84 
85 inline void meshOctreeCubeBasic::setProcNo(const short n)
86 {
87  procNo_ = n;
88 }
89 
91 {
92  return *this;
93 }
94 
96 {
97  cubeType_ = ocb.cubeType_;
98  procNo_ = ocb.procNo_;
99 
100  static_cast<meshOctreeCubeCoordinates&>(*this) =
101  static_cast<const meshOctreeCubeCoordinates&>(ocb);
102 }
103 
104 inline Ostream& operator<<
105 (
106  Ostream& os,
107  const meshOctreeCubeBasic& ocb
108 )
109 {
110  os << token::BEGIN_LIST;
111 
112  os << ocb.cubeType_ << token::SPACE;
113  os << ocb.procNo_ << token::SPACE;
114  os << static_cast<const meshOctreeCubeCoordinates&>(ocb);
115 
116  os << token::END_LIST;
117 
118  // Check state of Ostream
119  os.check("operator<<(Ostream&, const meshOctreeCubeBasic");
120 
121  return os;
122 }
123 
124 inline Istream& operator>>
125 (
126  Istream& is,
128 )
129 {
130  // Read beginning of meshOctreeCubeBasic
131  is.readBegin("meshOctreeCubeBasic");
132 
133  label l;
134  is >> l;
135  ocb.cubeType_ = l;
136  is >> l;
137  ocb.procNo_ = l;
138  is >> static_cast<meshOctreeCubeCoordinates&>(ocb);
139 
140  // Read end of meshOctreeCubeBasic
141  is.readEnd("meshOctreeCubeBasic");
142 
143  // Check state of Istream
144  is.check("operator>>(Istream&, meshOctreeCubeBasic");
145 
146  return is;
147 }
148 
149 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
150 
151 } // End namespace Foam
152 
153 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
Foam::Istream::readEnd
Istream & readEnd(const char *funcName)
Definition: Istream.C:105
Foam::meshOctreeCubeBasic::meshOctreeCubeBasic
meshOctreeCubeBasic()
Null constructor.
Definition: meshOctreeCubeBasicI.H:38
Foam::meshOctreeCubeCoordinates
Definition: meshOctreeCubeCoordinates.H:55
Foam::meshOctreeCubeBasic::procNo_
short procNo_
processor to which the cube belongs to
Definition: meshOctreeCubeBasic.H:57
Foam::meshOctreeCubeBasic::setCubeType
void setCubeType(const direction)
set cube type
Definition: meshOctreeCubeBasicI.H:70
Foam::meshOctreeCubeBasic::cubeType
direction cubeType() const
return type
Definition: meshOctreeCubeBasicI.H:75
Foam::meshOctreeCubeBasic::coordinates
const meshOctreeCubeCoordinates & coordinates() const
return coordinates in the octree
Definition: meshOctreeCubeBasicI.H:90
n
label n
Definition: TABSMDCalcMethod2.H:31
meshOctreeCubeBasic.H
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::meshOctreeCubeBasic::setProcNo
void setProcNo(const short)
set processor number
Definition: meshOctreeCubeBasicI.H:85
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::meshOctreeCubeBasic::operator=
void operator=(const meshOctreeCubeBasic &)
Definition: meshOctreeCubeBasicI.H:95
Foam::token::BEGIN_LIST
@ BEGIN_LIST
Definition: token.H:100
Foam::meshOctreeCubeBasic::cubeType_
direction cubeType_
cube type
Definition: meshOctreeCubeBasic.H:54
Foam::meshOctreeCubeBasic::procNo
short procNo() const
return processor number
Definition: meshOctreeCubeBasicI.H:80
Foam::direction
unsigned char direction
Definition: direction.H:43
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::meshOctreeCubeBasic
Definition: meshOctreeCubeBasic.H:49
Foam::token::END_LIST
@ END_LIST
Definition: token.H:101
Foam::token::SPACE
@ SPACE
Definition: token.H:95