Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
ScalFMM
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
5
Issues
5
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
solverstack
ScalFMM
Commits
6575d8c6
Commit
6575d8c6
authored
Jul 22, 2016
by
Quentin Khan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make plummer distribution stay in given radius
parent
218e681c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
Src/Files/FGenerateDistribution.hpp
Src/Files/FGenerateDistribution.hpp
+7
-1
No files found.
Src/Files/FGenerateDistribution.hpp
View file @
6575d8c6
...
...
@@ -243,6 +243,7 @@ FReal plummerDist(FSize& cpt, const FReal &R) {
}
}
/**
* \brief Build N points following the Plummer distribution
*
...
...
@@ -258,11 +259,16 @@ FReal plummerDist(FSize& cpt, const FReal &R) {
*/
template
<
class
FReal
>
void
unifRandomPlummer
(
const
FSize
N
,
const
FReal
R
,
FReal
*
points
)
{
constexpr
const
FReal
rand_max
=
0.995
;
constexpr
const
FReal
r_max
=
std
::
sqrt
(
1.0
/
(
std
::
pow
(
rand_max
,
-
2.0
/
3.0
)
-
1.0
));
std
::
cerr
<<
r_max
<<
'\n'
;
unifRandomPointsOnSphere
<
FReal
>
(
N
,
1
,
points
);
FReal
mc
=
1.0
/
static_cast
<
FReal
>
(
N
);
for
(
FSize
i
=
0
,
j
=
0
;
i
<
N
;
++
i
,
j
+=
4
)
{
FReal
m
=
getRandom
<
FReal
>
();
FReal
r
=
FMath
::
Sqrt
(
1.0
/
(
FMath
::
pow
(
m
,
-
2.0
/
3.0
)
-
1.0
))
;
m
=
m
>
rand_max
?
rand_max
:
m
;
FReal
r
=
FMath
::
Sqrt
(
1.0
/
(
FMath
::
pow
(
m
,
-
2.0
/
3.0
)
-
1.0
))
/
r_max
;
points
[
j
]
*=
r
;
points
[
j
+
1
]
*=
r
;
points
[
j
+
2
]
*=
r
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a 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