22 template<
class c_
class>
24 con(con_), boxx(con_.boxx), boxy(con_.boxy), boxz(con_.boxz),
25 xsp(con_.xsp), ysp(con_.ysp), zsp(con_.zsp),
26 hx(hx_), hy(hy_), hz(hz_), hxy(hx_*hy_), hxyz(hxy*hz_), ps(con_.ps),
27 id(con_.id), p(con_.p), co(con_.co), bxsq(boxx*boxx+boxy*boxy+boxz*boxz),
28 mv(0), qu_size(3*(3+hxy+hz*(hx+hy))), wl(con_.wl), mrad(con_.mrad),
29 mask(new unsigned int[hxyz]), qu(new int[qu_size]), qu_l(qu+qu_size) {
46 template<
class c_
class>
48 double x1,y1,z1,rs;
bool in_block=
false;
49 for(
int l=0;l<co[ijk];l++) {
53 rs=con.r_current_sub(x1*x1+y1*y1+z1*z1,ijk,l);
54 if(rs<mrs) {mrs=rs;w.
l=l;in_block=
true;}
56 if(in_block) {w.
ijk=ijk;w.
di=di;w.
dj=dj,w.
dk=dk;}
70 template<
class c_
class>
72 double qx=0,qy=0,qz=0,rs;
73 int i,j,k,di,dj,dk,ei,ej,ek,f,g,disp;
74 double fx,fy,fz,mxs,mys,mzs,*radp;
75 unsigned int q,*e,*mijk;
78 w.
ijk=-1;mrs=large_number;
80 con.initialize_search(ci,cj,ck,ijk,i,j,k,disp);
83 scan_all(ijk,x,y,z,0,0,0,w,mrs);
89 con.frac_pos(x,y,z,ci,cj,ck,fx,fy,fz);
90 di=int(fx*xsp*wl_fgrid);dj=int(fy*ysp*wl_fgrid);dk=int(fz*zsp*wl_fgrid);
101 m1=127+(3<<21);m2=1+(1<<21);di=wl_fgrid-1-di;
if(di<0) di=0;
102 }
else {m1=m2=0;mxs=fx;}
105 m1|=(127<<7)+(3<<24);m2|=(1<<7)+(1<<24);dj=wl_fgrid-1-dj;
if(dj<0) dj=0;
109 m1|=(127<<14)+(3<<27);m2|=(1<<14)+(1<<27);dk=wl_fgrid-1-dk;
if(dk<0) dk=0;
114 rs=con.r_max_add(mrs);
115 if(mxs*mxs>rs&&mys*mys>rs&&mzs*mzs>rs)
return;
119 ijk=di+wl_hgrid*(dj+wl_hgrid*dk);
120 radp=mrad+ijk*wl_seq_length;
121 e=(
const_cast<unsigned int*
> (wl))+ijk*wl_seq_length;
130 if(con.r_max_add(mrs)<radp[g])
return;
138 dj=(q>>7)&127;dj-=64;
139 dk=(q>>14)&127;dk-=64;
142 ei=di+i;
if(ei<0||ei>=hx)
continue;
143 ej=dj+j;
if(ej<0||ej>=hy)
continue;
144 ek=dk+k;
if(ek<0||ek>=hz)
continue;
151 if(compute_min_radius(di,dj,dk,fx,fy,fz,mrs))
continue;
155 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
161 scan_all(ijk,x-qx,y-qy,z-qz,di,dj,dk,w,mrs);
166 if(mv==0) {reset_mask();mv=1;}
167 int *qu_s=qu,*qu_e=qu;
169 while(g<wl_seq_length-1) {
173 if(con.r_max_add(mrs)<radp[g])
return;
181 dj=(q>>7)&127;dj-=64;
182 dk=(q>>14)&127;dk-=64;
187 ei=di+i;
if(ei<0||ei>=hx)
continue;
188 ej=dj+j;
if(ej<0||ej>=hy)
continue;
189 ek=dk+k;
if(ek<0||ek>=hz)
continue;
190 mijk=mask+ei+hx*(ej+hy*ek);
195 if(compute_min_radius(di,dj,dk,fx,fy,fz,mrs))
continue;
199 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
200 scan_all(ijk,x-qx,y-qy,z-qz,di,dj,dk,w,mrs);
202 if(qu_e>qu_l-18) add_list_memory(qu_s,qu_e);
203 scan_bits_mask_add(q,mijk,ei,ej,ek,qu_e);
207 if(con.r_max_add(mrs)<radp[g])
return;
215 if(qu_s==qu_l) qu_s=qu;
216 ei=*(qu_s++);ej=*(qu_s++);ek=*(qu_s++);
217 di=ei-i;dj=ej-j;dk=ek-k;
218 if(compute_min_radius(di,dj,dk,fx,fy,fz,mrs))
continue;
220 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
221 scan_all(ijk,x-qx,y-qy,z-qz,di,dj,dk,w,mrs);
225 if((qu_s<=qu_e?(qu_l-qu_e)+(qu_s-qu):qu_s-qu_e)<18) add_list_memory(qu_s,qu_e);
226 add_to_mask(ei,ej,ek,qu_e);
235 template<
class c_
class>
237 unsigned int *mijk=mask+ei+hx*(ej+hy*ek);
238 if(ek>0)
if(*(mijk-hxy)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk-hxy)=mv;*(qu_e++)=ei;*(qu_e++)=ej;*(qu_e++)=ek-1;}
239 if(ej>0)
if(*(mijk-hx)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk-hx)=mv;*(qu_e++)=ei;*(qu_e++)=ej-1;*(qu_e++)=ek;}
240 if(ei>0)
if(*(mijk-1)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk-1)=mv;*(qu_e++)=ei-1;*(qu_e++)=ej;*(qu_e++)=ek;}
241 if(ei<hx-1)
if(*(mijk+1)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk+1)=mv;*(qu_e++)=ei+1;*(qu_e++)=ej;*(qu_e++)=ek;}
242 if(ej<hy-1)
if(*(mijk+hx)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk+hx)=mv;*(qu_e++)=ei;*(qu_e++)=ej+1;*(qu_e++)=ek;}
243 if(ek<hz-1)
if(*(mijk+hxy)!=mv) {
if(qu_e==qu_l) qu_e=qu;*(mijk+hxy)=mv;*(qu_e++)=ei;*(qu_e++)=ej;*(qu_e++)=ek+1;}
249 template<
class c_
class>
250 inline void voro_compute<c_class>::scan_bits_mask_add(
unsigned int q,
unsigned int *mijk,
int ei,
int ej,
int ek,
int *&qu_e) {
251 const unsigned int b1=1<<21,b2=1<<22,b3=1<<24,b4=1<<25,b5=1<<27,b6=1<<28;
253 if(ei>0) {*(mijk-1)=mv;*(qu_e++)=ei-1;*(qu_e++)=ej;*(qu_e++)=ek;}
254 if((q&b1)==0&&ei<hx-1) {*(mijk+1)=mv;*(qu_e++)=ei+1;*(qu_e++)=ej;*(qu_e++)=ek;}
255 }
else if((q&b1)==b1&&ei<hx-1) {*(mijk+1)=mv;*(qu_e++)=ei+1;*(qu_e++)=ej;*(qu_e++)=ek;}
257 if(ej>0) {*(mijk-hx)=mv;*(qu_e++)=ei;*(qu_e++)=ej-1;*(qu_e++)=ek;}
258 if((q&b3)==0&&ej<hy-1) {*(mijk+hx)=mv;*(qu_e++)=ei;*(qu_e++)=ej+1;*(qu_e++)=ek;}
259 }
else if((q&b3)==b3&&ej<hy-1) {*(mijk+hx)=mv;*(qu_e++)=ei;*(qu_e++)=ej+1;*(qu_e++)=ek;}
261 if(ek>0) {*(mijk-hxy)=mv;*(qu_e++)=ei;*(qu_e++)=ej;*(qu_e++)=ek-1;}
262 if((q&b5)==0&&ek<hz-1) {*(mijk+hxy)=mv;*(qu_e++)=ei;*(qu_e++)=ej;*(qu_e++)=ek+1;}
263 }
else if((q&b5)==b5&&ek<hz-1) {*(mijk+hxy)=mv;*(qu_e++)=ei;*(qu_e++)=ej;*(qu_e++)=ek+1;}
289 template<
class c_
class>
290 template<
class v_cell>
292 static const int count_list[8]={7,11,15,19,26,35,45,59},*count_e=count_list+8;
293 double x,y,z,x1,y1,z1,qx=0,qy=0,qz=0;
294 double xlo,ylo,zlo,xhi,yhi,zhi,x2,y2,z2,rs;
295 int i,j,k,di,dj,dk,ei,ej,ek,f,g,l,disp;
296 double fx,fy,fz,gxs,gys,gzs,*radp;
297 unsigned int q,*e,*mijk;
299 if(!con.initialize_voronoicell(c,ijk,s,ci,cj,ck,i,j,k,x,y,z,disp))
return false;
305 int next_count=3,*count_p=(
const_cast<int*
> (count_list));
312 rs=con.r_scale(x1*x1+y1*y1+z1*z1,ijk,l);
313 if(!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
320 rs=con.r_scale(x1*x1+y1*y1+z1*z1,ijk,l);
321 if(!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
328 mrs=c.max_radius_squared();
334 con.frac_pos(x,y,z,ci,cj,ck,fx,fy,fz);
335 di=int(fx*xsp*wl_fgrid);dj=int(fy*ysp*wl_fgrid);dk=int(fz*zsp*wl_fgrid);
346 m1=127+(3<<21);m2=1+(1<<21);di=wl_fgrid-1-di;
if(di<0) di=0;
347 }
else {m1=m2=0;gxs=boxx-fx;}
350 m1|=(127<<7)+(3<<24);m2|=(1<<7)+(1<<24);dj=wl_fgrid-1-dj;
if(dj<0) dj=0;
354 m1|=(127<<14)+(3<<27);m2|=(1<<14)+(1<<27);dk=wl_fgrid-1-dk;
if(dk<0) dk=0;
356 gxs*=gxs;gys*=gys;gzs*=gzs;
360 ijk=di+wl_hgrid*(dj+wl_hgrid*dk);
361 radp=mrad+ijk*wl_seq_length;
362 e=(
const_cast<unsigned int*
> (wl))+ijk*wl_seq_length;
372 mrs=c.max_radius_squared();
373 if(count_p!=count_e) next_count=*(count_p++);
378 if(con.r_ctest(radp[g],mrs))
return true;
386 dj=(q>>7)&127;dj-=64;
387 dk=(q>>14)&127;dk-=64;
390 ei=di+i;
if(ei<0||ei>=hx)
continue;
391 ej=dj+j;
if(ej<0||ej>=hy)
continue;
392 ek=dk+k;
if(ek<0||ek>=hz)
continue;
399 if(compute_min_max_radius(di,dj,dk,fx,fy,fz,gxs,gys,gzs,crs,mrs))
continue;
403 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
410 l=0;x2=x-qx;y2=y-qy;z2=z-qz;
411 if(!con.r_ctest(crs,mrs)) {
414 y1=p[ijk][ps*l+1]-y2;
415 z1=p[ijk][ps*l+2]-z2;
416 rs=con.r_scale(x1*x1+y1*y1+z1*z1,ijk,l);
417 if(!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
423 y1=p[ijk][ps*l+1]-y2;
424 z1=p[ijk][ps*l+2]-z2;
425 rs=x1*x1+y1*y1+z1*z1;
426 if(con.r_scale_check(rs,mrs,ijk,l)&&!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
444 if(mv==0) {reset_mask();mv=1;}
447 int *qu_s=qu,*qu_e=qu;
449 while(g<wl_seq_length-1) {
454 mrs=c.max_radius_squared();
455 if(count_p!=count_e) next_count=*(count_p++);
460 if(con.r_ctest(radp[g],mrs))
return true;
468 dj=(q>>7)&127;dj-=64;
469 dk=(q>>14)&127;dk-=64;
474 ei=di+i;
if(ei<0||ei>=hx)
continue;
475 ej=dj+j;
if(ej<0||ej>=hy)
continue;
476 ek=dk+k;
if(ek<0||ek>=hz)
continue;
477 mijk=mask+ei+hx*(ej+hy*ek);
485 if(compute_min_max_radius(di,dj,dk,fx,fy,fz,gxs,gys,gzs,crs,mrs))
continue;
489 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
496 l=0;x2=x-qx;y2=y-qy;z2=z-qz;
497 if(!con.r_ctest(crs,mrs)) {
500 y1=p[ijk][ps*l+1]-y2;
501 z1=p[ijk][ps*l+2]-z2;
502 rs=con.r_scale(x1*x1+y1*y1+z1*z1,ijk,l);
503 if(!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
509 y1=p[ijk][ps*l+1]-y2;
510 z1=p[ijk][ps*l+2]-z2;
511 rs=x1*x1+y1*y1+z1*z1;
512 if(con.r_scale_check(rs,mrs,ijk,l)&&!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
520 if(qu_e>qu_l-18) add_list_memory(qu_s,qu_e);
525 scan_bits_mask_add(q,mijk,ei,ej,ek,qu_e);
529 if(con.r_ctest(radp[g],mrs))
return true;
538 if(qu_s==qu_l) qu_s=qu;
542 ei=*(qu_s++);ej=*(qu_s++);ek=*(qu_s++);
543 xlo=(ei-i)*boxx-fx;xhi=xlo+boxx;
544 ylo=(ej-j)*boxy-fy;yhi=ylo+boxy;
545 zlo=(ek-k)*boxz-fz;zhi=zlo+boxz;
551 if(ek>k) {
if(corner_test(c,xlo,ylo,zlo,xhi,yhi,zhi))
continue;}
552 else if(ek<k) {
if(corner_test(c,xlo,ylo,zhi,xhi,yhi,zlo))
continue;}
553 else {
if(edge_z_test(c,xlo,ylo,zlo,xhi,yhi,zhi))
continue;}
555 if(ek>k) {
if(corner_test(c,xlo,yhi,zlo,xhi,ylo,zhi))
continue;}
556 else if(ek<k) {
if(corner_test(c,xlo,yhi,zhi,xhi,ylo,zlo))
continue;}
557 else {
if(edge_z_test(c,xlo,yhi,zlo,xhi,ylo,zhi))
continue;}
559 if(ek>k) {
if(edge_y_test(c,xlo,ylo,zlo,xhi,yhi,zhi))
continue;}
560 else if(ek<k) {
if(edge_y_test(c,xlo,ylo,zhi,xhi,yhi,zlo))
continue;}
561 else {
if(face_x_test(c,xlo,ylo,zlo,yhi,zhi))
continue;}
565 if(ek>k) {
if(corner_test(c,xhi,ylo,zlo,xlo,yhi,zhi))
continue;}
566 else if(ek<k) {
if(corner_test(c,xhi,ylo,zhi,xlo,yhi,zlo))
continue;}
567 else {
if(edge_z_test(c,xhi,ylo,zlo,xlo,yhi,zhi))
continue;}
569 if(ek>k) {
if(corner_test(c,xhi,yhi,zlo,xlo,ylo,zhi))
continue;}
570 else if(ek<k) {
if(corner_test(c,xhi,yhi,zhi,xlo,ylo,zlo))
continue;}
571 else {
if(edge_z_test(c,xhi,yhi,zlo,xlo,ylo,zhi))
continue;}
573 if(ek>k) {
if(edge_y_test(c,xhi,ylo,zlo,xlo,yhi,zhi))
continue;}
574 else if(ek<k) {
if(edge_y_test(c,xhi,ylo,zhi,xlo,yhi,zlo))
continue;}
575 else {
if(face_x_test(c,xhi,ylo,zlo,yhi,zhi))
continue;}
579 if(ek>k) {
if(edge_x_test(c,xlo,ylo,zlo,xhi,yhi,zhi))
continue;}
580 else if(ek<k) {
if(edge_x_test(c,xlo,ylo,zhi,xhi,yhi,zlo))
continue;}
581 else {
if(face_y_test(c,xlo,ylo,zlo,xhi,zhi))
continue;}
583 if(ek>k) {
if(edge_x_test(c,xlo,yhi,zlo,xhi,ylo,zhi))
continue;}
584 else if(ek<k) {
if(edge_x_test(c,xlo,yhi,zhi,xhi,ylo,zlo))
continue;}
585 else {
if(face_y_test(c,xlo,yhi,zlo,xhi,zhi))
continue;}
587 if(ek>k) {
if(face_z_test(c,xlo,ylo,zlo,xhi,yhi))
continue;}
588 else if(ek<k) {
if(face_z_test(c,xlo,ylo,zhi,xhi,yhi))
continue;}
589 else voro_fatal_error(
"Compute cell routine revisiting central block, which should never\nhappen.",
VOROPP_INTERNAL_ERROR);
595 ijk=con.region_index(ci,cj,ck,ei,ej,ek,qx,qy,qz,disp);
601 l=0;x2=x-qx;y2=y-qy;z2=z-qz;
604 y1=p[ijk][ps*l+1]-y2;
605 z1=p[ijk][ps*l+2]-z2;
606 rs=con.r_scale(x1*x1+y1*y1+z1*z1,ijk,l);
607 if(!c.nplane(x1,y1,z1,rs,
id[ijk][l]))
return false;
613 if((qu_s<=qu_e?(qu_l-qu_e)+(qu_s-qu):qu_s-qu_e)<18) add_list_memory(qu_s,qu_e);
617 add_to_mask(ei,ej,ek,qu_e);
632 template<
class c_
class>
633 template<
class v_cell>
635 con.r_prime(xl*xl+yl*yl+zl*zl);
636 if(c.plane_intersects_guess(xh,yl,zl,con.r_cutoff(xl*xh+yl*yl+zl*zl)))
return false;
637 if(c.plane_intersects(xh,yh,zl,con.r_cutoff(xl*xh+yl*yh+zl*zl)))
return false;
638 if(c.plane_intersects(xl,yh,zl,con.r_cutoff(xl*xl+yl*yh+zl*zl)))
return false;
639 if(c.plane_intersects(xl,yh,zh,con.r_cutoff(xl*xl+yl*yh+zl*zh)))
return false;
640 if(c.plane_intersects(xl,yl,zh,con.r_cutoff(xl*xl+yl*yl+zl*zh)))
return false;
641 if(c.plane_intersects(xh,yl,zh,con.r_cutoff(xl*xh+yl*yl+zl*zh)))
return false;
657 template<
class c_
class>
658 template<
class v_cell>
659 inline bool voro_compute<c_class>::edge_x_test(v_cell &c,
double x0,
double yl,
double zl,
double x1,
double yh,
double zh) {
660 con.r_prime(yl*yl+zl*zl);
661 if(c.plane_intersects_guess(x0,yl,zh,con.r_cutoff(yl*yl+zl*zh)))
return false;
662 if(c.plane_intersects(x1,yl,zh,con.r_cutoff(yl*yl+zl*zh)))
return false;
663 if(c.plane_intersects(x1,yl,zl,con.r_cutoff(yl*yl+zl*zl)))
return false;
664 if(c.plane_intersects(x0,yl,zl,con.r_cutoff(yl*yl+zl*zl)))
return false;
665 if(c.plane_intersects(x0,yh,zl,con.r_cutoff(yl*yh+zl*zl)))
return false;
666 if(c.plane_intersects(x1,yh,zl,con.r_cutoff(yl*yh+zl*zl)))
return false;
682 template<
class c_
class>
683 template<
class v_cell>
684 inline bool voro_compute<c_class>::edge_y_test(v_cell &c,
double xl,
double y0,
double zl,
double xh,
double y1,
double zh) {
685 con.r_prime(xl*xl+zl*zl);
686 if(c.plane_intersects_guess(xl,y0,zh,con.r_cutoff(xl*xl+zl*zh)))
return false;
687 if(c.plane_intersects(xl,y1,zh,con.r_cutoff(xl*xl+zl*zh)))
return false;
688 if(c.plane_intersects(xl,y1,zl,con.r_cutoff(xl*xl+zl*zl)))
return false;
689 if(c.plane_intersects(xl,y0,zl,con.r_cutoff(xl*xl+zl*zl)))
return false;
690 if(c.plane_intersects(xh,y0,zl,con.r_cutoff(xl*xh+zl*zl)))
return false;
691 if(c.plane_intersects(xh,y1,zl,con.r_cutoff(xl*xh+zl*zl)))
return false;
706 template<
class c_
class>
707 template<
class v_cell>
708 inline bool voro_compute<c_class>::edge_z_test(v_cell &c,
double xl,
double yl,
double z0,
double xh,
double yh,
double z1) {
709 con.r_prime(xl*xl+yl*yl);
710 if(c.plane_intersects_guess(xl,yh,z0,con.r_cutoff(xl*xl+yl*yh)))
return false;
711 if(c.plane_intersects(xl,yh,z1,con.r_cutoff(xl*xl+yl*yh)))
return false;
712 if(c.plane_intersects(xl,yl,z1,con.r_cutoff(xl*xl+yl*yl)))
return false;
713 if(c.plane_intersects(xl,yl,z0,con.r_cutoff(xl*xl+yl*yl)))
return false;
714 if(c.plane_intersects(xh,yl,z0,con.r_cutoff(xl*xh+yl*yl)))
return false;
715 if(c.plane_intersects(xh,yl,z1,con.r_cutoff(xl*xh+yl*yl)))
return false;
729 template<
class c_
class>
730 template<
class v_cell>
731 inline bool voro_compute<c_class>::face_x_test(v_cell &c,
double xl,
double y0,
double z0,
double y1,
double z1) {
733 if(c.plane_intersects_guess(xl,y0,z0,con.r_cutoff(xl*xl)))
return false;
734 if(c.plane_intersects(xl,y0,z1,con.r_cutoff(xl*xl)))
return false;
735 if(c.plane_intersects(xl,y1,z1,con.r_cutoff(xl*xl)))
return false;
736 if(c.plane_intersects(xl,y1,z0,con.r_cutoff(xl*xl)))
return false;
750 template<
class c_
class>
751 template<
class v_cell>
752 inline bool voro_compute<c_class>::face_y_test(v_cell &c,
double x0,
double yl,
double z0,
double x1,
double z1) {
754 if(c.plane_intersects_guess(x0,yl,z0,con.r_cutoff(yl*yl)))
return false;
755 if(c.plane_intersects(x0,yl,z1,con.r_cutoff(yl*yl)))
return false;
756 if(c.plane_intersects(x1,yl,z1,con.r_cutoff(yl*yl)))
return false;
757 if(c.plane_intersects(x1,yl,z0,con.r_cutoff(yl*yl)))
return false;
771 template<
class c_
class>
772 template<
class v_cell>
773 inline bool voro_compute<c_class>::face_z_test(v_cell &c,
double x0,
double y0,
double zl,
double x1,
double y1) {
775 if(c.plane_intersects_guess(x0,y0,zl,con.r_cutoff(zl*zl)))
return false;
776 if(c.plane_intersects(x0,y1,zl,con.r_cutoff(zl*zl)))
return false;
777 if(c.plane_intersects(x1,y1,zl,con.r_cutoff(zl*zl)))
return false;
778 if(c.plane_intersects(x1,y0,zl,con.r_cutoff(zl*zl)))
return false;
797 template<
class c_
class>
798 bool voro_compute<c_class>::compute_min_max_radius(
int di,
int dj,
int dk,
double fx,
double fy,
double fz,
double gxs,
double gys,
double gzs,
double &crs,
double mrs) {
808 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
809 crs+=bxsq+2*(boxx*xlo+boxy*ylo+boxz*zlo);
812 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
813 crs+=bxsq+2*(boxx*xlo+boxy*ylo-boxz*zlo);
815 if(con.r_ctest(crs,mrs))
return true;
816 crs+=boxx*(2*xlo+boxx)+boxy*(2*ylo+boxy)+gzs;
823 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
824 crs+=bxsq+2*(boxx*xlo-boxy*ylo+boxz*zlo);
827 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
828 crs+=bxsq+2*(boxx*xlo-boxy*ylo-boxz*zlo);
830 if(con.r_ctest(crs,mrs))
return true;
831 crs+=boxx*(2*xlo+boxx)+boxy*(-2*ylo+boxy)+gzs;
836 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
837 crs+=boxz*(2*zlo+boxz);
840 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
841 crs+=boxz*(-2*zlo+boxz);
843 if(con.r_ctest(crs,mrs))
return true;
846 crs+=gys+boxx*(2*xlo+boxx);
856 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
857 crs+=bxsq+2*(-boxx*xlo+boxy*ylo+boxz*zlo);
860 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
861 crs+=bxsq+2*(-boxx*xlo+boxy*ylo-boxz*zlo);
863 if(con.r_ctest(crs,mrs))
return true;
864 crs+=boxx*(-2*xlo+boxx)+boxy*(2*ylo+boxy)+gzs;
871 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
872 crs+=bxsq+2*(-boxx*xlo-boxy*ylo+boxz*zlo);
875 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
876 crs+=bxsq+2*(-boxx*xlo-boxy*ylo-boxz*zlo);
878 if(con.r_ctest(crs,mrs))
return true;
879 crs+=boxx*(-2*xlo+boxx)+boxy*(-2*ylo+boxy)+gzs;
884 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
885 crs+=boxz*(2*zlo+boxz);
888 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
889 crs+=boxz*(-2*zlo+boxz);
891 if(con.r_ctest(crs,mrs))
return true;
894 crs+=gys+boxx*(-2*xlo+boxx);
902 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
903 crs+=boxz*(2*zlo+boxz);
906 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
907 crs+=boxz*(-2*zlo+boxz);
909 if(con.r_ctest(crs,mrs))
return true;
912 crs+=boxy*(2*ylo+boxy);
918 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
919 crs+=boxz*(2*zlo+boxz);
922 crs+=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
923 crs+=boxz*(-2*zlo+boxz);
925 if(con.r_ctest(crs,mrs))
return true;
928 crs+=boxy*(-2*ylo+boxy);
931 zlo=dk*boxz-fz;crs=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
932 crs+=boxz*(2*zlo+boxz);
934 zlo=(dk+1)*boxz-fz;crs=zlo*zlo;
if(con.r_ctest(crs,mrs))
return true;
935 crs+=boxz*(-2*zlo+boxz);
938 voro_fatal_error(
"Min/max radius function called for central block, which should never\nhappen.",
VOROPP_INTERNAL_ERROR);
947 template<
class c_
class>
948 bool voro_compute<c_class>::compute_min_radius(
int di,
int dj,
int dk,
double fx,
double fy,
double fz,
double mrs) {
951 if(di>0) {t=di*boxx-fx;crs=t*t;}
952 else if(di<0) {t=(di+1)*boxx-fx;crs=t*t;}
955 if(dj>0) {t=dj*boxy-fy;crs+=t*t;}
956 else if(dj<0) {t=(dj+1)*boxy-fy;crs+=t*t;}
958 if(dk>0) {t=dk*boxz-fz;crs+=t*t;}
959 else if(dk<0) {t=(dk+1)*boxz-fz;crs+=t*t;}
961 return crs>con.r_max_add(mrs);
967 template<
class c_
class>
968 inline void voro_compute<c_class>::add_list_memory(
int*& qu_s,
int*& qu_e) {
970 int *qu_n=
new int[qu_size],*qu_c=qu_n;
971 #if VOROPP_VERBOSE >=2
972 fprintf(stderr,
"List memory scaled up to %d\n",qu_size);
975 while(qu_s<qu_e) *(qu_c++)=*(qu_s++);
977 while(qu_s<qu_l) *(qu_c++)=*(qu_s++);qu_s=qu;
978 while(qu_s<qu_e) *(qu_c++)=*(qu_s++);
void find_voronoi_cell(double x, double y, double z, int ci, int cj, int ck, int ijk, particle_record &w, double &mrs)
bool compute_cell(v_cell &c, int ijk, int s, int ci, int cj, int ck)
Structure for holding information about a particle.
Header file for the classes encapsulating functionality for the regular and radical Voronoi tessellat...
Header file for the voro_compute template and related classes.
#define VOROPP_INTERNAL_ERROR
Header file for the container_periodic_base and related classes.
voro_compute(c_class &con_, int hx_, int hy_, int hz_)
Header file for the container_base and related classes.
Template for carrying out Voronoi cell computations.
Header file for setting constants used in the block worklists that are used during cell computation...