measure.c
/* Slow computation of incident field for a single source. */
Slow computation of incident field for a single source.
Slow computation of incident field for a single source .
int buildrhs (cplx *rhs, real *srcloc, int plane, real *dir) {
	real scale = 1.0, dc[3] = { fmaconf.cell, fmaconf.cell, fmaconf.cell };
	ifunc rhsfunc = fsgreen;
	if (plane) {
		rhsfunc = fsplane;
		scale = 1.0 / (4.0 * M_PI);
	}
#pragma omp parallel default(shared)
{
	cplx *rptr;
	real ctr[3], off[3];
	int i, j, idx[3];
#pragma omp for
	for (i = 0; i < fmaconf.numbases; ++i) {
		rptr = rhs + i * fmaconf.bspboxvol;
		bscenter (fmaconf.bslist[i], off);
		off[0] += 0.5 * fmaconf.cell - 0.5 * fmaconf.grplen;
		off[1] += 0.5 * fmaconf.cell - 0.5 * fmaconf.grplen;
		off[2] += 0.5 * fmaconf.cell - 0.5 * fmaconf.grplen;
		for (j = 0; j < fmaconf.bspboxvol; ++j, ++rptr) {
			GRID(idx, j, fmaconf.bspbox, fmaconf.bspbox);
			ctr[0] = off[0] + fmaconf.cell * (real)idx[0];
			ctr[1] = off[1] + fmaconf.cell * (real)idx[1];
			ctr[2] = off[2] + fmaconf.cell * (real)idx[2];
			*rptr = scale * srcint (fmaconf.k0, ctr, srcloc, dc, rhsfunc);
			if (dir && !plane)
				*rptr *= directivity(ctr, srcloc, dir, dir[3]);
		}
	}
}
	return 0;
}
int buildrhs ( cplx * rhs , real * srcloc , int plane , real * dir ) { real scale = 1.0 , dc [ 3 ] = { fmaconf . cell , fmaconf . cell , fmaconf . cell } ; ifunc rhsfunc = fsgreen ; if ( plane ) { rhsfunc = fsplane ; scale = 1.0 / ( 4.0 * M_PI ) ; } #pragma  omp parallel default(shared) { cplx * rptr ; real ctr [ 3 ] , off [ 3 ] ; int i , j , idx [ 3 ] ; #pragma  omp for for ( i = 0 ; i < fmaconf . numbases ; ++ i ) { rptr = rhs + i * fmaconf . bspboxvol ; bscenter ( fmaconf . bslist [ i ] , off ) ; off [ 0 ] += 0.5 * fmaconf . cell - 0.5 * fmaconf . grplen ; off [ 1 ] += 0.5 * fmaconf . cell - 0.5 * fmaconf . grplen ; off [ 2 ] += 0.5 * fmaconf . cell - 0.5 * fmaconf . grplen ; for ( j = 0 ; j < fmaconf . bspboxvol ; ++ j , ++ rptr ) { GRID ( idx , j , fmaconf . bspbox , fmaconf . bspbox ) ; ctr [ 0 ] = off [ 0 ] + fmaconf . cell * ( real ) idx [ 0 ] ; ctr [ 1 ] = off [ 1 ] + fmaconf . cell * ( real ) idx [ 1 ] ; ctr [ 2 ] = off [ 2 ] + fmaconf . cell * ( real ) idx [ 2 ] ; * rptr = scale * srcint ( fmaconf . k0 , ctr , srcloc , dc , rhsfunc ) ; if ( dir && ! plane ) * rptr *= directivity ( ctr , srcloc , dir , dir [ 3 ] ) ; } } } return 0 ; }
Slow computation of incident field for a single source.
Slow computation of incident field for a single source .
/* Use a plane wave instead of a point source. */ /* Find the center of the group. */ /* The offset of the first basis function in the group. */ /* The position in the local grid of the basis function. */ /* The center of the basis function. */ /* Include a directivity, if appropriate. */