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
fc671971
Commit
fc671971
authored
May 24, 2015
by
Franjo
Browse files
Functions to selected leaves inside a sphere
parent
5a78f0a1
Changes
2
Hide whitespace changes
Inline
Side-by-side
meshLibrary/utilities/octrees/meshOctree/meshOctreeCube/meshOctreeCube.H
View file @
fc671971
...
...
@@ -211,6 +211,25 @@ public:
DynList
<
const
meshOctreeCube
*
,
256
>&
)
const
;
//- find leaves within a sphere
void
leavesInSphere
(
const
boundBox
&
rootBox
,
const
point
&
,
const
scalar
,
DynList
<
label
>&
)
const
;
//- mark leaves within a sphere
void
markLeavesInSphere
(
const
boundBox
&
rootBox
,
const
point
&
,
const
scalar
,
labelList
&
,
bool
&
)
const
;
//- find leaves for a given cube
void
findLeaves
(
...
...
meshLibrary/utilities/octrees/meshOctree/meshOctreeCube/meshOctreeCubeRecursiveFunctions.C
View file @
fc671971
...
...
@@ -85,6 +85,102 @@ void meshOctreeCube::leavesInBox
}
}
void
meshOctreeCube
::
leavesInSphere
(
const
boundBox
&
rootBox
,
const
point
&
c
,
const
scalar
r
,
DynList
<
label
>&
containedLeaves
)
const
{
const
point
cubeCentre
=
this
->
centre
(
rootBox
);
const
scalar
size
=
1
.
732
*
this
->
size
(
rootBox
);
if
(
magSqr
(
cubeCentre
-
c
)
<
sqr
(
r
+
size
)
)
{
if
(
this
->
isLeaf
()
)
{
containedLeaves
.
append
(
this
->
cubeLabel
());
}
else
{
for
(
label
scI
=
0
;
scI
<
8
;
++
scI
)
{
meshOctreeCube
*
scPtr
=
subCubesPtr_
[
scI
];
if
(
scPtr
)
{
scPtr
->
leavesInSphere
(
rootBox
,
c
,
r
,
containedLeaves
);
}
else
if
(
Pstream
::
parRun
()
)
{
meshOctreeCubeCoordinates
cc
=
refineForPosition
(
scI
);
const
point
sc
=
cc
.
centre
(
rootBox
);
if
(
magSqr
(
sc
-
c
)
<
sqr
(
r
+
size
)
)
containedLeaves
.
append
(
meshOctreeCube
::
OTHERPROC
);
}
}
}
}
}
void
meshOctreeCube
::
markLeavesInSphere
(
const
boundBox
&
rootBox
,
const
point
&
c
,
const
scalar
r
,
labelList
&
markedLeaves
,
bool
&
atProcessorBnd
)
const
{
const
point
cubeCentre
=
this
->
centre
(
rootBox
);
const
scalar
size
=
1
.
732
*
this
->
size
(
rootBox
);
if
(
magSqr
(
cubeCentre
-
c
)
<
sqr
(
r
+
size
)
)
{
if
(
this
->
isLeaf
()
)
{
markedLeaves
[
this
->
cubeLabel
()]
|=
2
;
}
else
{
for
(
label
scI
=
0
;
scI
<
8
;
++
scI
)
{
meshOctreeCube
*
scPtr
=
subCubesPtr_
[
scI
];
if
(
scPtr
)
{
scPtr
->
markLeavesInSphere
(
rootBox
,
c
,
r
,
markedLeaves
,
atProcessorBnd
);
}
else
if
(
Pstream
::
parRun
()
)
{
meshOctreeCubeCoordinates
cc
=
refineForPosition
(
scI
);
const
point
sc
=
cc
.
centre
(
rootBox
);
if
(
magSqr
(
sc
-
c
)
<
sqr
(
r
+
size
)
)
{
atProcessorBnd
=
true
;
}
}
}
}
}
}
void
meshOctreeCube
::
findLeaves
(
LongList
<
meshOctreeCube
*>&
leaves
)
const
{
if
(
this
->
isLeaf
()
)
...
...
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