Voro++
Main Page
Data Structures
Files
File List
Globals
v_compute.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 :
[email protected]
5
// Date : August 30th 2011
6
7
/** \file v_compute.hh
8
* \brief Header file for the voro_compute template and related classes. */
9
10
#ifndef VOROPP_V_COMPUTE_HH
11
#define VOROPP_V_COMPUTE_HH
12
13
#include "
config.hh
"
14
#include "
worklist.hh
"
15
#include "
cell.hh
"
16
17
namespace
voro {
18
19
/** \brief Structure for holding information about a particle.
20
*
21
* This small structure holds information about a single particle, and is used
22
* by several of the routines in the voro_compute template for passing
23
* information by reference between functions. */
24
struct
particle_record
{
25
/** The index of the block that the particle is within. */
26
int
ijk
;
27
/** The number of particle within its block. */
28
int
l
;
29
/** The x-index of the block. */
30
int
di
;
31
/** The y-index of the block. */
32
int
dj
;
33
/** The z-index of the block. */
34
int
dk
;
35
};
36
37
/** \brief Template for carrying out Voronoi cell computations. */
38
template
<
class
c_
class
>
39
class
voro_compute
{
40
public
:
41
/** A reference to the container class on which to carry out*/
42
c_class &
con
;
43
/** The size of an internal computational block in the x
44
* direction. */
45
const
double
boxx
;
46
/** The size of an internal computational block in the y
47
* direction. */
48
const
double
boxy
;
49
/** The size of an internal computational block in the z
50
* direction. */
51
const
double
boxz
;
52
/** The inverse box length in the x direction, set to
53
* nx/(bx-ax). */
54
const
double
xsp
;
55
/** The inverse box length in the y direction, set to
56
* ny/(by-ay). */
57
const
double
ysp
;
58
/** The inverse box length in the z direction, set to
59
* nz/(bz-az). */
60
const
double
zsp
;
61
/** The number of boxes in the x direction for the searching mask. */
62
const
int
hx
;
63
/** The number of boxes in the y direction for the searching mask. */
64
const
int
hy
;
65
/** The number of boxes in the z direction for the searching mask. */
66
const
int
hz
;
67
/** A constant, set to the value of hx multiplied by hy, which
68
* is used in the routines which step through mask boxes in
69
* sequence. */
70
const
int
hxy
;
71
/** A constant, set to the value of hx*hy*hz, which is used in
72
* the routines which step through mask boxes in sequence. */
73
const
int
hxyz
;
74
/** The number of floating point entries to store for each
75
* particle. */
76
const
int
ps
;
77
/** This array holds the numerical IDs of each particle in each
78
* computational box. */
79
int
**
id
;
80
/** A two dimensional array holding particle positions. For the
81
* derived container_poly class, this also holds particle
82
* radii. */
83
double
**
p
;
84
/** An array holding the number of particles within each
85
* computational box of the container. */
86
int
*
co
;
87
voro_compute
(c_class &con_,
int
hx_,
int
hy_,
int
hz_);
88
/** The class destructor frees the dynamically allocated memory
89
* for the mask and queue. */
90
~voro_compute
() {
91
delete
[] qu;
92
delete
[] mask;
93
}
94
template
<
class
v_cell>
95
bool
compute_cell
(v_cell &c,
int
ijk,
int
s,
int
ci,
int
cj,
int
ck);
96
void
find_voronoi_cell
(
double
x,
double
y,
double
z,
int
ci,
int
cj,
int
ck,
int
ijk,
particle_record
&w,
double
&mrs);
97
private
:
98
/** A constant set to boxx*boxx+boxy*boxy+boxz*boxz, which is
99
* frequently used in the computation. */
100
const
double
bxsq;
101
/** This sets the current value being used to mark tested blocks
102
* in the mask. */
103
unsigned
int
mv;
104
/** The current size of the search list. */
105
int
qu_size;
106
/** A pointer to the array of worklists. */
107
const
unsigned
int
*wl;
108
/** An pointer to the array holding the minimum distances
109
* associated with the worklists. */
110
double
*mrad;
111
/** This array is used during the cell computation to determine
112
* which blocks have been considered. */
113
unsigned
int
*mask;
114
/** An array is used to store the queue of blocks to test
115
* during the Voronoi cell computation. */
116
int
*qu;
117
/** A pointer to the end of the queue array, used to determine
118
* when the queue is full. */
119
int
*qu_l;
120
template
<
class
v_cell>
121
bool
corner_test(v_cell &c,
double
xl,
double
yl,
double
zl,
double
xh,
double
yh,
double
zh);
122
template
<
class
v_cell>
123
inline
bool
edge_x_test(v_cell &c,
double
x0,
double
yl,
double
zl,
double
x1,
double
yh,
double
zh);
124
template
<
class
v_cell>
125
inline
bool
edge_y_test(v_cell &c,
double
xl,
double
y0,
double
zl,
double
xh,
double
y1,
double
zh);
126
template
<
class
v_cell>
127
inline
bool
edge_z_test(v_cell &c,
double
xl,
double
yl,
double
z0,
double
xh,
double
yh,
double
z1);
128
template
<
class
v_cell>
129
inline
bool
face_x_test(v_cell &c,
double
xl,
double
y0,
double
z0,
double
y1,
double
z1);
130
template
<
class
v_cell>
131
inline
bool
face_y_test(v_cell &c,
double
x0,
double
yl,
double
z0,
double
x1,
double
z1);
132
template
<
class
v_cell>
133
inline
bool
face_z_test(v_cell &c,
double
x0,
double
y0,
double
zl,
double
x1,
double
y1);
134
bool
compute_min_max_radius(
int
di,
int
dj,
int
dk,
double
fx,
double
fy,
double
fz,
double
gx,
double
gy,
double
gz,
double
& crs,
double
mrs);
135
bool
compute_min_radius(
int
di,
int
dj,
int
dk,
double
fx,
double
fy,
double
fz,
double
mrs);
136
inline
void
add_to_mask(
int
ei,
int
ej,
int
ek,
int
*&qu_e);
137
inline
void
scan_bits_mask_add(
unsigned
int
q,
unsigned
int
*mijk,
int
ei,
int
ej,
int
ek,
int
*&qu_e);
138
inline
void
scan_all(
int
ijk,
double
x,
double
y,
double
z,
int
di,
int
dj,
int
dk,
particle_record
&w,
double
&mrs);
139
void
add_list_memory(
int
*& qu_s,
int
*& qu_e);
140
/** Resets the mask in cases where the mask counter wraps
141
* around. */
142
inline
void
reset_mask() {
143
for
(
unsigned
int
*mp(mask);mp<mask+
hxyz
;mp++) *mp=0;
144
}
145
};
146
147
}
148
149
#endif
voro::particle_record::dk
int dk
Definition:
v_compute.hh:34
voro::voro_compute::find_voronoi_cell
void find_voronoi_cell(double x, double y, double z, int ci, int cj, int ck, int ijk, particle_record &w, double &mrs)
Definition:
v_compute.cc:71
voro::voro_compute::compute_cell
bool compute_cell(v_cell &c, int ijk, int s, int ci, int cj, int ck)
Definition:
v_compute.cc:291
voro::voro_compute::hxy
const int hxy
Definition:
v_compute.hh:70
voro::particle_record
Structure for holding information about a particle.
Definition:
v_compute.hh:24
voro::voro_compute::xsp
const double xsp
Definition:
v_compute.hh:54
voro::voro_compute::boxz
const double boxz
Definition:
v_compute.hh:51
voro::voro_compute::co
int * co
Definition:
v_compute.hh:86
cell.hh
Header file for the voronoicell and related classes.
config.hh
Master configuration file for setting various compile-time options.
voro::voro_compute::ysp
const double ysp
Definition:
v_compute.hh:57
voro::voro_compute::hxyz
const int hxyz
Definition:
v_compute.hh:73
voro::voro_compute::~voro_compute
~voro_compute()
Definition:
v_compute.hh:90
voro::voro_compute::voro_compute
voro_compute(c_class &con_, int hx_, int hy_, int hz_)
Definition:
v_compute.cc:23
voro::voro_compute::con
c_class & con
Definition:
v_compute.hh:42
voro::voro_compute::zsp
const double zsp
Definition:
v_compute.hh:60
voro::particle_record::di
int di
Definition:
v_compute.hh:30
voro::voro_compute::hz
const int hz
Definition:
v_compute.hh:66
voro::voro_compute::p
double ** p
Definition:
v_compute.hh:83
voro::particle_record::ijk
int ijk
Definition:
v_compute.hh:26
voro::voro_compute::ps
const int ps
Definition:
v_compute.hh:76
voro::particle_record::l
int l
Definition:
v_compute.hh:28
voro::voro_compute::boxx
const double boxx
Definition:
v_compute.hh:45
voro::voro_compute::hx
const int hx
Definition:
v_compute.hh:62
voro::voro_compute::boxy
const double boxy
Definition:
v_compute.hh:48
voro::voro_compute
Template for carrying out Voronoi cell computations.
Definition:
v_compute.hh:39
voro::voro_compute::id
int ** id
Definition:
v_compute.hh:79
voro::particle_record::dj
int dj
Definition:
v_compute.hh:32
worklist.hh
Header file for setting constants used in the block worklists that are used during cell computation...
voro::voro_compute::hy
const int hy
Definition:
v_compute.hh:64
Generated on Thu Oct 17 2013 11:31:45 for Voro++ by
1.8.5