/* read stec grid data body --------------------------------------------------*/ static void read_stecb(FILE *fp, nav_t *nav) { gtime_t time; double tow,pos[2],iono,rate,rms; char buff[256],id[64]; int week,sat,slip; trace(3,"read_stecb:\n"); while (fgets(buff,sizeof(buff),fp)) { /* read position */ if (sscanf(buff,"$SPOS %d %lf %lf %lf",&week,&tow,pos,pos+1)>=4) { /* add stec grid */ if (!add_grid(nav,pos)) break; } /* read ionos */ if (sscanf(buff,"$STEC %d %lf %s %d %lf %lf %lf",&week,&tow,id,&slip, &iono,&rate,&rms)>=6) { if (nav->nn<=0||!(sat=satid2no(id))) continue; time=gpst2time(week,tow); /* add grid data */ if (!add_data(nav->stec+nav->nn-1,time,sat,slip,iono,rate,rms)) { break; } } } }
void TriangleDice::dice(SubPatch& sub, EdgeFactors& ef) { /* todo: handle 2 1 1 resolution */ int M = max(ef.tu, max(ef.tv, ef.tw)); reserve(ef, M); add_grid(sub, ef, M); assert(vert_offset == mesh->verts.size()); }
void TDeviceFileInput::copy_contents(const TDeviceFileInput& new_device_input) { int i; MaterialParam j; MaterialParamInput new_param_input; DopingInput new_doping; StructureInput new_structure; for (i=0;i<new_device_input.number_grid;i++) add_grid(*(new_device_input.grid_ptr+i)); for (i=0;i<new_device_input.number_doping;i++) { new_doping.length=(new_device_input.doping_ptr+i)->length; new_doping.acceptor_function=(new_device_input.doping_ptr+i)->acceptor_function->create_copy(); new_doping.donor_function=(new_device_input.doping_ptr+i)->donor_function->create_copy(); new_doping.acceptor_degeneracy=(new_device_input.doping_ptr+i)->acceptor_degeneracy; new_doping.acceptor_level=(new_device_input.doping_ptr+i)->acceptor_level; new_doping.donor_degeneracy=(new_device_input.doping_ptr+i)->donor_degeneracy; new_doping.donor_level=(new_device_input.doping_ptr+i)->donor_level; add_doping(new_doping); } for (i=0;i<new_device_input.number_structure;i++) { new_structure.material_type=(new_device_input.structure_ptr+i)->material_type; new_structure.alloy_type=(new_device_input.structure_ptr+i)->alloy_type; new_structure.length=(new_device_input.structure_ptr+i)->length; new_structure.alloy_function=(new_device_input.structure_ptr+i)->alloy_function->create_copy(); add_structure(new_structure); } for (i=0;i<new_device_input.number_region;i++) add_region(*(new_device_input.region_ptr+i)); for (i=0;i<new_device_input.number_cavity;i++) add_cavity(*(new_device_input.cavity_ptr+i)); for (i=0;i<new_device_input.number_mirror;i++) add_mirror(*(new_device_input.mirror_ptr+i)); radius=new_device_input.radius; for (j=1;j<=MAT_MAX_NUMBER_PARAMETERS;j++) { for (i=0;i<new_device_input.number_material_param[j-1];i++) { new_param_input.length=(new_device_input.material_param_input[j-1]+i)->length; new_param_input.material_model= new TMaterialParamModel(*((new_device_input.material_param_input[j-1]+i)->material_model)); add_material_param(j,new_param_input); } } }
void QuadDice::dice(SubPatch& sub, EdgeFactors& ef) { /* compute inner grid size with scale factor */ int Mu = max(ef.tu0, ef.tu1); int Mv = max(ef.tv0, ef.tv1); float S = scale_factor(sub, ef, Mu, Mv); Mu = max((int)ceil(S*Mu), 2); // XXX handle 0 & 1? Mv = max((int)ceil(S*Mv), 2); // XXX handle 0 & 1? /* reserve space for new verts */ int offset = mesh->verts.size(); reserve(ef, Mu, Mv); /* corners and inner grid */ add_corners(sub); add_grid(sub, Mu, Mv, offset); /* bottom side */ vector<int> outer, inner; add_side_u(sub, outer, inner, Mu, Mv, ef.tu0, 0, offset); stitch_triangles(outer, inner); /* top side */ add_side_u(sub, outer, inner, Mu, Mv, ef.tu1, 1, offset); stitch_triangles(inner, outer); /* left side */ add_side_v(sub, outer, inner, Mu, Mv, ef.tv0, 0, offset); stitch_triangles(inner, outer); /* right side */ add_side_v(sub, outer, inner, Mu, Mv, ef.tv1, 1, offset); stitch_triangles(outer, inner); assert(vert_offset == mesh->verts.size()); }