1 // Voro++, a 3D cell-based Voronoi library
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
8 * \brief Header file for the base 2D Voronoi container class. */
10 #ifndef VOROPP_V_BASE_2D_HH
11 #define VOROPP_V_BASE_2D_HH
13 #include "worklist_2d.hh"
19 /** \brief Class containing data structures common across all particle container classes.
21 * This class contains constants and data structures that are common across all
22 * particle container classes. It contains constants setting the size of the
23 * underlying subgrid of blocks that forms the basis of the Voronoi cell
24 * computations. It also constructs bound tables that are used in the Voronoi
25 * cell computation, and contains a number of routines that are common across
26 * all container classes. */
29 // /** total number of particles. */
31 /** The number of blocks in the x direction. */
33 /** The number of blocks in the y direction. */
35 /** A constant, set to the value of nx multiplied by ny, which
36 * is used in the routines that step through blocks in
39 /** The size of a computational block in the x direction. */
41 /** The size of a computational block in the y direction. */
43 /** The inverse box length in the x direction. */
45 /** The inverse box length in the y direction. */
47 /** An array to hold the minimum distances associated with the
48 * worklists. This array is initialized during container
49 * construction, by the initialize_radii() routine. */
52 // /** The pre-computed block worklists. */
54 // unsigned int *globne;
55 // /** global neighbor information */
56 // inline void init_globne(){
57 // globne = new unsigned int[((totpar*totpar)/32)+1];
58 // for(int i=0;i<((totpar*totpar)/32);i++){
62 // void add_globne_info(int pid, int *nel, int length);
63 // void print_globne(FILE *fp);
64 inline void full_connect_on(){
69 bool connected(int a
,int b
);
70 static const unsigned int wl
[wl_seq_length_2d
*wl_hgridsq_2d
];
71 bool contains_neighbor(const char* format
);
72 // bool contains_neighbor_global(const char* format);
73 voro_base_2d(int nx_
,int ny_
,double boxx_
,double boxy_
);
74 ~voro_base_2d() {delete [] mrad
;}
76 /** A custom int function that returns consistent stepping
77 * for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps
79 * \param[in] a the number to consider.
80 * \return The value of the custom int operation. */
81 inline int step_int(double a
) {return a
<0?int(a
)-1:int(a
);}
82 /** A custom modulo function that returns consistent stepping
83 * for negative numbers. For example, (-2,-1,0,1,2) step_mod 2
85 * \param[in] (a,b) the input integers.
86 * \return The value of a modulo b, consistent for negative
88 inline int step_mod(int a
,int b
) {return a
>=0?a
%b
:b
-1-(b
-1-a
)%b
;}
89 /** A custom integer division function that returns consistent
90 * stepping for negative numbers. For example, (-2,-1,0,1,2)
91 * step_div 2 is (-1,-1,0,0,1).
92 * \param[in] (a,b) the input integers.
93 * \return The value of a div b, consistent for negative
95 inline int step_div(int a
,int b
) {return a
>=0?a
/b
:-1+(a
+1)/b
;}
97 void compute_minimum(double &minr
,double &xlo
,double &xhi
,double &ylo
,double &yhi
,int ti
,int tj
);