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
b390de3b
Commit
b390de3b
authored
Aug 20, 2012
by
BRAMAS Berenger
Browse files
Update rotation P2M function to reduce computation time by 2
parent
bc0c85b0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Src/Kernels/Rotation/FRotationKernel.hpp
View file @
b390de3b
...
...
@@ -896,6 +896,7 @@ public:
// We need a legendre array
FReal
legendre
[
SizeArray
];
FReal
angles
[
SizeArray
][
2
];
// For all particles in the leaf box
typename
ContainerClass
::
ConstBasicIterator
iterParticle
(
*
inParticles
);
...
...
@@ -915,13 +916,18 @@ public:
// w{l,m}(q,a) = q a^l/(l+|m|)! P{l,m}(cos(alpha)) exp(-i m Beta)
FReal
q_aPowL
=
q
;
// To consutrct q*a^l continously
int
index_l_m
=
0
;
// To construct the index of (l,m) continously
for
(
int
l
=
0
;
l
<=
P
;
++
l
){
FReal
fm
=
0.0
;
// To have "m" has a float
for
(
int
m
=
0
;
m
<=
l
;
++
m
,
++
index_l_m
,
++
fm
){
FReal
fl
=
0.0
;
for
(
int
l
=
0
;
l
<=
P
;
++
l
,
++
fl
){
{
// We need to compute the angles to use in the "m" loop
// So we can compute only the one needed after "l" inc
const
FReal
angle
=
fl
*
sph
.
getPhi
()
+
i_pow_m
[
l
&
0x3
];
angles
[
l
][
0
]
=
FMath
::
Cos
(
angle
);
angles
[
l
][
1
]
=
FMath
::
Sin
(
angle
);
}
for
(
int
m
=
0
;
m
<=
l
;
++
m
,
++
index_l_m
){
const
FReal
magnitude
=
q_aPowL
*
legendre
[
index_l_m
]
/
factorials
[
l
+
m
];
const
FReal
angle
=
fm
*
sph
.
getPhi
()
+
i_pow_m
[
m
&
0x3
];
w
[
index_l_m
].
incReal
(
magnitude
*
FMath
::
Cos
(
angle
));
w
[
index_l_m
].
incImag
(
magnitude
*
FMath
::
Sin
(
angle
));
w
[
index_l_m
].
incReal
(
magnitude
*
angles
[
m
][
0
]);
w
[
index_l_m
].
incImag
(
magnitude
*
angles
[
m
][
1
]);
}
q_aPowL
*=
a
;
}
...
...
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