Bugfix in search_for_outside_edge routine.
[voro++.git] / trunk / zeo / cp_test.cc
bloba5e2176d0677b1796a4f6cf5e94203deff4b72c8
1 // Parallelepiped calculation 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
11 const double bx=4;
12 const double bxy=0,by=2;
13 const double bxz=1,byz=0,bz=3;
15 // Set up the number of blocks that the container is divided into
16 const int nx=5,ny=5,nz=5;
18 // Set the number of particles that are going to be randomly introduced
19 const int particles=20;
21 // This function returns a random double between 0 and 1
22 double rnd() {return double(rand())/RAND_MAX;}
24 int main() {
25 int i;
26 double x,y,z;
28 // Create a parallelepiped with
29 container_periodic con(bx,bxy,by,bxz,byz,bz,nx,ny,nz,8);
31 // Randomly add particles into the container
32 for(i=0;i<particles;i++) {
33 x=rnd()*bx;
34 y=rnd()*by;
35 z=rnd()*bz;
36 con.put(i,x,y,z);
39 // Output the particle positions in gnuplot format
40 con.draw_particles("cp_test_p.gnu");
42 // Output the Voronoi cells in gnuplot format
43 con.draw_cells_gnuplot("cp_test_v.gnu");
45 // Output the domain outline
46 con.draw_domain_gnuplot("cp_test_d.gnu");