1 // File import example code
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
10 // Set up constants for the container geometry
11 const double x_min
=-50000,x_max
=50000;
12 const double y_min
=-50000,y_max
=50000;
13 const double z_min
=-50000,z_max
=50000;
15 // Set up the number of blocks that the container is divided into
16 const int n_x
=6,n_y
=6,n_z
=6;
23 // Create a container with the geometry given above, and make it
24 // non-periodic in each of the three coordinates. Allocate space for
25 // eight particles within each computational block
26 container
con(x_min
,x_max
,y_min
,y_max
,z_min
,z_max
,n_x
,n_y
,n_z
,
29 //Randomly add particles into the container
30 con
.import("pointlist.txt");
32 // Save the Voronoi network of all the particles to text files
33 // in gnuplot and POV-Ray formats
34 /* con.draw_cells_gnuplot("pack_ten_cube.gnu");
35 con.draw_cells_pov("pack_ten_cube_v.pov");
37 // Output the particles in POV-Ray format
38 con.draw_particles_pov("pack_ten_cube_p.pov");*/
40 outputFile
= fopen("MESH2","w");
41 printf("STARING FIRST LOOP");
44 if(cl
.start()) do if(con
.compute_cell(c
,cl
)) {
45 cl
.pos(x
,y
,z
);id
=cl
.pid();
46 printf("%d %e %e %e\n", id
,x
,y
,z
);
48 fprintf(outputFile
,"%d %e %e %e\n", id
,x
,y
,z
);