# include <boost/archive/binary_iarchive.hpp>
# include <boost/archive/binary_oarchive.hpp>
# include <boost/geometry/index/rtree.hpp>
+# include <boost/random/mersenne_twister.hpp>
# include <boost/serialization/array.hpp>
# include <boost/serialization/vector.hpp>
*
* If @p keep_boundary is set to @p true (which is the default), then
* boundary vertices are not moved.
+ *
+ * @p seed is used for the initialization of the random engine. Its
+ * default value initializes the engine with the same state as in
+ * previous versions of deal.II.
*/
template <int dim, int spacedim>
void
- distort_random(const double factor,
- Triangulation<dim, spacedim> &triangulation,
- const bool keep_boundary = true);
+ distort_random(
+ const double factor,
+ Triangulation<dim, spacedim> &triangulation,
+ const bool keep_boundary = true,
+ const unsigned int seed = boost::random::mt19937::default_seed);
/**
* Remove hanging nodes from a grid. If the @p isotropic parameter is set
void
distort_random(const double factor,
Triangulation<dim, spacedim> &triangulation,
- const bool keep_boundary)
+ const bool keep_boundary,
+ const unsigned int seed)
{
// if spacedim>dim we need to make sure that we perturb
// points but keep them on
}
}
- // create a random number generator for the interval [-1,1]. we use
- // this to make sure the distribution we get is repeatable, i.e.,
- // if you call the function twice on the same mesh, then you will
- // get the same mesh. this would not be the case if you used
- // the rand() function, which carries around some internal state
- // we could use std::mt19937 but doing so results in compiler-dependent
- // output.
- boost::random::mt19937 rng;
+ // create a random number generator for the interval [-1,1]
+ boost::random::mt19937 rng(seed);
boost::random::uniform_real_distribution<> uniform_distribution(-1, 1);
// If the triangulation is distributed, we need to
distort_random<deal_II_dimension>(
const double,
Triangulation<deal_II_dimension, deal_II_space_dimension> &,
- const bool);
+ const bool,
+ const unsigned int);
template void
get_face_connectivity_of_cells(