Voro++

A class representing a single Voronoi cell. More...
#include <cell.hh>
Public Member Functions  
voronoicell_base ()  
~voronoicell_base ()  
void  init_base (double xmin, double xmax, double ymin, double ymax, double zmin, double zmax) 
void  init_octahedron_base (double l) 
void  init_tetrahedron_base (double x0, double y0, double z0, double x1, double y1, double z1, double x2, double y2, double z2, double x3, double y3, double z3) 
void  translate (double x, double y, double z) 
void  draw_pov (double x, double y, double z, FILE *fp=stdout) 
void  draw_pov (double x, double y, double z, const char *filename) 
void  draw_pov_mesh (double x, double y, double z, FILE *fp=stdout) 
void  draw_pov_mesh (double x, double y, double z, const char *filename) 
void  draw_gnuplot (double x, double y, double z, FILE *fp=stdout) 
void  draw_gnuplot (double x, double y, double z, const char *filename) 
double  volume () 
double  max_radius_squared () 
double  total_edge_distance () 
double  surface_area () 
void  centroid (double &cx, double &cy, double &cz) 
int  number_of_faces () 
int  number_of_edges () 
void  vertex_orders (std::vector< int > &v) 
void  output_vertex_orders (FILE *fp=stdout) 
void  vertices (std::vector< double > &v) 
void  output_vertices (FILE *fp=stdout) 
void  vertices (double x, double y, double z, std::vector< double > &v) 
void  output_vertices (double x, double y, double z, FILE *fp=stdout) 
void  face_areas (std::vector< double > &v) 
void  output_face_areas (FILE *fp=stdout) 
void  face_orders (std::vector< int > &v) 
void  output_face_orders (FILE *fp=stdout) 
void  face_freq_table (std::vector< int > &v) 
void  output_face_freq_table (FILE *fp=stdout) 
void  face_vertices (std::vector< int > &v) 
void  output_face_vertices (FILE *fp=stdout) 
void  face_perimeters (std::vector< double > &v) 
void  output_face_perimeters (FILE *fp=stdout) 
void  normals (std::vector< double > &v) 
void  output_normals (FILE *fp=stdout) 
void  output_custom (const char *format, FILE *fp=stdout) 
void  output_custom (const char *format, int i, double x, double y, double z, double r, FILE *fp=stdout) 
template<class vc_class >  
bool  nplane (vc_class &vc, double x, double y, double z, double rsq, int p_id) 
bool  plane_intersects (double x, double y, double z, double rsq) 
bool  plane_intersects_guess (double x, double y, double z, double rsq) 
void  construct_relations () 
void  check_relations () 
void  check_duplicates () 
void  print_edges () 
virtual void  neighbors (std::vector< int > &v) 
virtual void  output_neighbors (FILE *fp=stdout) 
virtual void  print_edges_neighbors (int i) 
int  cycle_up (int a, int p) 
int  cycle_down (int a, int p) 
Data Fields  
int  current_vertices 
int  current_vertex_order 
int  current_delete_size 
int  current_delete2_size 
int  p 
int  up 
int **  ed 
int *  nu 
double *  pts 
Protected Member Functions  
void  reset_edges () 
template<class vc_class >  
void  check_memory_for_copy (vc_class &vc, voronoicell_base *vb) 
void  copy (voronoicell_base *vb) 
Protected Attributes  
int *  mem 
int *  mec 
int **  mep 
Friends  
class  voronoicell 
class  voronoicell_neighbor 
This class represents a single Voronoi cell, as a collection of vertices that are connected by edges. The class contains routines for initializing the Voronoi cell to be simple shapes such as a box, tetrahedron, or octahedron. It the contains routines for recomputing the cell based on cutting it by a plane, which forms the key routine for the Voronoi cell computation. It contains numerous routine for computing statistics about the Voronoi cell, and it can output the cell in several formats.
This class is not intended for direct use, but forms the base of the voronoicell and voronoicell_neighbor classes, which extend it based on whether neighboring particle ID information needs to be tracked.
voro::voronoicell_base::voronoicell_base  (  ) 
voro::voronoicell_base::~voronoicell_base  (  ) 
void voro::voronoicell_base::centroid  (  double &  cx, 
double &  cy,  
double &  cz  
) 
void voro::voronoicell_base::check_duplicates  (  ) 
This routine checks for any two vertices that are connected by more than one edge. The plane algorithm is designed so that this should not happen, so any occurrences are most likely errors. Note that the routine is O(p), so running it every time the plane routine is called will result in a significant slowdown.

