direct.c
/* Build the scaled, extended Green's function grf on an expanded cubic grid
 * with values taken from the cache grc. */
Build the scaled, extended Green's function grf on an expanded cubic grid
with values taken from the cache grc.
Build the scaled extended Green ' s function grf on an expanded cubic grid with values taken from the cache grc .
int greengrid (cplx *grf, int m, int mex, int *off, real k0, cplx *grc) {
	int ip, jp, kp, l, mt, idx[3];
	real scale;
	mt = mex * mex * mex;
	scale = k0 * k0 / (real)mt;
	for (l = 0; l < mt; ++l) {
		GRID(idx, l, mex, mex);
		ip = (idx[0] < m) ? idx[0] : (idx[0] - mex);
		ip = abs (ip - off[0]);
		jp = (idx[1] < m) ? idx[1] : (idx[1] - mex);
		jp = abs (jp - off[1]);
		kp = (idx[2] < m) ? idx[2] : (idx[2] - mex);
		kp = abs (kp - off[2]);
		idx[0] = MAX(ip, MAX(jp, kp));
		idx[2] = MIN(ip, MIN(jp, kp));
		idx[1] = ip + jp + kp - idx[0] - idx[2];
		*(grf++) = scale * grc[PPYR(idx[0]) + PTRI(idx[1]) + idx[2]];
	}
	return mex;
}
int greengrid ( cplx * grf , int m , int mex , int * off , real k0 , cplx * grc ) { int ip , jp , kp , l , mt , idx [ 3 ] ; real scale ; mt = mex * mex * mex ; scale = k0 * k0 / ( real ) mt ; for ( l = 0 ; l < mt ; ++ l ) { GRID ( idx , l , mex , mex ) ; ip = ( idx [ 0 ] < m ) ? idx [ 0 ] : ( idx [ 0 ] - mex ) ; ip = abs ( ip - off [ 0 ] ) ; jp = ( idx [ 1 ] < m ) ? idx [ 1 ] : ( idx [ 1 ] - mex ) ; jp = abs ( jp - off [ 1 ] ) ; kp = ( idx [ 2 ] < m ) ? idx [ 2 ] : ( idx [ 2 ] - mex ) ; kp = abs ( kp - off [ 2 ] ) ; idx [ 0 ] = MAX ( ip , MAX ( jp , kp ) ) ; idx [ 2 ] = MIN ( ip , MIN ( jp , kp ) ) ; idx [ 1 ] = ip + jp + kp - idx [ 0 ] - idx [ 2 ] ; * ( grf ++ ) = scale * grc [ PPYR ( idx [ 0 ] ) + PTRI ( idx [ 1 ] ) + idx [ 2 ] ] ; } return mex ; }
Build the scaled, extended Green's function grf on an expanded cubic grid
 with values taken from the cache grc.
Build the scaled extended Green ' s function grf on an expanded cubic grid with values taken from the cache grc .
/* The total number of samples. */ /* The scale of the integral equation solution. */ /* Compute the interactions. */ /* Compute the source and observer separation in cell lengths. */ /* The maximum separation index gets stored in idx[0]. */ /* The minimum separation index gets stored in idx[2]. */ /* The middle (remaining) index gets stored in idx[1]. */ /* Copy the proper integration into place from the cache. */