Dear libMesh devs
please consider adding the attached patch (for r5017) to the trunk. It adds the
possibility to specify a custom random seed for the mesh distortion in
MeshTools:Modification::distort in a backwards-compatible way. This is useful
for solving the same problem with differently distorted meshes (e.g., for
statistics).
Thanks and merry Christmas!
Roman
Index: include/mesh/mesh_modification.h
===================================================================
--- include/mesh/mesh_modification.h (revision 5017)
+++ include/mesh/mesh_modification.h (working copy)
@@ -55,10 +55,12 @@
* move each node \p factor fraction of its minimum neighboring
* node separation distance. Nodes on the boundary are not moved
* by default, however they may be by setting the flag
- * \p perturb_boundary true.
+ * \p perturb_boundary true. The randomness can be influenced by
+ * passing a \p seed.
*/
void distort (MeshBase& mesh,
- const Real factor, const bool perturb_boundary=false);
+ const Real factor, const bool perturb_boundary=false,
+ const unsigned int seed=123456);
/**
* Translates the mesh. The grid points are translated in the
Index: src/mesh/mesh_modification.C
===================================================================
--- src/mesh/mesh_modification.C (revision 5017)
+++ src/mesh/mesh_modification.C (working copy)
@@ -46,7 +46,8 @@
// MeshTools::Modification functions for mesh modification
void MeshTools::Modification::distort (MeshBase& mesh,
const Real factor,
- const bool perturb_boundary)
+ const bool perturb_boundary,
+ const unsigned int seed)
{
libmesh_assert (mesh.n_nodes());
libmesh_assert (mesh.n_elem());
@@ -79,8 +80,6 @@
// Now actually move the nodes
{
- const unsigned int seed = 123456;
-
// seed the random number generator.
// We'll loop from 1 to n_nodes on every processor, even those
// that don't have a particular node, so that the pseudorandom
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
Libmesh-devel mailing list
Libmesh-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/libmesh-devel