18 ai = (int)floor(((
BigReal)aDim)*((s.
x-aOrigin)/aLength));
19 bi = (int)floor(((
BigReal)bDim)*((s.
y-bOrigin)/bLength));
20 ci = (int)floor(((
BigReal)cDim)*((s.
z-cOrigin)/cLength));
25 #define MODULO(I,J) ( (I)<0 ? ((J)-(-1*(I))%(J))%(J) : (I)%(J) )
29 if ( aPeriodic ) aIndex =
MODULO(aIndex,aDim);
32 if ( aIndex < 0 ) aIndex = 0;
33 if ( aIndex >= aDim ) aIndex = aDim - 1;
35 if ( bPeriodic ) bIndex =
MODULO(bIndex,bDim);
38 if ( bIndex < 0 ) bIndex = 0;
39 if ( bIndex >= bDim ) bIndex = bDim - 1;
41 if ( cPeriodic ) cIndex =
MODULO(cIndex,cDim);
44 if ( cIndex < 0 ) cIndex = 0;
45 if ( cIndex >= cDim ) cIndex = cDim - 1;
47 return ((cIndex*bDim)+bIndex)*aDim + aIndex;
55 if ( pid1 == pid2 ) { ds = pid1; }
60 register PatchData *pdat1 = &(patchData[pid1]);
61 register PatchData *pdat2 = &(patchData[pid2]);
64 register int k = pdat1->cIndex;
65 register int k2 = pdat2->cIndex;
66 if ( ( k ? k : cMaxIndex ) == k2 + 1 ) k = k2;
69 register int j = pdat1->bIndex;
70 register int j2 = pdat2->bIndex;
71 if ( ( j ? j : bMaxIndex ) == j2 + 1 ) j = j2;
74 register int i = pdat1->aIndex;
75 register int i2 = pdat2->aIndex;
76 if ( ( i ? i : aMaxIndex ) == i2 + 1 ) i = i2;
78 ds = ((k*bDim)+j)*aDim + i;
PatchID assignToPatch(Position p, const Lattice &l)
int downstream(int pid1, int pid2)
int pid(int aIndex, int bIndex, int cIndex)
ScaledPosition scale(Position p) const