Exemplo n.º 1
0
cmpl
disp_sample_table_n_value(const disp_t *disp, double lam)
{
    const struct disp_sample_table *dt = & disp->disp.sample_table;
    if (lam <= get_wavelength(dt, 0)) {
        return get_n(dt, 0) - get_k(dt, 0) * I;
    } else if (lam >= get_wavelength(dt, dt->len - 1)) {
        return get_n(dt, dt->len - 1) - get_k(dt, dt->len - 1) * I;
    }
    double nx = gsl_interp_eval(dt->interp_n, wavelength_const_array(dt), n_const_array(dt), lam, dt->accel);
    double kx = gsl_interp_eval(dt->interp_k, wavelength_const_array(dt), k_const_array(dt), lam, dt->accel);
    return nx - kx * I;
}
Exemplo n.º 2
0
void Sinusoid::draw( Geovalue &gval, GsTLGridProperty *propTi )
{
	grid_->select_property( propTi->name() ); 

	double p = gen_();
	get_length( p );
	get_width( p );
	depth_ = cdf_depth_->inverse( p );

	//Convert angle to radian & do checks
	float strike = get_orientation( p );
	float deg_to_rad = 3.14159265/180;
	if ( strike > 180 ) strike -= 360;  
	if ( strike < -180 ) strike += 360; 
    strike *= deg_to_rad;

	amp_ = get_amplitude( p );
	wvlength_ = get_wavelength( p );

	// Channel cross-section is defined by a lower half ellipsoid
	// whose max radius equals channel width, med_radius = 1,
	// and min radius equals channel depth
	cdfType* cdf_hellipRot = new Dirac_cdf( 0.0 );
	cdfType* cdf_hellipMaxr = new Dirac_cdf( half_width_ ); 
	cdfType* cdf_hellipMedr = new Dirac_cdf( 1 );
	cdfType* cdf_hellipMinr = new Dirac_cdf( depth_ );

	int lower_half = 1;
	hellip_ = new HalfEllipsoid(
		grid_, geobody_index_, lower_half,
		cdf_hellipRot, cdf_hellipMaxr, cdf_hellipMedr, 
		cdf_hellipMinr, objErosion_, objOverlap_
	);

	int node_id = gval.node_id();
	Matrix_2D rot = get_rot_matrix( strike );
	std::vector<std::vector<Geovalue> > gbRaster = rasterize( node_id, propTi, strike, rot );

	rasterizedVol_ = 0;
	if ( accept_location( gbRaster, propTi ) ) {
		std::vector< std::vector<Geovalue> >::iterator sup_itr;
		std::vector<Geovalue>::iterator gv_itr;
		for ( sup_itr = gbRaster.begin(); sup_itr != gbRaster.end(); ++sup_itr ) {
			gv_itr = sup_itr->begin();
			for ( ; gv_itr != sup_itr->end(); ++gv_itr ) {
				int cur_index = propTi->get_value( gv_itr->node_id() );
				gstl_assert( ( cur_index >= 0 ) && ( cur_index < erosion_rules_.size() ) );
				if ( cur_index != geobody_index_ ) {
					if ( erosion_rules_[cur_index] == 1 ) { // Decrease proportion of eroded index?
						propTi->set_value( geobody_index_, gv_itr->node_id() );
						rasterizedVol_++;
					}
				}
			}
		}
	} 
	delete hellip_;
}
Exemplo n.º 3
0
int main(void)
{
	plan(10);

	new_copy();
	init();
	cmp();
	compute_ki();
	get_wavelength();

	return 0;
}
Exemplo n.º 4
0
void disp_sample_table_get_sample(const struct disp_sample_table *dt, int index, double *w, double *n, double *k)
{
    *w = get_wavelength(dt, index);
    *n = get_n(dt, index);
    *k = get_k(dt, index);
}