Bugfix in search_for_outside_edge routine.
[voro++.git] / trunk / examples / custom / custom_output.cc
blob2f3944242bc6a7579e70e93afc26e6a781700239
1 // Custom output 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=-3,x_max=3;
12 const double y_min=-3,y_max=3;
13 const double z_min=0,z_max=6;
15 // Set up the number of blocks that the container is divided
16 // into.
17 const int n_x=3,n_y=3,n_z=3;
19 int main() {
21 // Create a container with the geometry given above, and make it
22 // non-periodic in each of the three coordinates. Allocate space for
23 // eight particles within each computational block.
24 container con(x_min,x_max,y_min,y_max,z_min,z_max,n_x,n_y,n_z,
25 false,false,false,8);
27 // Import the monodisperse test packing and output the Voronoi
28 // tessellation in gnuplot and POV-Ray formats.
29 con.import("pack_six_cube");
31 // Do a custom output routine to store the number of vertices, edges,
32 // and faces of each Voronoi cell
33 con.print_custom(
34 "ID=%i, pos=(%x,%y,%z), vertices=%w, edges=%g, faces=%s",
35 "packing.custom1");
37 // Do a custom output routine to store a variety of face-based
38 // statistics. Store the particle ID and position, the number of faces
39 // the total face area, the order of each face, the areas of each face,
40 // the vertices making up each face, and the neighboring particle (or
41 // wall) corresponding to each face.
42 con.print_custom("%i %q %s %F %a %f %t %l %n","packing.custom2");
44 // Do a custom output routine that outputs the particle IDs and
45 // positions, plus the volume and the centroid position relative to the
46 // particle center
47 con.print_custom("%i %q %v %c","packing.custom3");
49 // Also create POV-Ray output of the Voronoi cells for use in the
50 // rendering
51 con.draw_cells_pov("pack_six_cube_v.pov");