Voro++: v_base.hh Source File

Voro++

- Main Page
- Data Structures
- Files

- File List
- Globals

v_base.hh
Go to the documentation of this file.
1 // Voro++, a 3D cell-based Voronoi library
2 //
3 // Author : Chris H. Rycroft (LBL / UC Berkeley)
4 // Email : chr@alum.mit.edu
5 // Date : August 30th 2011
6
7 /** \file v_base.hh
8 * \brief Header file for the base Voronoi container class. */
9
10 #ifndef VOROPP_V_BASE_HH
11 #define VOROPP_V_BASE_HH
12
13 #include "worklist.hh"
14
15 namespace voro {
16
17 /** \brief Class containing data structures common across all particle container classes.
18 *
19 * This class contains constants and data structures that are common across all
20 * particle container classes. It contains constants setting the size of the
21 * underlying subgrid of blocks that forms the basis of the Voronoi cell
22 * computations. It also constructs bound tables that are used in the Voronoi
23 * cell computation, and contains a number of routines that are common across
24 * all container classes. */
25 class voro_base {
26 public:
27 /** The number of blocks in the x direction. */
28 const int nx;
29 /** The number of blocks in the y direction. */
30 const int ny;
31 /** The number of blocks in the z direction. */
32 const int nz;
33 /** A constant, set to the value of nx multiplied by ny, which
34 * is used in the routines that step through blocks in
35 * sequence. */
36 const int nxy;
37 /** A constant, set to the value of nx*ny*nz, which is used in
38 * the routines that step through blocks in sequence. */
39 const int nxyz;
40 /** The size of a computational block in the x direction. */
41 const double boxx;
42 /** The size of a computational block in the y direction. */
43 const double boxy;
44 /** The size of a computational block in the z direction. */
45 const double boxz;
46 /** The inverse box length in the x direction. */
47 const double xsp;
48 /** The inverse box length in the y direction. */
49 const double ysp;
50 /** The inverse box length in the z direction. */
51 const double zsp;
52 /** An array to hold the minimum distances associated with the
53 * worklists. This array is initialized during container
54 * construction, by the initialize_radii() routine. */
55 double *mrad;
56 /** The pre-computed block worklists. */
57 static const unsigned int wl[wl_seq_length*wl_hgridcu];
58 bool contains_neighbor(const char* format);
59 voro_base(int nx_,int ny_,int nz_,double boxx_,double boxy_,double boxz_);
60 ~voro_base() {delete [] mrad;}
61 protected:
62 /** A custom int function that returns consistent stepping
63 * for negative numbers, so that (-1.5, -0.5, 0.5, 1.5) maps
64 * to (-2,-1,0,1).
65 * \param[in] a the number to consider.
66 * \return The value of the custom int operation. */
67 inline int step_int(double a) {return a<0?int(a)-1:int(a);}
68 /** A custom modulo function that returns consistent stepping
69 * for negative numbers. For example, (-2,-1,0,1,2) step_mod 2
70 * is (0,1,0,1,0).
71 * \param[in] (a,b) the input integers.
72 * \return The value of a modulo b, consistent for negative
73 * numbers. */
74 inline int step_mod(int a,int b) {return a>=0?a%b:b-1-(b-1-a)%b;}
75 /** A custom integer division function that returns consistent
76 * stepping for negative numbers. For example, (-2,-1,0,1,2)
77 * step_div 2 is (-1,-1,0,0,1).
78 * \param[in] (a,b) the input integers.
79 * \return The value of a div b, consistent for negative
80 * numbers. */
81 inline int step_div(int a,int b) {return a>=0?a/b:-1+(a+1)/b;}
82 private:
83 void compute_minimum(double &minr,double &xlo,double &xhi,double &ylo,double &yhi,double &zlo,double &zhi,int ti,int tj,int tk);
84 };
85
86 }
87
88 #endif
voro::voro_base
Class containing data structures common across all particle container classes.
Definition: v_base.hh:25
voro::voro_base::boxy
const double boxy
Definition: v_base.hh:43
voro::voro_base::step_mod
int step_mod(int a, int b)
Definition: v_base.hh:74
voro::voro_base::mrad
double * mrad
Definition: v_base.hh:55
voro::voro_base::voro_base
voro_base(int nx_, int ny_, int nz_, double boxx_, double boxy_, double boxz_)
Definition: v_base.cc:23
voro::voro_base::ysp
const double ysp
Definition: v_base.hh:49
voro::voro_base::contains_neighbor
bool contains_neighbor(const char *format)
Definition: v_base.cc:100
voro::voro_base::step_div
int step_div(int a, int b)
Definition: v_base.hh:81
voro::voro_base::nxyz
const int nxyz
Definition: v_base.hh:39
voro::voro_base::nxy
const int nxy
Definition: v_base.hh:36
voro::voro_base::boxx
const double boxx
Definition: v_base.hh:41
voro::voro_base::wl
static const unsigned int wl[wl_seq_length *wl_hgridcu]
Definition: v_base.hh:57
voro::voro_base::boxz
const double boxz
Definition: v_base.hh:45
voro::voro_base::xsp
const double xsp
Definition: v_base.hh:47
voro::voro_base::zsp
const double zsp
Definition: v_base.hh:51
voro::voro_base::ny
const int ny
Definition: v_base.hh:30
voro::voro_base::step_int
int step_int(double a)
Definition: v_base.hh:67
voro::voro_base::nz
const int nz
Definition: v_base.hh:32
worklist.hh
Header file for setting constants used in the block worklists that are used during cell computation...
voro::voro_base::nx
const int nx
Definition: v_base.hh:28