Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
solverstack
ScalFMM
Commits
92260e0f
Commit
92260e0f
authored
Apr 09, 2015
by
BRAMAS Berenger
Browse files
Add a function to get the leaf position from the tree coordinate
parent
d40d4b4b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Src/Containers/FCoordinateComputer.hpp
View file @
92260e0f
...
...
@@ -53,6 +53,22 @@ struct FCoordinateComputer {
return
host
;
}
template
<
class
FReal
>
static
inline
FPoint
<
FReal
>
GetPositionFromCoordinate
(
const
FPoint
<
FReal
>&
centerOfBox
,
const
FReal
boxWidth
,
const
int
treeHeight
,
const
FTreeCoordinate
&
pos
)
{
const
FPoint
<
FReal
>
boxCorner
(
centerOfBox
,
-
(
boxWidth
/
2
));
const
FReal
boxWidthAtLeafLevel
(
boxWidth
/
FReal
(
1
<<
(
treeHeight
-
1
)));
// box coordinate to host the particle
FPoint
<
FReal
>
host
;
// position has to be relative to corner not center
host
.
setX
(
pos
.
getX
()
*
boxWidthAtLeafLevel
+
boxCorner
.
getX
()
);
host
.
setY
(
pos
.
getY
()
*
boxWidthAtLeafLevel
+
boxCorner
.
getY
()
);
host
.
setZ
(
pos
.
getZ
()
*
boxWidthAtLeafLevel
+
boxCorner
.
getZ
()
);
return
host
;
}
};
...
...
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