Minkowski test code.
[voro++.git] / trunk / examples / no_release / import_freeman.cc
blobfc2651610445651106a8cb3e770104a3b7b429fa
1 // File import example code
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
7 #include "voro++.cc"
8 using namespace voro;
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;
18 int main() {
19 FILE * outputFile;
20 int id;
21 double x,y,z;
22 voronoicell c;
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,
27 false,false,false,8);
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");
42 c_loop_all cl(con);
43 //FIRST LOOP START
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);
47 fflush(stdout);
48 fprintf(outputFile,"%d %e %e %e\n", id,x,y,z);
49 } while (cl.inc());