Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Community
integration-cfmesh
Commits
5a78f0a1
Commit
5a78f0a1
authored
May 24, 2015
by
Franjo
Browse files
meshOcreeCubeCoordinatesScalar, < and > operators for meshOctreeCubeCoordinates
parent
575843ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
meshLibrary/utilities/helperClasses/parallelHelpers/meshOctreeCubeCoordinatesScalar/meshOctreeCubeCoordinatesScalar.H
0 → 100644
View file @
5a78f0a1
/*---------------------------------------------------------------------------*\
========= |
\\ / F ield | cfMesh: A library for mesh generation
\\ / O peration |
\\ / A nd | Author: Franjo Juretic (franjo.juretic@c-fields.com)
\\/ M anipulation | Copyright (C) Creative Fields, Ltd.
-------------------------------------------------------------------------------
License
This file is part of cfMesh.
cfMesh is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
cfMesh is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with cfMesh. If not, see <http://www.gnu.org/licenses/>.
Class
labelledMeshOctreeCubeCoordinates
Description
A class containing point label and meshOctreeCubeCoordinates.
It is used for exchanging data over processors
SourceFiles
\*---------------------------------------------------------------------------*/
#ifndef labelledMeshOctreeCubeCoordinates_H
#define labelledMeshOctreeCubeCoordinates_H
#include
"label.H"
#include
"meshOctreeCubeCoordinates.H"
#include
"contiguous.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace
Foam
{
/*---------------------------------------------------------------------------*\
Class labelledMeshOctreeCubeCoordinates Declaration
\*---------------------------------------------------------------------------*/
class
labelledMeshOctreeCubeCoordinates
{
// Private data
//- label
label
cLabel_
;
//- cube coordinates
meshOctreeCubeCoordinates
coordinates_
;
public:
// Constructors
//- Null construct
labelledMeshOctreeCubeCoordinates
()
:
cLabel_
(
-
1
),
coordinates_
()
{}
//- Construct from label and cube coordinates
labelledMeshOctreeCubeCoordinates
(
const
label
cl
,
const
meshOctreeCubeCoordinates
&
cc
)
:
cLabel_
(
cl
),
coordinates_
(
cc
)
{}
// Destructor
~
labelledMeshOctreeCubeCoordinates
()
{}
// Member functions
//- return cube label
inline
label
cubeLabel
()
const
{
return
cLabel_
;
}
//- return the value
inline
const
meshOctreeCubeCoordinates
&
coordinates
()
const
{
return
coordinates_
;
}
// Member operators
inline
void
operator
=
(
const
labelledMeshOctreeCubeCoordinates
&
lcc
)
{
cLabel_
=
lcc
.
cLabel_
;
coordinates_
=
lcc
.
coordinates_
;
}
inline
bool
operator
==
(
const
labelledMeshOctreeCubeCoordinates
&
lcc
)
const
{
if
(
cLabel_
==
lcc
.
cLabel_
)
return
true
;
return
false
;
}
inline
bool
operator
!=
(
const
labelledMeshOctreeCubeCoordinates
&
lcc
)
const
{
return
!
this
->
operator
==
(
lcc
);
}
// Friend operators
friend
Ostream
&
operator
<<
(
Ostream
&
os
,
const
labelledMeshOctreeCubeCoordinates
&
lcc
)
{
os
<<
token
::
BEGIN_LIST
;
os
<<
lcc
.
cLabel_
<<
token
::
SPACE
;
os
<<
lcc
.
coordinates_
<<
token
::
END_LIST
;
// Check state of Ostream
os
.
check
(
"operator<<(Ostream&, const labelledMeshOctreeCubeCoordinates&"
);
return
os
;
}
friend
Istream
&
operator
>>
(
Istream
&
is
,
labelledMeshOctreeCubeCoordinates
&
lcc
)
{
// Read beginning of labelledMeshOctreeCubeCoordinates
is
.
readBegin
(
"labelledMeshOctreeCubeCoordinates"
);
is
>>
lcc
.
cLabel_
;
is
>>
lcc
.
coordinates_
;
// Read end of labelledMeshOctreeCubeCoordinates
is
.
readEnd
(
"labelledMeshOctreeCubeCoordinates"
);
// Check state of Istream
is
.
check
(
"operator>>(Istream&, labelledMeshOctreeCubeCoordinates"
);
return
is
;
}
};
//- Specify data associated with labelledMeshOctreeCubeCoordinates
//- type is contiguous
template
<
>
inline
bool
contiguous
<
labelledMeshOctreeCubeCoordinates
>
()
{
return
true
;}
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
}
// End namespace Foam
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
#endif
// ************************************************************************* //
meshLibrary/utilities/octrees/meshOctree/meshOctreeCube/meshOctreeCubeCoordinates.H
View file @
5a78f0a1
...
...
@@ -206,6 +206,9 @@ public:
inline
bool
operator
<=
(
const
meshOctreeCubeCoordinates
&
)
const
;
inline
bool
operator
>=
(
const
meshOctreeCubeCoordinates
&
)
const
;
inline
bool
operator
<
(
const
meshOctreeCubeCoordinates
&
)
const
;
inline
bool
operator
>
(
const
meshOctreeCubeCoordinates
&
)
const
;
friend
inline
Istream
&
operator
>>
(
Istream
&
,
...
...
meshLibrary/utilities/octrees/meshOctree/meshOctreeCube/meshOctreeCubeCoordinatesI.H
View file @
5a78f0a1
...
...
@@ -411,6 +411,112 @@ inline bool meshOctreeCubeCoordinates::operator>=
return
false
;
}
inline
bool
meshOctreeCubeCoordinates
::
operator
<
(
const
meshOctreeCubeCoordinates
&
cc
)
const
{
const
direction
minL
=
Foam
::
min
(
level_
,
cc
.
level_
);
const
meshOctreeCubeCoordinates
curr
=
this
->
reduceToLevel
(
minL
);
const
meshOctreeCubeCoordinates
cctr
=
cc
.
reduceToLevel
(
minL
);
const
label
resx
=
curr
.
posX_
^
cctr
.
posX_
;
const
label
resy
=
curr
.
posY_
^
cctr
.
posY_
;
const
label
resz
=
curr
.
posZ_
^
cctr
.
posZ_
;
label
max
(
resx
),
dir
(
0
);
if
(
(
max
<=
resy
)
||
((
max
^
resy
)
<
resy
)
)
{
max
=
resy
;
dir
=
1
;
}
if
(
(
max
<=
resz
)
||
((
max
^
resz
)
<
resz
)
)
{
max
=
resz
;
dir
=
2
;
}
switch
(
dir
)
{
case
0
:
{
if
(
curr
.
posX_
<
cctr
.
posX_
)
return
true
;
return
false
;
}
break
;
case
1
:
{
if
(
curr
.
posY_
<
cctr
.
posY_
)
return
true
;
return
false
;
}
break
;
case
2
:
{
if
(
curr
.
posZ_
<
cctr
.
posZ_
)
return
true
;
return
false
;
}
break
;
};
return
false
;
}
inline
bool
meshOctreeCubeCoordinates
::
operator
>
(
const
meshOctreeCubeCoordinates
&
cc
)
const
{
const
direction
minL
=
Foam
::
min
(
level_
,
cc
.
level_
);
const
meshOctreeCubeCoordinates
curr
=
this
->
reduceToLevel
(
minL
);
const
meshOctreeCubeCoordinates
cctr
=
cc
.
reduceToLevel
(
minL
);
const
label
resx
=
curr
.
posX_
^
cctr
.
posX_
;
const
label
resy
=
curr
.
posY_
^
cctr
.
posY_
;
const
label
resz
=
curr
.
posZ_
^
cctr
.
posZ_
;
label
max
(
resx
),
dir
(
0
);
if
(
(
max
<=
resy
)
||
((
max
^
resy
)
<
resy
)
)
{
max
=
resy
;
dir
=
1
;
}
if
(
(
max
<=
resz
)
||
((
max
^
resz
)
<
resz
)
)
{
max
=
resz
;
dir
=
2
;
}
switch
(
dir
)
{
case
0
:
{
if
(
curr
.
posX_
>
cctr
.
posX_
)
return
true
;
return
false
;
}
break
;
case
1
:
{
if
(
curr
.
posY_
>
cctr
.
posY_
)
return
true
;
return
false
;
}
break
;
case
2
:
{
if
(
curr
.
posZ_
>
cctr
.
posZ_
)
return
true
;
return
false
;
}
break
;
};
return
false
;
}
inline
Istream
&
operator
>>
(
Istream
&
is
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment