10 #ifndef VOROPP_C_LOOPS_HH
11 #define VOROPP_C_LOOPS_HH
19 enum c_loop_subset_mode {
52 :
o(new int[init_size<<1]),
op(
o),
size(init_size) {}
63 inline void add(
int ijk,
int q) {
64 if(
op==
o+
size) add_ordering_memory();
65 *(
op++)=ijk;*(
op++)=q;
68 void add_ordering_memory();
123 template<
class c_
class>
130 inline void pos(
double &
x,
double &
y,
double &
z) {
132 x=*(pp++);y=*(pp++);z=*pp;
141 inline void pos(
int &
pid,
double &
x,
double &
y,
double &
z,
double &r) {
144 x=*(pp++);y=*(pp++);z=*pp;
145 r=
ps==3?default_radius:*(++pp);
170 template<
class c_
class>
177 while(
co[
ijk]==0)
if(!next_block())
return false;
188 if(!next_block())
return false;
198 inline bool next_block() {
227 template<
class c_
class>
229 sx(con.bx-ax), sy(con.by-ay), sz(con.bz-az), xsp(con.xsp), ysp(con.ysp), zsp(con.zsp),
230 xperiodic(con.xperiodic), yperiodic(con.yperiodic), zperiodic(con.zperiodic) {}
231 void setup_sphere(
double vx,
double vy,
double vz,
double r,
bool bounds_test=
true);
232 void setup_box(
double xmin,
double xmax,
double ymin,
double ymax,
double zmin,
double zmax,
bool bounds_test=
true);
233 void setup_intbox(
int ai_,
int bi_,
int aj_,
int bj_,
int ak_,
int bk_);
241 while(
q>=
co[
ijk]) {
q=0;
if(!next_block())
return false;}
242 }
while(
mode!=no_check&&out_of_bounds());
246 const double ax,ay,az,sx,sy,sz,xsp,ysp,zsp;
247 const bool xperiodic,yperiodic,zperiodic;
248 double px,py,pz,apx,apy,apz;
249 double v0,v1,v2,v3,v4,v5;
250 int ai,bi,aj,bj,ak,bk;
251 int ci,cj,ck,di,dj,dk,inc1,inc2;
252 inline int step_mod(
int a,
int b) {
return a>=0?a%b:b-1-(b-1-a)%b;}
253 inline int step_div(
int a,
int b) {
return a>=0?a/b:-1+(a+1)/b;}
254 inline int step_int(
double a) {
return a<0?int(a)-1:int(a);}
257 bool out_of_bounds();
281 template<
class c_
class>
290 ijk=*(
cp++);decode();
299 if(
cp==
op)
return false;
300 ijk=*(
cp++);decode();
311 inline void decode() {
330 template<
class c_
class>
332 ijk0(
nx*(ey+con.oy*ez)), inc2(2*
nx*con.ey+1) {}
342 while(
co[
ijk]==0)
if(!next_block())
return false;
353 if(!next_block())
return false;
381 inline bool next_block() {
387 if(
k==wz)
return false;
416 template<
class c_
class>
418 :
c_loop_base(con),
vo(vo_), nx(con.nx), oxy(con.nx*con.oy) {}
425 ijk=*(
cp++);decode();
434 if(
cp==
op)
return false;
435 ijk=*(
cp++);decode();
446 inline void decode() {
Class for looping over all of the particles in a container.
c_loop_base(c_class &con)
Master configuration file for setting various compile-time options.
c_loop_order_periodic(c_class &con, particle_order &vo_)
void setup_box(double xmin, double xmax, double ymin, double ymax, double zmin, double zmax, bool bounds_test=true)
Class for looping over all of the particles specified in a pre-assembled particle_order class...
Class for looping over all of the particles specified in a pre-assembled particle_order class...
void pos(double &x, double &y, double &z)
c_loop_order(c_class &con, particle_order &vo_)
void pos(int &pid, double &x, double &y, double &z, double &r)
Class for looping over a subset of particles in a container.
void setup_intbox(int ai_, int bi_, int aj_, int bj_, int ak_, int bk_)
c_loop_subset(c_class &con)
particle_order(int init_size=init_ordering_size)
Base class for looping over particles in a container.
A class for looping over all particles in a container_periodic or container_periodic_poly class...
void setup_sphere(double vx, double vy, double vz, double r, bool bounds_test=true)
A class for storing ordering information when particles are added to a container. ...
c_loop_all_periodic(c_class &con)