GLfloat tile::height_at_point(GLfloat x, GLfloat y) const { Eigen::Vector2f the_point(x,y); int index = -1; if(y < 0.5) { if(x < 0.5) { index = 5; } else { index = 0; } } else { if(x < 0.5) { index = 3; } else { index = 2; } } const point& corner = corners_[index]; Eigen::Vector2f corner_pos = Eigen::Vector2f(corner.position.x(), corner.position.y()); const GLfloat dist_corner = (corner_pos - the_point).norm(); Eigen::Vector2f center_pos = Eigen::Vector2f(center_.position.x(), center_.position.y()); const GLfloat dist_center = (center_pos - the_point).norm(); return (dist_corner*center_.position.z() + dist_center*corner.position.z())/(dist_corner+dist_center); }
LOCAL void change_states_param( Front *front, Wave *wave, int comp, Gas_param *new_param) { HYPER_SURF *hs; HYPER_SURF_ELEMENT *hse; POINT *pt; SURFACE **s; Locstate stl, str, ref_st; int i, d, gridmax, vgmax[MAXD], tmp, ic[MAXD]; FD_DATA *fd_data; INTERFACE *intfc = front->interf; int dim = intfc->dim; printf("#change dirichlet boundary condition params.\n"); for(s=intfc->surfaces; s && *s; s++) { hs = Hyper_surf(*s); if(wave_type(hs) != DIRICHLET_BOUNDARY) continue; if(boundary_state_data(hs) == NULL) continue; fd_data = (FD_DATA *)boundary_state_data(hs); ref_st = fd_data->state; if(gas_params_for_comp(comp, intfc) != Params(ref_st)) continue; printf("change param for FD_DATA.\n"); verbose_print_state("bf ref", ref_st); change_param(ref_st, comp, new_param); verbose_print_state("af ref", ref_st); } printf("#change intfc params.\n"); next_point(intfc, NULL,NULL,NULL); while (next_point(intfc,&pt,&hse,&hs)) { slsr(pt,hse,hs,&stl,&str); change_param(str,positive_component(hs),new_param); change_param(stl,negative_component(hs),new_param); if(the_point(pt)) { printf("%d %d\n", negative_component(hs), positive_component(hs)); verbose_print_state("stl", stl); verbose_print_state("str", str); } } //check_print_intfc("After change intfc params", "ch_param", 'g', // intfc, 1, -1, NO); printf("#change interior params.\n"); gridmax = 1; for (d = 0; d < dim; d++) { vgmax[d] = wave->rect_grid->gmax[d] + wave->rect_grid->lbuf[d] + wave->rect_grid->ubuf[d]; gridmax *= vgmax[d]; } for (i = 0; i < gridmax; i++) { tmp = i; for (d = 0; d < dim; d++) { ic[d] = tmp % vgmax[d] - wave->rect_grid->lbuf[d]; tmp /= vgmax[d]; } change_param(Rect_state(ic,wave), Rect_comp(ic,wave), new_param); } }