1 C++ interface output examples
2 =============================
3 Since version 0.4, Voro++ has contained many routines that allow for programs
4 to directly analyze features of a single Voronoi cell, and Voronoi cells in a
5 particle packing. These example codes demonstrate this functionality.
7 1. odd_even.cc constructs a single Voronoi cell using random planes, in the
8 same manner as the basic single_cell.cc example. It then calls several routines
9 to gain information about the computed cell's faces. Using this information it
10 constructs a POV-Ray scene in which the faces are colored white or black
11 depending on whether the have an odd or even number of sides. The POV-Ray
12 header file odd_even.pov can be used to visualize the result.
14 2. loops.cc demonstrates the loop classes, that can be used to iterate over a
15 certain subset of particles within a container. It demonstrates the
16 c_loop_order class, which can loop over a specific pre-computed list of
17 particles. It also demonstrates the c_loop_subset class, which can loop over
18 particles in a certain region of the container. These classes are used to
19 compute Voronoi cells in two interlocking tori. The POV-Ray header file
20 loops.pov can be used to visualize the result.
22 3. polygons.cc demonstrates how routines can be used to find all faces in a
23 Voronoi tessellation that have a specific number of sides. The routine also
24 demonstrates the pre_container class, that can aid in correctly configuring the
25 underlying grid that the code uses, in cases whether the amount of input data
26 is not known a priori. When run, the code generates POV-Ray scenes of all
27 quadrilateral, pentagonal, and hexagonal faces in a Voronoi tessellation. The
28 can be visualized using the POV-Ray header files polygons4.pov, polygons5.pov,
31 4. find_voro_cell.cc demonstrates the find_voronoi_cell routine. For a given
32 position vector, this routine will return the Voronoi cell that the vector is
33 within. The code creates a unit cube and randomly adds twenty particles to it.
34 It carries out a number of find_voronoi_cell calls for a slice through the
35 cube, creating a file with vectors from each sample point to the particle whose
36 Voronoi cell contains the point. The results can be visualized in Gnuplot with
38 splot 'find_voro_cell_v.gnu' w l t 'Voronoi cells', 'find_voro_cell.vec' w vec t 'Voronoi cell vectors', 'find_voro_cell_p.gnu' w p u 2:3:4 t 'Particles'
40 The example also uses the find_voronoi_cell routine to estimate the size of
41 each Voronoi cell. It scans a grid covering the entire container, making
42 find_voronoi_cell calls at each location. The number of times each Voronoi cell
43 is returned gives an estimate of its volume. These sampled volumes, as well as
44 the exact calculated voulmes are saved to 'find_voro_cell.vol'. A graph
45 comparing the two can be plotted in Gnuplot with
47 set xlabel 'Calculated volume'
48 set ylabel 'Sampled volume'
49 plot [0:0.1] [0:0.1] 'find_voro_cell.vol' u 5:6
51 Altering the size of scanning grid alters who accurate the sampled volumes will
52 match the calculated results.