4 // Set up constants for the container geometry
12 // Set up the number of blocks that the container is divided
14 const int n_x
=3,n_y
=3,n_z
=3;
16 // Set the number of particles to add
17 const int particles
=20;
19 // This function returns a random double between 0 and 1
20 double rnd() {return double(rand())/RAND_MAX
;}
26 // Create a container with the geometry given above, and make it
27 // non-periodic in each of the three coordinates. Allocate space for
28 // eight particles within each computational block.
29 container_periodic
con(bx
,bxy
,by
,bxz
,byz
,bz
,n_x
,n_y
,n_z
,8);
31 // Add particles into the container at random positions
32 for(i
=0;i
<particles
;i
++) {
41 double vvol
=con
.sum_cell_volumes();
42 printf("Container volume : %g\n"
43 "Voronoi volume : %g\n",bx
*by
*bz
,vvol
);
45 // Output particle positions, Voronoi cells, and the domain
46 con
.draw_particles("particles_periodic.gnu");
47 con
.draw_cells_gnuplot("cells_periodic.gnu");
48 con
.draw_domain_gnuplot("domain_periodic.gnu");