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"
18 /** \brief Class containing data structures common across all particle container classes.
20 * This class contains constants and data structures that are common across all
21 * particle container classes. It contains constants setting the size of the
22 * underlying subgrid of blocks that forms the basis of the Voronoi cell
23 * computations. It also constructs bound tables that are used in the Voronoi
24 * cell computation, and contains a number of routines that are common across
25 * all container classes. */
28 // /** total number of particles. */
30 /** The number of blocks in the x direction. */
32 /** The number of blocks in the y direction. */
34 /** A constant, set to the value of nx multiplied by ny, which
35 * is used in the routines that step through blocks in
38 /** The size of a computational block in the x direction. */
40 /** The size of a computational block in the y direction. */
42 /** The inverse box length in the x direction. */
44 /** The inverse box length in the y direction. */
46 /** An array to hold the minimum distances associated with the
47 * worklists. This array is initialized during container
48 * construction, by the initialize_radii() routine. */
50 // /** The pre-computed block worklists. */
51 // unsigned int *globne;
52 // /** global neighbor information */
53 // inline void init_globne(){
54 // globne = new unsigned int[((totpar*totpar)/32)+1];
55 // for(int i=0;i<((totpar*totpar)/32);i++){
59 // void add_globne_info(int pid, int *nel, int length);
60 // void print_globne(FILE *fp);
61 static const unsigned int wl
[wl_seq_length_2d
*wl_hgridsq_2d
];
62 bool contains_neighbor(const char* format
);
63 // bool contains_neighbor_global(const char* format);
64 voro_base_2d(int nx_
,int ny_
,double boxx_
,double boxy_
);
65 ~voro_base_2d() {delete [] mrad
;}
67 /** A custom int function that returns consistent stepping
68 * for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps
70 * \param[in] a the number to consider.
71 * \return The value of the custom int operation. */
72 inline int step_int(double a
) {return a
<0?int(a
)-1:int(a
);}
73 /** A custom modulo function that returns consistent stepping
74 * for negative numbers. For example, (-2,-1,0,1,2) step_mod 2
76 * \param[in] (a,b) the input integers.
77 * \return The value of a modulo b, consistent for negative
79 inline int step_mod(int a
,int b
) {return a
>=0?a
%b
:b
-1-(b
-1-a
)%b
;}
80 /** A custom integer division function that returns consistent
81 * stepping for negative numbers. For example, (-2,-1,0,1,2)
82 * step_div 2 is (-1,-1,0,0,1).
83 * \param[in] (a,b) the input integers.
84 * \return The value of a div b, consistent for negative
86 inline int step_div(int a
,int b
) {return a
>=0?a
/b
:-1+(a
+1)/b
;}
88 void compute_minimum(double &minr
,double &xlo
,double &xhi
,double &ylo
,double &yhi
,int ti
,int tj
);