Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Aland, Sebastian
amdis
Commits
2d1a440f
Commit
2d1a440f
authored
Aug 09, 2012
by
Praetorius, Simon
Browse files
random functor added
parent
ab2c1462
Changes
1
Hide whitespace changes
Inline
Side-by-side
extensions/Tools.h
View file @
2d1a440f
...
...
@@ -9,8 +9,29 @@
#include
<boost/fusion/include/boost_array.hpp>
#include
"MetaTools.h"
#include
"Helpers.h"
namespace
tools
{
struct
Random
:
AbstractFunction
<
double
,
WorldVector
<
double
>
>
{
Random
(
double
mean_
,
double
amplitude_
)
:
mean
(
mean_
),
amplitude
(
amplitude_
)
{
#ifdef HAVE_PARALLEL_DOMAIN_AMDIS
mpi
::
startRand
();
#else
std
::
srand
(
Helpers
::
getRandomSeed
());
#endif
}
double
operator
()(
const
WorldVector
<
double
>
&
x
)
const
{
return
mean
+
amplitude
*
(
std
::
rand
()
/
static_cast
<
double
>
(
RAND_MAX
)
-
0.5
);
}
private:
double
mean
;
double
amplitude
;
};
/// Quadrature Rules
///____________________________________________________________________________________
...
...
Write
Preview
Supports
Markdown
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