Minkowski test code.
[voro++.git] / trunk / examples / no_release / import_nguyen.cc
blob6ff367fcaf2231240907d8cc3f96de3d95acdfe5
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 #include <vector>
11 using namespace std;
13 // Set up constants for the container geometry
14 const double x_min=-5,x_max=5;
15 const double y_min=-5,y_max=5;
16 const double z_min=-5,z_max=5;
18 // Set up the number of blocks that the container is divided into
19 const int n_x=6,n_y=6,n_z=6;
21 int main() {
23 // Construct container
24 container con(-5,5,-5,5,0,10,6,6,6,false,false,false,8);
26 // Import particles
27 con.import("../basic/pack_ten_cube");
29 // Loop over all the particles and compute the Voronoi cell for each
30 unsigned int i;
31 int id;
32 double x,y,z;
33 vector<double> vd;
34 voronoicell c;
35 c_loop_all cl(con);
36 if(cl.start()) do if(con.compute_cell(c,cl)) {
38 // Get particle position and ID
39 cl.pos(x,y,z);id=cl.pid();
41 // Get face areas
42 c.face_areas(vd);
44 // Output information (additional diagnostics could be done
45 // here)
46 printf("ID %d (%.3f,%.3f,%.3f) :",id,x,y,z);
47 for(i=0;i<vd.size();i++) printf(" %.3f",vd[i]);
48 puts("");
49 } while (cl.inc());