1 #include "voro++_2d.hh"
7 // Initialize the container class to be the unit square, with
8 // non-periodic boundary conditions. Divide it into a 6 by 6 grid, with
9 // an initial memory allocation of 16 particles per grid square.
10 container_2d
con(0,1,0,1,6,6,false,false,false,16);
12 // Import the spiral data set, and only save those particles that are
13 // within the container bounds
14 con
.import("particles_spiral");
15 sprintf(buffer
,"lloyd/lloyd_p.%d",0);
16 con
.draw_particles(buffer
);
18 // Carry out sixty four iterations of Lloyd's algorithm
22 sprintf(buffer
,"lloyd/lloyd_v.%d",i
);
23 con
.draw_cells_gnuplot(buffer
);
24 sprintf(buffer
,"lloyd/lloyd_p.%d",i
+1);
25 con
.print_custom("%i %C",buffer
);
28 // Draw the final Voronoi cells
29 con
.draw_cells_gnuplot("lloyd/lloyd_v.256");