4 #include "voro++_2d.hh"
6 // Set up the number of blocks that the container is divided into. If the
7 // preprocessor variable NNN hasn't been passed to the code, then initialize it
8 // to a good value. Otherwise, use the value that has been passed.
13 // Set the number of particles that are going to be randomly introduced
14 const int particles
=100000;
16 // This function returns a random floating point number between 0 and 1
17 double rnd() {return double(rand())/RAND_MAX
;}
23 // Initialize the container class to be the unit square, with
24 // non-periodic boundary conditions. Divide it into a 6 by 6 grid, with
25 // an initial memory allocation of 16 particles per grid square.
26 container_2d
con(0,1,0,1,NNN
,NNN
,false,false,16);
28 //Randomly add particles into the container
29 for(i
=0;i
<particles
;i
++) {
35 // Store the initial clock time
38 // Carry out a dummy computation of all cells in the entire container
39 con
.compute_all_cells();
41 // Calculate the elapsed time and print it
43 double runtime
=double(end
-start
)/CLOCKS_PER_SEC
;
44 printf("%g\n",runtime
);