#include #include "structs.h" /****************************************************************************\ * Point fpar->dp at the corresponding component in the df structure. This * * is quite useful when you need to know what derivative structure * * the fpar parameters correspond to on the fly. * \****************************************************************************/ int istrunc (char *objtype); void point_fpar_at_df (struct fitpars *fpar, struct derivs *df) { void high_order_point (struct fitpars *fptr, struct derivs *dptr); struct fitpars *fptr; struct derivs *dptr; fptr = fpar; dptr = df; while (fptr != NULL) { fptr->dp = dptr; if (fptr->high != NULL) high_order_point (fptr->high, dptr->high); fptr = fptr->next; dptr = dptr->next; }; } void high_order_point (struct fitpars *fptr, struct derivs *dptr) { struct derivs *dptr2; static int high=0; /*-----------------------------------------------------------------------\ | Go down to the very end of the main and high order structures first. | \-----------------------------------------------------------------------*/ if (fptr->high != NULL) high_order_point (fptr->high, dptr->high); if (fptr->next != NULL) high_order_point (fptr->next, dptr->next); /*--------------------------------------------------------------\ | Establish the link as we pop back up to the top one by one. | \--------------------------------------------------------------*/ fptr->dp = dptr; }