Strip extra spaces from code.
[voro++.git] / branches / exact / examples / no_release / import_nguyen.cc
blob571fb2eb3016a9414d47ef97ae21b236a20e39d1
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++.hh"
8 using namespace voro;
10 // Set up constants for the container geometry
11 const double x_min=-5,x_max=5;
12 const double y_min=-5,y_max=5;
13 const double z_min=-5,z_max=5;
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() {
20 // Construct container
21 container con(-5,5,-5,5,0,10,6,6,6,false,false,false,8);
23 // Import particles
24 con.import("../basic/pack_ten_cube");
26 // Loop over all the particles and compute the Voronoi cell for each
27 unsigned int i;
28 int id;
29 double x,y,z;
30 vector<double> vd;
31 voronoicell c;
32 c_loop_all cl(con);
33 if(cl.start()) do if(con.compute_cell(c,cl)) {
35 // Get particle position and ID
36 cl.pos(x,y,z);id=cl.pid();
38 // Get face areas
39 c.face_areas(vd);
41 // Output information (additional diagnostics could be done
42 // here)
43 printf("ID %d (%.3f,%.3f,%.3f) :",id,x,y,z);
44 for(i=0;i<vd.size();i++) printf(" %.3f",vd[i]);
45 puts("");
46 } while (cl.inc());