protected 
void voro::voronoicell_base::check_relations  (  ) 
void voro::voronoicell_base::construct_relations  (  ) 

protected 

inline 

inline 
void voro::voronoicell_base::draw_gnuplot  (  double  x, 
double  y,  
double  z,  
FILE *  fp = stdout 

) 

inline 
void voro::voronoicell_base::draw_pov  (  double  x, 
double  y,  
double  z,  
FILE *  fp = stdout 

) 

inline 
void voro::voronoicell_base::draw_pov_mesh  (  double  x, 
double  y,  
double  z,  
FILE *  fp = stdout 

) 
Outputs the Voronoi cell in the POV mesh2 format, described in section 1.3.2.2 of the POVRay documentation. The mesh2 output consists of a list of vertex vectors, followed by a list of triangular faces. The routine also makes use of the optional inside_vector specification, which makes the mesh object solid, so the the POVRay Constructive Solid Geometry (CSG) can be applied.
[in]  (x,y,z)  a displacement vector to be added to the cell's position. 
[in]  fp  a file handle to write to. 

inline 
void voro::voronoicell_base::face_areas  (  std::vector< double > &  v  ) 
void voro::voronoicell_base::face_freq_table  (  std::vector< int > &  v  ) 
void voro::voronoicell_base::face_orders  (  std::vector< int > &  v  ) 
void voro::voronoicell_base::face_perimeters  (  std::vector< double > &  v  ) 
void voro::voronoicell_base::face_vertices  (  std::vector< int > &  v  ) 
void voro::voronoicell_base::init_base  (  double  xmin, 
double  xmax,  
double  ymin,  
double  ymax,  
double  zmin,  
double  zmax  
) 
void voro::voronoicell_base::init_octahedron_base  (  double  l  ) 
void voro::voronoicell_base::init_tetrahedron_base  (  double  x0, 
double  y0,  
double  z0,  
double  x1,  
double  y1,  
double  z1,  
double  x2,  
double  y2,  
double  z2,  
double  x3,  
double  y3,  
double  z3  
) 
Initializes a Voronoi cell as a tetrahedron. It assumes that the normal to the face for the first three vertices points inside.
(x0,y0,z0)  a position vector for the first vertex. 
(x1,y1,z1)  a position vector for the second vertex. 
(x2,y2,z2)  a position vector for the third vertex. 
(x3,y3,z3)  a position vector for the fourth vertex. 
double voro::voronoicell_base::max_radius_squared  (  ) 

inlinevirtual 
Returns a list of IDs of neighboring particles corresponding to each face.
[out]  v  a reference to a vector in which to return the results. If no neighbor information is available, a blank vector is returned. 
Reimplemented in voro::voronoicell_neighbor.
void voro::voronoicell_base::normals  (  std::vector< double > &  v  ) 
template bool voro::voronoicell_base::nplane  (  vc_class &  vc, 
double  x,  
double  y,  
double  z,  
double  rsq,  
int  p_id  
) 
Cuts the Voronoi cell by a particle whose center is at a separation of (x,y,z) from the cell center. The value of rsq should be initially set to .
[in]  vc  a reference to the specialized version of the calling class. 
[in]  (x,y,z)  the normal vector to the plane. 
[in]  rsq  the distance along this vector of the plane. 
[in]  p_id  the plane ID (for neighbor tracking only). 
int voro::voronoicell_base::number_of_edges  (  ) 
int voro::voronoicell_base::number_of_faces  (  ) 

inline 
void voro::voronoicell_base::output_custom  (  const char *  format, 
int  i,  
double  x,  
double  y,  
double  z,  
double  r,  
FILE *  fp = stdout 

) 
Outputs a custom string of information about the Voronoi cell. The string of information follows a similar style as the C printf command, and detailed information about its format is available at http://math.lbl.gov/voro++/doc/custom.html.
[in]  format  the custom string to print. 
[in]  i  the ID of the particle associated with this Voronoi cell. 
[in]  (x,y,z)  the position of the particle associated with this Voronoi cell. 
[in]  r  a radius associated with the particle. 
[in]  fp  the file handle to write to. 

inline 

inline 

inline 

inline 

inline 

