/* * Function: set_eapol_configuration * Purpose: * Set the EAPOL configuration in the prefs. */ STATIC Boolean set_eapol_configuration(SCPreferencesRef prefs, CFStringRef if_name, CFDictionaryRef dict) { SCNetworkSetRef current_set = NULL; SCNetworkInterfaceRef net_if_save; Boolean ret = FALSE; SCNetworkServiceRef service = NULL; net_if_save = copy_interface(prefs, if_name, ¤t_set, &service); if (net_if_save != NULL) { ret = SCNetworkInterfaceSetExtendedConfiguration(net_if_save, kEAPOL, dict); if (ret == FALSE) { EAPLOG(LOG_ERR, "EAPOLClientConfiguration: SetExtendedConfiguration failed"); } } if (current_set != NULL) { SCNetworkSetRemoveService(current_set, service); CFRelease(current_set); } my_CFRelease(&service); my_CFRelease(&net_if_save); return (ret); }
static int copy_config_descriptor(struct usb_config_descriptor *dest, const struct libusb_config_descriptor *src) { int i; int num_interfaces = src->bNumInterfaces; size_t alloc_size = sizeof(struct usb_interface) * num_interfaces; memcpy(dest, src, USB_DT_CONFIG_SIZE); dest->interface = malloc(alloc_size); if (!dest->interface) return -ENOMEM; memset(dest->interface, 0, alloc_size); for (i = 0; i < num_interfaces; i++) { int r = copy_interface(dest->interface + i, &src->interface[i]); if (r < 0) { clear_config_descriptor(dest); return r; } } dest->extralen = src->extra_length; if (src->extra_length) { dest->extra = malloc(src->extra_length); if (!dest->extra) { clear_config_descriptor(dest); return -ENOMEM; } memcpy(dest->extra, src->extra, src->extra_length); } return 0; }
EXPORT INTERFACE *pp_copy_interface( INTERFACE *intfc) { INTERFACE *new_intfc; boolean stat; boolean delete_status; DEBUG_ENTER(pp_copy_interface) new_intfc = copy_interface(intfc); stat = (new_intfc != NULL) ? YES : NO; if (stat == NO) { (void) printf("WARNING in pp_copy_interface(), " "unable to copy interface"); if (pp_numnodes() > 1) (void) printf(" on processor %d\n",pp_mynode()); else (void) printf("\n"); } delete_status = YES; if (pp_min_status(stat) == NO) { if (stat == YES) { (void) printf("WARNING in pp_copy_interface(), " "unable to copy interface " "on a remote processor\n"); delete_status = (delete_interface(new_intfc)) ? YES : NO; if (delete_status == NO) { screen("ERROR in pp_copy_interface() " "unable to delete interface "); if (pp_numnodes() > 1) screen(" on processor %d\n",pp_mynode()); else screen("\n"); } new_intfc = NULL; } } if (pp_min_status(delete_status) == NO) { if (delete_status == YES) { screen("ERROR in pp_copy_interface(), unable to delete " "interface on a remote processor\n"); } clean_up(ERROR); } DEBUG_LEAVE(pp_copy_interface) return new_intfc; } /*end pp_copy_interface*/
/* * Function: get_eapol_configuration * Purpose: * Get the EAPOL configuration for the interface. * Note: * Side-effect on prefs is that a service gets added to the current set. * Since this prefs reference will not be saved, we leave the service in * the current set so that we can find it as a configured interface later * when it's time to save the writable prefs. */ STATIC CFDictionaryRef get_eapol_configuration(SCPreferencesRef prefs, CFStringRef if_name, SCNetworkInterfaceRef * ret_net_if) { SCNetworkSetRef current_set = NULL; CFDictionaryRef dict = NULL; SCNetworkServiceRef service = NULL; SCNetworkInterfaceRef net_if = NULL; net_if = copy_interface(prefs, if_name, ¤t_set, &service); if (net_if != NULL) { dict = SCNetworkInterfaceGetExtendedConfiguration(net_if, kEAPOL); } my_CFRelease(¤t_set); my_CFRelease(&service); if (ret_net_if != NULL) { *ret_net_if = net_if; } else { my_CFRelease(&net_if); } return (dict); }
/*ARGSUSED*/ EXPORT INTERFACE *i_zoom_interface( INTERFACE *given_intfc, RECT_GRID *gr, double *L, double *U, double **Q) { INTERFACE *cur_intfc; INTERFACE *zoom_intfc; RECT_GRID *t_gr; int dim = given_intfc->dim; int i, j; double **Qi = NULL; static double **pc = NULL; debug_print("zoom","Entered zoom_interface()\n"); cur_intfc = current_interface(); if ((zoom_intfc = copy_interface(given_intfc)) == NULL) { Error(ERROR,"Unable to copy interface."); clean_up(ERROR); } if (debugging("zoom")) { (void) output(); (void) printf("INTERFACE before zoom:\n\n"); print_interface(zoom_intfc); } if (Q != NULL) { static double** M = NULL; if (M == NULL) bi_array(&M,MAXD,MAXD,FLOAT); Qi = M; for (i = 0; i < dim; i++) for (j = 0; j < dim; j++) Qi[i][j] = Q[j][i]; } if (pc == NULL) bi_array(&pc,MAXNCORNERS,MAXD,FLOAT); calculate_box(L,U,pc,Q,Qi,dim); /* Shrink topological grid to cutting boundary */ t_gr = &topological_grid(zoom_intfc); rotate_and_zoom_rect_grid(t_gr,L,U,Q); switch(dim) { case 1: /* TODO */ return NULL; case 2: insert_cuts_and_bdry2d(zoom_intfc,pc); clip_interface2d(zoom_intfc); break; case 3: /* TODO */ return NULL; } rotate_interface(zoom_intfc,pc[0],Qi); if (set_boundary(zoom_intfc,t_gr,component(pc[0],given_intfc), grid_tolerance(gr) != FUNCTION_SUCCEEDED)) { screen("ERROR in i_zoom_interface(), set_boundary failed\n"); clean_up(ERROR); } set_current_interface(cur_intfc); if (debugging("zoom")) { (void) printf("INTERFACE after zoom:\n\n"); print_interface(zoom_intfc); } debug_print("zoom","Leaving zoom_interface()\n"); return zoom_intfc; } /*end i_zoom_interface*/
EXPORT INTERFACE *remap_interface( INTERFACE *intfc, void (*remap)(POINT*,BOND*,CURVE*,POINT*, BOND*,CURVE*,boolean,RECT_GRID*,POINTER), void (*remap_rect_grid)(INTERFACE*,INTERFACE*, void (*)(POINT*,BOND*,CURVE*, POINT*,BOND*,CURVE*,boolean, RECT_GRID*,POINTER), POINTER), POINTER params) { HYPER_SURF *hs, *nhs; HYPER_SURF_ELEMENT *hse, *nhse; POINT *p, *np; INTERFACE *new_intfc; RECT_GRID *rgr; boolean first = YES; double eps; if (DEBUG) (void) printf("Entering remap_interface(%llu)\n", (long long unsigned int)interface_number(intfc)); if (remap == NULL || remap_rect_grid == NULL) return NULL; if (exists_interface(intfc) != YES) return NULL; if ((new_intfc = copy_interface(intfc)) == NULL) return NULL; rgr = &topological_grid(new_intfc); /* TODO: check for validity at hyper surface boundaries */ (void) next_point(intfc,NULL,NULL,NULL); (void) next_point(new_intfc,NULL,NULL,NULL); while (next_point(intfc,&p,&hse,&hs) && next_point(new_intfc,&np,&nhse,&nhs)) { (*remap)(p,Bond_of_hse(hse),Curve_of_hs(hs),np, Bond_of_hse(nhse),Curve_of_hs(nhs),first,rgr,params); first = NO; } /* Remap the Underlying Grid: */ (*remap_rect_grid)(intfc,new_intfc,remap,params); /* Reset boundary flags */ eps = grid_tolerance(rgr); if (new_intfc->dim == 1) { POINT **pt; for (pt = new_intfc->points; pt && *pt; pt++) { if (boundary_side(Coords(*pt),rgr,eps) == NOT_A_BDRY) set_not_bdry(*pt); else set_is_bdry(*pt); } } if (new_intfc->dim == 2) { CURVE **c; NODE **n; for (n = new_intfc->nodes; n && *n; n++) { if (boundary_side(Coords((*n)->posn),rgr,eps) == NOT_A_BDRY) set_not_bdry(*n); else set_is_bdry(*n); } for (c = new_intfc->curves; c && *c; c++) { BDRY_SIDE side_start, side_end, side; BOND *b; NODE *ns, *ne; ns = (*c)->start; ne = (*c)->end; side_start = boundary_side(Coords(ns->posn),rgr,eps); side_end = boundary_side(Coords(ne->posn),rgr,eps); if ((side_start != side_end) || (side_start == NOT_A_BDRY)) { set_not_bdry(*c); continue; } side = side_start; for (b = (*c)->first; b != (*c)->last; b = b->next) { if (boundary_side(Coords(b->end),rgr,eps) != side) { side = NOT_A_BDRY; break; } } if (side == NOT_A_BDRY) set_not_bdry(*c); else set_is_bdry(*c); } } if (new_intfc->dim == 3) { CURVE **c; NODE **n; SURFACE **s; for (n = new_intfc->nodes; n && *n; n++) { if (boundary_side(Coords((*n)->posn),rgr,eps) == NOT_A_BDRY) set_not_bdry(*n); else set_is_bdry(*n); } for (c = new_intfc->curves; c && *c; c++) { BDRY_SIDE side_start, side_end, side; BOND *b; NODE *ns, *ne; ns = (*c)->start; ne = (*c)->end; side_start = boundary_side(Coords(ns->posn),rgr,eps); side_end = boundary_side(Coords(ne->posn),rgr,eps); if ((side_start != side_end) || (side_start == NOT_A_BDRY)) { set_not_bdry(*c); continue; } side = side_start; for (b = (*c)->first; b != (*c)->last; b = b->next) { if (boundary_side(Coords(b->end),rgr,eps) != side) { side = NOT_A_BDRY; break; } } if (side == NOT_A_BDRY) set_not_bdry(*c); else set_is_bdry(*c); } for (s = new_intfc->surfaces; s && *s; s++) { TRI *t; BDRY_SIDE side0, side1, side2, side; const double *p0, *p1, *p2; t = first_tri(*s); p0 = Coords(Point_of_tri(t)[0]); p1 = Coords(Point_of_tri(t)[1]); p2 = Coords(Point_of_tri(t)[2]); side0 = boundary_side(p0,rgr,eps); side1 = boundary_side(p1,rgr,eps); if ((side0 != side1) || (side0 == NOT_A_BDRY)) { set_not_bdry(*s); continue; } side = side0; side2 = boundary_side(p2,rgr,eps); if (side2 != side0) { set_not_bdry(*s); continue; } for (t = t->next; !at_end_of_tri_list(t,*s); t = t->next) { p0 = Coords(Point_of_tri(t)[0]); p1 = Coords(Point_of_tri(t)[1]); p2 = Coords(Point_of_tri(t)[2]); if ((boundary_side(p0,rgr,eps) != side) || (boundary_side(p1,rgr,eps) != side) || (boundary_side(p2,rgr,eps) != side)) { side = NOT_A_BDRY; break; } } if (side == NOT_A_BDRY) set_not_bdry(*s); else set_is_bdry(*s); } } if (DEBUG) (void) printf("Leaving remap_interface()\n\n"); return new_intfc; } /*end remap_interface*/
EXPORT int normal_advance_front2d( float dt, float *dt_frac, Front *front, Front **newfront, POINTER wave) { CURVE *oldc,*newc; CURVE **c; NODE *oldn,*newn; RPROBLEM *rp,*rp1; int status, node_stat; NODE_FLAG flag; const char *fname = "normal_advance_front2d()"; debug_print("front","Entered %s(step %d time %g dt %g)\n",fname, front->step,front->time,dt); debug_front("old_front","into advance front",front); *newfront = copy_front(front); Interface_redistributed(*newfront) = NO; if(front->interf->nodes == NULL) { bool sav_copy; INTERFACE *sav_intfc; sav_intfc = current_interface(); sav_copy = copy_intfc_states(); set_size_of_intfc_state(size_of_state(front->interf)); set_copy_intfc_states(YES); (*newfront)->interf = copy_interface(front->interf); set_current_interface(sav_intfc); set_copy_intfc_states(sav_copy); return return_advance_front(front,newfront,GOOD_STEP,fname); } rp = NULL; set_to_next_node_only(flag); set_node_doubly_linked_list(front->interf); /* Initialize Newfront */ start_clock("init_new_front"); capture_waves(front); print_storage("before init_new_front","ADV_storage"); /* TODO: Remove this option!!!!! */ if (front->init_topology_of_new_interface) status = (*front->init_topology_of_new_interface)(front,*newfront); else { set_size_of_intfc_state(size_of_state(front->interf)); set_copy_intfc_states(NO); set_add_to_correspond_list(YES); /* If USE_OVERTURE, can not syncronize_time_step at here (*newfront)->interf = pp_copy_interface(front->interf); */ (*newfront)->interf = copy_interface(front->interf); reset_hs_flags_on_intfc((*newfront)->interf); status = ((*newfront)->interf != NULL) ? GOOD_STEP : ERROR_IN_STEP; set_copy_intfc_states(YES); } if (status != GOOD_STEP) { (void) printf("ERROR in normal_advance_front2d(), " "unable to copy interface\n"); print_storage("after init_new_front","ADV_storage"); clean_up(ERROR); } print_storage("after init_new_front","ADV_storage"); stop_clock("init_new_front"); /* Set Default Propagation Limits */ set_propagation_limits(front,*newfront); /* Propagate the Curves */ if (front->curve_propagate != NULL) { start_clock("curve_propagate"); if (debugging("front")) (void) printf("Loop over Curves\n"); for (c = front->interf->curves; c && *c; c++) { oldc = *c; if (((newc = correspond_curve(oldc)) != NULL) && (correspond_curve(newc) != NULL)) { if (debugging("propagate")) (void) printf("\t\tpropagating curve %lu\n", curve_number(oldc)); curve_propagate(front,wave,oldc,newc,dt); } } debug_front("cp_front","after curve prop",*newfront); stop_clock("curve_propagate"); } /* Propagate the Nodes */ if (debugging("front")) { print_correspond_hyper_surf_list(front->interf); print_correspond_hyper_surf_list((*newfront)->interf); } if (front->node_propagate != NULL) { start_clock("node_propagate"); set_corresponds_for_node_prop(front->interf,(*newfront)->interf); oldn = first_node(front->interf); while (oldn != NULL) { newn = correspond_node(oldn); if (debugging("crx_status")) print_linked_node_list((*newfront)->interf); if(DEBUG) { /* printf("IN normal_advance_front2d\n"); printf("node propagate\n"); print_node(oldn); print_node(newn); printf("oldnode is virtual fixed = %s\n", is_virtual_fixed_node(oldn) == YES ? "YES" : "NO"); printf("newnode is virtual fixed = %s\n", is_virtual_fixed_node(newn) == YES ? "YES" : "NO"); printf("End of print new and old nodes\n"); */ } status = (newn != NULL) ? (*front->node_propagate)(front,wave,oldn,newn,&rp, dt,dt_frac,flag,NULL) : GOOD_NODE; if (is_bad_status(status) && (point_in_buffer(Coords(oldn->posn),front->rect_grid) == YES)) { (void) printf("WARNING in normal_advance_front2d(), " "node_propagation returns "); print_node_status("WARNING in normal_advance_front2d(), " "node_propagation returns ",status,"\n"); /* print_node_status(status); */ (void) printf("Problem occurs in buffer zone - ignoring\n"); if (set_node_states_and_continue(oldn,newn,front)) status = GOOD_NODE; } switch (status) { case GOOD_NODE: oldn = adv_node_loop_after_good_prop(oldn,newn,&rp); break; case PSEUDOCROSS_NODE_NODE: debug_print("PSEUDOCROSS","PSEUDOCROSS case\n"); oldn = reorder_node_loop(oldn,newn); break; case CROSS_NODE_NODE: case BIFURCATION_NODE: debug_print("CROSS","CROSS case\n"); oldn = next_node(oldn); break; case CROSS_PAST_CURVE_NODE: (void) printf("WARNING in normal_advance_front2d(), "); (void) printf("node_propagate failed, "); print_node_status("WARNING in normal_advance_front2d(), " "node_propagate failed with status ", status,"\n"); print_node(oldn); if (debugging("CROSS_PAST")) { (void) printf("Cross past curve case\n" "dt_frac = %g\n",*dt_frac); (void) printf("Reducing time step\n"); } *dt_frac *= TIME_STEP_REDUCTION_FACTOR(front->interf); free_rp_list(&rp); status = MODIFY_TIME_STEP; goto sync_prop_stat1; case MODIFY_TIME_STEP_NODE: (void) printf("WARNING in normal_advance_front2d(), " "node_propagate returns " "MODIFY_TIME_STEP_NODE\n"); free_rp_list(&rp); status = MODIFY_TIME_STEP; goto sync_prop_stat1; case REPEAT_TIME_STEP_NODE: (void) printf("WARNING in normal_advance_front2d(), " "node_propagate returns " "REPEAT_TIME_STEP_NODE\n"); free_rp_list(&rp); status = REPEAT_TIME_STEP; goto sync_prop_stat1; case NO_CROSS_NODE: (void) printf("WARNING in normal_advance_front2d(), "); (void) printf("node_propagate failed, "); print_node_status("WARNING in normal_advance_front2d(), " "node_propagate failed with status ", status,"\n"); print_node(oldn); if (debugging("NO_CROSS")) { (void) printf("No cross case\n"); (void) printf("dt_frac = %g\n",*dt_frac); (void) printf("Reducing time step\n"); } *dt_frac *= TIME_STEP_REDUCTION_FACTOR(front->interf); free_rp_list(&rp); status = MODIFY_TIME_STEP; goto sync_prop_stat1; case ERROR_NODE: default: (void) printf("WARNING in normal_advance_front2d(), "); (void) printf("node_propagate failed, "); print_node_status("WARNING in normal_advance_front2d(), " "node_propagate failed with status ", status,"\n"); print_node(oldn); if (debugging("ERROR_NODE")) { (void) printf("Old interface:\n"); print_interface(front->interf); print_correspond_hyper_surf_list(front->interf); (void) printf("New interface:\n"); print_interface((*newfront)->interf); print_correspond_hyper_surf_list((*newfront)->interf); } *dt_frac = Min_time_step_modification_factor(front); free_rp_list(&rp); status = MODIFY_TIME_STEP; goto sync_prop_stat1; } } /* end of while (oldn != NULL) */ set_correspond_hyper_surf_bdrys_to_NULL(front->interf); set_correspond_hyper_surf_bdrys_to_NULL((*newfront)->interf); if (rp && (front->twodrproblem != NULL)) { for (rp1 = rp; rp1; rp1 = rp1->prev) { debug_front("2drp_front", "new between node loop and rp loop",*newfront); status = (*front->twodrproblem)(front,*newfront,wave,&rp1); /* At this point, rp is nothing more than a valid element * of the list which provides a starting point * for deleting the list. If we delete an element of * the list in front->twodrproblem (presumably due to * merging two RPROBLEM's), then rp may point to freed * storage and will need to be updated. rp1 should still * be a valid element of the list. */ rp = rp1; if (status != GOOD_STEP) { print_time_step_status("WARNING in advance_front2d(), " "rp failed with status = ", status,"\n"); switch (status) { case GOOD_STEP: break; case REPEAT_TIME_STEP: break; case MODIFY_TIME_STEP: status = rp_modify_time_step(rp1,front,status); if (status == MODIFY_TIME_STEP) { *dt_frac = rp1->dt_frac; if (debugging("2drp")) { print_rproblem(rp1); (void) printf("dt_frac %g\n",*dt_frac); (void) printf("Reducing time step\n"); } *dt_frac = limit_dt_frac(*dt_frac,front); } break; case ERROR_IN_STEP: default: print_rproblem(rp1); /* Try reducing the time step */ status = rp_modify_time_step(rp1,front,status); if (status == MODIFY_TIME_STEP) *dt_frac *= TIME_STEP_REDUCTION_FACTOR(front->interf); break; } } if (status != GOOD_STEP) break; } free_rp_list(&rp); debug_front("2drp_front","after 2drp loop",*newfront); } else if (rp) { for (rp1 = rp; rp1; rp1 = rp1->prev) { print_rproblem(rp1); } free_rp_list(&rp); (void) printf("WARNING in normal_advance_front2d(), "); (void) printf("CROSS code needed\n"); status = ERROR_IN_STEP; } } /* 061003 closed, since the correspondence is reset. * The second node prop. is done in tangential step now. node_stat = second_node_propagate2d(dt,dt_frac,front,newfront,wave); if(GOOD_STEP != node_stat) { (void) printf("WARNING in normal_advance_front2d(), " "second node_propagation returns stat= %d", node_stat); clean_up(ERROR); } */ sync_prop_stat1: return return_advance_front(front,newfront,GOOD_STEP,fname); } /*end normal_advance_front2d*/
EXPORT void geomview_amr_fronts_plot2d( const char *dname, Front **frs, int num_patches, Wv_on_pc **redistr_table, int max_n_patch) { FILE *fp; int i; char fmt[256]; static const char *indent = " "; static char *fname = NULL, *ppfname = NULL; static size_t fname_len = 0, ppfname_len = 0; INTERFACE *intfc = frs[0]->interf; INTERFACE *tmpintfc; CURVE **c; INTERFACE *sav_intfc; bool sav_copy; float **clrmap = NULL; float ccolor[4] = {0.0, 0.0, 0.0, 1.0}; int myid, numnodes; const char *nstep; char outname[256],outdir[256]; myid = pp_mynode(); numnodes = pp_numnodes(); sprintf(outdir,"%s/%s",dname,"geomintfc"); ppfname = set_ppfname(ppfname,"intfc",&ppfname_len); nstep = right_flush(frs[0]->step,7); sprintf(outname,"%s.ts%s",ppfname,nstep); if (create_directory(dname,YES) == FUNCTION_FAILED) { (void) printf("WARNING in geomview_intfc_plot2d(), directory " "%s doesn't exist and can't be created\n",dname); return; } if (create_directory(outdir,YES) == FUNCTION_FAILED) { (void) printf("WARNING in geomview_intfc_plot2d(), directory " "%s doesn't exist and can't be created\n",outdir); return; } sav_intfc = current_interface(); sav_copy = copy_intfc_states(); set_size_of_intfc_state(size_of_state(intfc)); set_copy_intfc_states(YES); tmpintfc = copy_interface(intfc); /* clip_to_interior_region(tmpintfc, frs[0]->rect_grid->lbuf,frs[0]->rect_grid->ubuf); */ uni_array(&clrmap,6,sizeof(float*)); for(i = 0; i < 6; i++) uni_array(&clrmap[i],4,sizeof(float)); i = 0; clrmap[i][0] = 0.098; clrmap[i][1] = 0.647; clrmap[i][2] = 0.400; clrmap[i][3] = 1.000; i++; clrmap[i][0] = 0.898; clrmap[i][1] = 0.400; clrmap[i][2] = 0.000; clrmap[i][3] = 1.000; i++; clrmap[i][0] = 0.500; clrmap[i][1] = 1.000; clrmap[i][2] = 0.500; clrmap[i][3] = 1.000; i++; clrmap[i][0] = 1.000; clrmap[i][1] = 0.000; clrmap[i][2] = 1.000; clrmap[i][3] = 1.000; i++; clrmap[i][0] = 0.000; clrmap[i][1] = 0.800; clrmap[i][2] = 1.000; clrmap[i][3] = 1.000; i++; clrmap[i][0] = 0.250; clrmap[i][1] = 0.808; clrmap[i][2] = 0.098; clrmap[i][3] = 1.000; i++; fname = get_list_file_name(fname,outdir,outname,&fname_len); if ((fp = fopen(fname,"w")) == NULL) { (void) printf("WARNING in gview_plot_intfc2d(), " "can't open %s\n",fname); delete_interface(tmpintfc); set_current_interface(sav_intfc); set_copy_intfc_states(sav_copy); return; } fprintf(fp,"{ LIST \n"); /* beginning of writting Vect to file */ for(c = tmpintfc->curves; c and *c; c++) gview_plot_curve2d(fp,*c,ccolor); for(int i = 0; i < num_patches; i++) { int use_clr; /* gview_plot_box2d(fp, frs[i]->rect_grid->L, frs[i]->rect_grid->U,clrmap[i%3]); */ if(NULL != redistr_table) use_clr = redistr_table[myid][i].pc_id % 6; else use_clr = 1; gview_plot_grid2d(fp,frs[i]->rect_grid,clrmap[use_clr]); } /* end of LIST OBJ */ fprintf(fp,"}\n"); fclose(fp); set_current_interface(sav_intfc); set_copy_intfc_states(sav_copy); delete_interface(tmpintfc); for(int i = 0; i < 6; i++) free(clrmap[i]); free(clrmap); }
EXPORT int tangnt_advance_front2d( float dt, float *dt_frac, Front *front, Front **newfront, POINTER wave) { CURVE *tempc,*newc; CURVE **c; NODE *tempn,*newn; INTERFACE *tempintfc; bool stat; bool sav_copy; int status = GOOD_STEP; long intfc_modified; const char *fname = "tangnt_advance_front2d()"; debug_print("front","Entered %s(step %d time %g dt %g)\n",fname, front->step,front->time,dt); if ( front->interf == NULL || front->interf->nodes == NULL ) return return_advance_front(front,newfront,GOOD_STEP,fname); /* 050703 added, The interface regularization is performed here. */ /* In advance_front2d(), these functions are called after normal_scatter_front, we call them here */ delete_small_loops(*newfront); stat = consistent_propagated_loop_orientations(dt,dt_frac,*newfront,wave); if(debugging("tangnt_advance_front2d")) printf("In tangnt_advance_front2d() for patch %d\n", front->patch_number); if (stat == NO) { (void) printf("WARNING in tangnt_advance_front2d(), " "Inconsistent orientation of propagated loop " "detected after point and node propagations"); if (pp_numnodes() > 1) (void) printf(" on processor %d\n",pp_mynode()); else (void) printf("\n"); status = MODIFY_TIME_STEP; goto sync_prop_stat2; } delete_exterior_curves(*newfront,front->interf); intfc_delete_very_short_bonds(*newfront); stat = intfc_delete_fold_back_bonds(*newfront); if(stat == FUNCTION_FAILED) { (void) printf("WARNING in tangnt_advance_front2d(), " "intfc_delete_fold_back_bonds() loop " "detected error"); if (pp_numnodes() > 1) (void) printf(" on processor %d\n",pp_mynode()); else (void) printf("\n"); status = MODIFY_TIME_STEP; goto sync_prop_stat2; } delete_small_loops(*newfront); /* 060303 added */ measure_front(*newfront); /* Make Temp Interface for Second/Tangential Propagation */ interpolate_intfc_states((*newfront)->interf) = YES; set_node_doubly_linked_list((*newfront)->interf); if (front->snd_node_propagate || front->tan_curve_propagate) { start_clock("snd_copy_interface"); print_storage("before snd_copy_interface","ADV_storage"); tempintfc = (*newfront)->interf; set_size_of_intfc_state(size_of_state(tempintfc)); set_add_to_correspond_list(YES); /* 060303, added copy_interface flag */ sav_copy = copy_intfc_states(); set_copy_intfc_states(YES); (*newfront)->interf = copy_interface(tempintfc); copy_hypersurface_flags((*newfront)->interf); interpolate_intfc_states((*newfront)->interf) = YES; /* 060303, added copy_interface flag */ set_copy_intfc_states(sav_copy); print_storage("after snd_copy_interface","ADV_storage"); stop_clock("snd_copy_interface"); } /* Second Propagation for the States Around the Nodes */ if (front->snd_node_propagate) { start_clock("snd_node_propagate"); if (debugging("front")) (void) printf("Second Loop over Nodes\n"); tempn = first_node(tempintfc); newn = first_node((*newfront)->interf); while (newn != NULL) { (*front->snd_node_propagate)(front,*newfront,wave, tempintfc,tempn,newn,dt); tempn = next_node(tempn); newn = next_node(newn); } debug_front("snd_front","after snd_node prop",*newfront); stop_clock("snd_node_propagate"); } /* Tangential Sweep for States on the Curves */ if (front->tan_curve_propagate) { start_clock("tan_curve_propagate"); if (debugging("front")) (void) printf("Second Loop over Curves\n"); for (c = tempintfc->curves; c && *c; c++) { tempc = *c; newc = correspond_curve(tempc); (*front->tan_curve_propagate)(front,*newfront, tempintfc,tempc,newc,dt); } debug_front("tcp_front","after tan_curve_propagate:",*newfront); stop_clock("tan_curve_propagate"); } if (tempintfc) (void) delete_interface(tempintfc); print_storage("after delete tempintfc","ADV_storage"); /* 060303, delete_phys_remn_on_bdry() added */ /* Provide robustness for untangle algorithms */ /* delete remnants of scalar physical */ /* curves sticking to NEUMANN boundaries */ /* Add to delete_exterior_curves()? */ if (delete_phys_remn_on_bdry(*newfront) == NO) { (void) printf("WARNING in tangnt_advance_front2d(), " "delete_phys_remn_on_bdry() detected error\n"); debug_front("ERROR_front","after error",*newfront); *dt_frac = Min_time_step_modification_factor(front); status = MODIFY_TIME_STEP; goto sync_prop_stat2; } debug_front("dspr_front", "after 1st delete_phys_remn_on_bdry():",*newfront); sync_prop_stat2: if (status != GOOD_STEP) return return_advance_front(front,newfront,status,fname); return return_advance_front(front,newfront,GOOD_STEP,fname); } /*end tangnt_advance_front2d*/
LOCAL int second_node_propagate2d( float dt, float *dt_frac, Front *front, Front **newfront, POINTER wave) { NODE *tempn,*newn; INTERFACE *tempintfc; bool stat; int status = GOOD_STEP; long intfc_modified; const char *fname = "second_node_propagate2d()"; debug_print("front","Entered %s(step %d time %g dt %g)\n",fname, front->step,front->time,dt); /* Make Temp Interface for Second/Tangential Propagation */ if ( front->interf == NULL || front->interf->nodes == NULL ) return GOOD_STEP; set_node_doubly_linked_list((*newfront)->interf); if (front->snd_node_propagate) { start_clock("snd_copy_interface"); print_storage("before snd_copy_interface","ADV_storage"); tempintfc = (*newfront)->interf; set_size_of_intfc_state(size_of_state(tempintfc)); set_add_to_correspond_list(YES); (*newfront)->interf = copy_interface(tempintfc); copy_hypersurface_flags((*newfront)->interf); interpolate_intfc_states((*newfront)->interf) = YES; print_storage("after snd_copy_interface","ADV_storage"); stop_clock("snd_copy_interface"); } /* Second Propagation for the States Around the Nodes */ if (front->snd_node_propagate) { start_clock("snd_node_propagate"); if (debugging("front")) (void) printf("Second Loop over Nodes\n"); tempn = first_node(tempintfc); newn = first_node((*newfront)->interf); while (newn != NULL) { (*front->snd_node_propagate)(front,*newfront,wave, tempintfc,tempn,newn,dt); tempn = next_node(tempn); newn = next_node(newn); } debug_front("snd_front","after snd_node prop",*newfront); stop_clock("snd_node_propagate"); } if (tempintfc) (void) delete_interface(tempintfc); print_storage("after delete tempintfc","ADV_storage"); if (status != GOOD_STEP) return return_advance_front(front,newfront,status,fname); return return_advance_front(front,newfront,GOOD_STEP,fname); } /*end tangnt_advance_front2d*/