38 #ifndef Mesquite_Randomize_hpp  
   39 #define Mesquite_Randomize_hpp 
   42 #include "VertexMover.hpp" 
   43 #include "MsqFreeVertexIndexIterator.hpp" 
   44 #include "MsqDebug.hpp" 
   52   class Randomize : 
public VertexMover 
 
   89     MsqVertex* verts = pd.get_vertex_array(err);  
MSQ_ERRRTN(err);
 
   91     double scale_factor=0.0;
 
   93     double rand_double=0.0;
 
   97       MSQ_PRINT(1)(
"WARNING: Number of incident vertex is zero.  Returning.\n");
 
  101     size_t free_ind = pd.get_vertex_index(&(free_vtx));
 
  104     for (i=0;i<num_vtx;++
i){
 
  106         scale_factor+=(verts[
i]-free_vtx).
length();
 
  108     scale_factor/=( (double) num_vtx - 1.0 );    
 
  112       rand_int = rand_int%1000;
 
  114       rand_double = (((double) rand_int)/500.0)-1.0;
 
  115       free_vtx[
j] += scale_factor*rand_double*
mPercent;
 
Randomize()
Constructor defaulting mPercent to .05. 
 
virtual void terminate_mesh_iteration(PatchData &pd, MsqError &err)
 
Used to hold the error state and return it to the application. 
 
double length(Vector3D *const v, int n)
 
virtual void initialize_mesh_iteration(PatchData &pd, MsqError &err)
 
#define MSQ_PRINT(flag)
Check debug flag and print printf-style formatted output. 
 
virtual void optimize_vertex_positions(PatchData &pd, MsqError &err)
 
double rand()
Return a random variable between [0,1] with respect to an uniform distribution. 
 
MsqVertex is the Mesquite object that stores information about the vertices in the mesh...
 
virtual void initialize(PatchData &pd, MsqError &err)
 
#define MSQ_ERRRTN(err)
If passed error is true, return from a void function. 
 
void randomize_vertex(PatchData &pd, size_t num_vtx, MsqVertex &free_vtx, MsqError &err)
Perturbs the free vertex randomly.