tissue.c
/* Build the next z-slab of the model for specified parameters. */
Build the next z-slab of the model for specified parameters.
Build the next z - slab of the model for specified parameters .
long modelslab (cplx *k, real *r, FILE *template, FILE *avlrand,
		FILE *adprand, long npx, material *bgval, material *ctval,
		material *avlval, material *adpval) {
	long i;
	real *tmap, *arnd, *frnd, cs = 1.0, as = 0.0, rs = 1.0;
	tmap = malloc (3 * npx * sizeof(real));
	arnd = tmap + npx;
	frnd = arnd + npx;
	fread (tmap, sizeof(real), npx, template);
	fread (arnd, sizeof(real), npx, avlrand);
	fread (frnd, sizeof(real), npx, adprand);
#pragma omp parallel for default(shared) private(i,cs,as,rs)
	for (i = 0; i < npx; ++i) {
		switch((int)(tmap[i])) {
		case 0:
			k[i] = wavenum(ctval->c, ctval->a, bgval->c);
			r[i] = sqrt(ctval->r / bgval->r);
			break;
		case 1:
			k[i] = wavenum(bgval->c, bgval->a, bgval->c);
			r[i] = 1.0;
			break;
		default:
			if (arnd[i] > ALVTOL) {
				cs = avlval[0].c + avlval[1].c * arnd[i];
				as = avlval[0].a + avlval[1].a * arnd[i];
				rs = avlval[0].r + avlval[1].r * arnd[i];
			} else {
				cs = adpval[0].c + adpval[1].c * frnd[i];
				as = adpval[0].a + adpval[1].a * frnd[i];
				rs = adpval[0].r + adpval[1].r * frnd[i];
			}
			k[i] = wavenum(cs, as, bgval->c);
			r[i] = sqrt(rs / bgval->r);
		}
	}
	free (tmap);
	return npx;
}
long modelslab ( cplx * k , real * r , FILE * template , FILE * avlrand , FILE * adprand , long npx , material * bgval , material * ctval , material * avlval , material * adpval ) { long i ; real * tmap , * arnd , * frnd , cs = 1.0 , as = 0.0 , rs = 1.0 ; tmap = malloc ( 3 * npx * sizeof ( real ) ) ; arnd = tmap + npx ; frnd = arnd + npx ; fread ( tmap , sizeof ( real ) , npx , template ) ; fread ( arnd , sizeof ( real ) , npx , avlrand ) ; fread ( frnd , sizeof ( real ) , npx , adprand ) ; #pragma  omp parallel for default(shared) private(i,cs,as,rs) for ( i = 0 ; i < npx ; ++ i ) { switch ( ( int ) ( tmap [ i ] ) ) { case 0 : k [ i ] = wavenum ( ctval -> c , ctval -> a , bgval -> c ) ; r [ i ] = sqrt ( ctval -> r / bgval -> r ) ; break ; case 1 : k [ i ] = wavenum ( bgval -> c , bgval -> a , bgval -> c ) ; r [ i ] = 1.0 ; break ; default : if ( arnd [ i ] > ALVTOL ) { cs = avlval [ 0 ] . c + avlval [ 1 ] . c * arnd [ i ] ; as = avlval [ 0 ] . a + avlval [ 1 ] . a * arnd [ i ] ; rs = avlval [ 0 ] . r + avlval [ 1 ] . r * arnd [ i ] ; } else { cs = adpval [ 0 ] . c + adpval [ 1 ] . c * frnd [ i ] ; as = adpval [ 0 ] . a + adpval [ 1 ] . a * frnd [ i ] ; rs = adpval [ 0 ] . r + adpval [ 1 ] . r * frnd [ i ] ; } k [ i ] = wavenum ( cs , as , bgval -> c ) ; r [ i ] = sqrt ( rs / bgval -> r ) ; } } free ( tmap ) ; return npx ; }
Build the next z-slab of the model for specified parameters.
Build the next z - slab of the model for specified parameters .
/* Allocate arrays to store the slab values. */ /* Read the tissue parameters for the current slab. */ /* Connective tissue values should be used here. */ /* The dimensionless wave number. */ /* Square root of the relative density. */ /* Background values should be used here. */ /* The dimensionless wave number. */ /* Relative density in the background is always unity. */ /* Random models should be used here. */ /* Use the alveolar models. */ /* Use the adipose models. */ /* The dimensionless wave number. */ /* Square root of the relative density. */