/**************************************************************************\ * Crawl down the list of high order parameters and delete * \**************************************************************************/ #include #include #include "nrutil.h" #include "structs.h" void del_highpars (struct fitpars *fpar, int type) { struct fitpars *tptr; int n=0; /* Type 0 = rotation, Type 1 = fourier modes, Type 3 = link pars */ tptr = fpar->high; while (tptr != NULL) { if ((type == 0 && (strncmp (tptr->objtype, "power", 5) == 0)) || (type == 0 && (strncmp (tptr->objtype, "log", 3) == 0)) || (type == 1 && (strncmp (tptr->objtype, "four", 4) == 0)) || (type == 1 && (strncmp (tptr->objtype, "bend", 4) == 0)) || (type == 1 && (strncmp (tptr->objtype, "C0", 2) == 0)) || (type == 3 && (strncmp (tptr->objtype, "sersic", 4) == 0))) { free ((float *)tptr->a); free ((int *)tptr->ia); free ((float *)tptr->sig); strcpy (tptr->objtype, "none"); if (tptr->next != NULL) { tptr = tptr->next; if (n==0) { free(fpar->high); fpar->high = tptr; } else if (n > 0) fpar->next = tptr; } else if (tptr->next == NULL) { if (n==0) { free(fpar->high); fpar->high = NULL; } else if (n > 0) { free(fpar->next); fpar->next = NULL; }; }; }; if (n == 0) fpar = fpar->high; else fpar = fpar->next; tptr = tptr->next; n++; }; }