tissue.c
/* Compute the Laplacian of the density at a specified point. */
Compute the Laplacian of the density at a specified point.
Compute the Laplacian of the density at a specified point .
real lapden (real *r, real *lr, real *nr, real delta,
		long pos, long nx, long ny) {
	long x, y;
	real dlap, nval, pval;
	x = pos % nx;
	y = pos / nx;
	dlap = -6.0 / r[pos];
	if (x >= nx - 1) nval = 1.0;
	else nval = 1.0 / r[pos + 1];
	if (x <= 0) pval = 1.0;
	else pval = 1.0 / r[pos - 1];
	dlap += pval + nval;
	if (y >= ny - 1) nval = 1.0;
	else nval = 1.0 / r[pos + nx];
	if (y <= 0) pval = 1.0;
	else pval = 1.0 / r[pos - nx];
	dlap += pval + nval;
	if (!nr) nval = 1.0;
	else nval = 1.0 / nr[pos];
	if (!lr) pval = 1.0;
	else pval = 1.0 / lr[pos];
	dlap += pval + nval;
	dlap /= (delta * delta);
	return dlap;
}
real lapden ( real * r , real * lr , real * nr , real delta , long pos , long nx , long ny ) { long x , y ; real dlap , nval , pval ; x = pos % nx ; y = pos / nx ; dlap = -6.0 / r [ pos ] ; if ( x >= nx - 1 ) nval = 1.0 ; else nval = 1.0 / r [ pos + 1 ] ; if ( x <= 0 ) pval = 1.0 ; else pval = 1.0 / r [ pos - 1 ] ; dlap += pval + nval ; if ( y >= ny - 1 ) nval = 1.0 ; else nval = 1.0 / r [ pos + nx ] ; if ( y <= 0 ) pval = 1.0 ; else pval = 1.0 / r [ pos - nx ] ; dlap += pval + nval ; if ( ! nr ) nval = 1.0 ; else nval = 1.0 / nr [ pos ] ; if ( ! lr ) pval = 1.0 ; else pval = 1.0 / lr [ pos ] ; dlap += pval + nval ; dlap /= ( delta * delta ) ; return dlap ; }
Compute the Laplacian of the density at a specified point.
Compute the Laplacian of the density at a specified point .
/* The self contribution to the Laplacian. */ /* Contribution of the x offsets with bounds checking. */ /* Contribution of the y offsets with bounds checking. */ /* Contribution of the z offsets with bounds checking. */ /* Divide out the step size. */