inlinevirtual 
This is a virtual function that is overridden by a routine to print a list of IDs of neighboring particles corresponding to each face. By default, when no neighbor information is available, the routine does nothing.
[in]  fp  the file handle to write to. 
Reimplemented in voro::voronoicell_neighbor.

inline 
void voro::voronoicell_base::output_vertex_orders  (  FILE *  fp = stdout  ) 
void voro::voronoicell_base::output_vertices  (  FILE *  fp = stdout  ) 
void voro::voronoicell_base::output_vertices  (  double  x, 
double  y,  
double  z,  
FILE *  fp = stdout 

) 
bool voro::voronoicell_base::plane_intersects  (  double  x, 
double  y,  
double  z,  
double  rsq  
) 
This routine tests to see whether the cell intersects a plane by starting from the guess point up. If up intersects, then it immediately returns true. Otherwise, it calls the plane_intersects_track() routine.
[in]  (x,y,z)  the normal vector to the plane. 
[in]  rsq  the distance along this vector of the plane. 
bool voro::voronoicell_base::plane_intersects_guess  (  double  x, 
double  y,  
double  z,  
double  rsq  
) 
This routine tests to see if a cell intersects a plane. It first tests a random sample of approximately sqrt(p)/4 points. If any of those are intersect, then it immediately returns true. Otherwise, it takes the closest point and passes that to plane_intersect_track() routine.
[in]  (x,y,z)  the normal vector to the plane. 
[in]  rsq  the distance along this vector of the plane. 
void voro::voronoicell_base::print_edges  (  ) 

inlinevirtual 
This a virtual function that is overridden by a routine to print the neighboring particle IDs for a given vertex. By default, when no neighbor information is available, the routine does nothing.
[in]  i  the vertex to consider. 
Reimplemented in voro::voronoicell_neighbor.

inlineprotected 
Several routines in the class that gather cellbased statistics internally track their progress by flipping edges to negative so that they know what parts of the cell have already been tested. This function resets them back to positive. When it is called, it assumes that every edge in the routine should have already been flipped to negative, and it bails out with an internal error if it encounters a positive edge.
double voro::voronoicell_base::surface_area  (  ) 
double voro::voronoicell_base::total_edge_distance  (  ) 
void voro::voronoicell_base::translate  (  double  x, 
double  y,  
double  z  
) 
void voro::voronoicell_base::vertex_orders  (  std::vector< int > &  v  ) 
void voro::voronoicell_base::vertices  (  std::vector< double > &  v  ) 
void voro::voronoicell_base::vertices  (  double  x, 
double  y,  
double  z,  
std::vector< double > &  v  
) 
double voro::voronoicell_base::volume  (  ) 
int voro::voronoicell_base::current_delete2_size 
int voro::voronoicell_base::current_delete_size 
int voro::voronoicell_base::current_vertex_order 
int voro::voronoicell_base::current_vertices 
int** voro::voronoicell_base::ed 
This is a two dimensional array that holds information about the edge connections of the vertices that make up the cell. The two dimensional array is not allocated in the usual method. To account for the fact the different vertices have different orders, and thus require different amounts of storage, the elements of ed[i] point to onedimensional arrays in the mep[] array of different sizes.
More specifically, if vertex i has order m, then ed[i] points to a onedimensional array in mep[m] that has 2*m+1 entries. The first m elements hold the neighboring edges, so that the jth edge of vertex i is held in ed[i][j]. The next m elements hold a table of relations which is redundant but helps speed up the computation. It satisfies the relation ed[ed[i][j]][ed[i][m+j]]=i. The final entry holds a back pointer, so that ed[i+2*m]=i. The back pointers are used when rearranging the memory.

protected 

protected 

protected 
This is a two dimensional array for holding the information about the edges of the Voronoi cell. mep[p] is a onedimensional array for holding the edge information about all vertices of order p, with each vertex holding 2*p+1 integers of information. The total number of vertices held on mep[p] is stored in mem[p]. If the space runs out, the code allocates more using the add_memory() routine.
int* voro::voronoicell_base::nu 
int voro::voronoicell_base::p 
double* voro::voronoicell_base::pts 
int voro::voronoicell_base::up 
This is the index of particular point in the cell, which is used to start the tracing routines for plane intersection and cutting. These routines will work starting from any point, but it's often most efficient to start from the last point considered, since in many cases, the cell construction algorithm may consider many planes with similar vectors concurrently.