static void PrintFinalStats(void *mem) { long int nst, nre, sli, netf, nps, npevals, nrevalsLS; int flag; flag = IDAGetNumSteps(mem, &nst); check_flag(&flag, "IDAGetNumSteps", 1); flag = IDASpilsGetNumLinIters(mem, &sli); check_flag(&flag, "IDAGetNumNonlinSolvIters", 1); flag = IDAGetNumResEvals(mem, &nre); check_flag(&flag, "IDAGetNumResEvals", 1); flag = IDAGetNumErrTestFails(mem, &netf); check_flag(&flag, "IDAGetNumErrTestFails", 1); flag = IDASpilsGetNumPrecSolves(mem, &nps); check_flag(&flag, "IDAGetNumNonlinSolvConvFails", 1); flag = IDASpilsGetNumPrecEvals(mem, &npevals); check_flag(&flag, "IDADlsGetNumJacEvals", 1); flag = IDASpilsGetNumResEvals(mem, &nrevalsLS); check_flag(&flag, "IDADlsGetNumResEvals", 1); printf("-----------------------------------------------------------\n"); printf("Final run statistics: \n\n"); printf("Number of steps = %ld\n", nst); printf("Number of residual evaluations = %ld\n", nre); printf("Number of Preconditioner evaluations = %ld\n", npevals); printf("Number of linear iterations = %ld\n", sli); printf("Number of error test failures = %ld\n", netf); printf("Number of precond solve fun called = %ld\n", nps); }
static void PrintFinalStats(void *mem) { long int nst, nre, nreLS, netf, ncfn, nni, ncfl, nli, npe, nps, nge; int flag; flag = IDAGetNumSteps(mem, &nst); check_flag(&flag, "IDAGetNumSteps", 1, 0); flag = IDAGetNumResEvals(mem, &nre); check_flag(&flag, "IDAGetNumResEvals", 1, 0); flag = IDAGetNumErrTestFails(mem, &netf); check_flag(&flag, "IDAGetNumErrTestFails", 1, 0); flag = IDAGetNumNonlinSolvConvFails(mem, &ncfn); check_flag(&flag, "IDAGetNumNonlinSolvConvFails", 1, 0); flag = IDAGetNumNonlinSolvIters(mem, &nni); check_flag(&flag, "IDAGetNumNonlinSolvIters", 1, 0); flag = IDASpilsGetNumConvFails(mem, &ncfl); check_flag(&flag, "IDASpilsGetNumConvFails", 1, 0); flag = IDASpilsGetNumLinIters(mem, &nli); check_flag(&flag, "IDASpilsGetNumLinIters", 1, 0); flag = IDASpilsGetNumPrecEvals(mem, &npe); check_flag(&flag, "IDASpilsGetNumPrecEvals", 1, 0); flag = IDASpilsGetNumPrecSolves(mem, &nps); check_flag(&flag, "IDASpilsGetNumPrecSolves", 1, 0); flag = IDASpilsGetNumResEvals(mem, &nreLS); check_flag(&flag, "IDASpilsGetNumResEvals", 1, 0); flag = IDABBDPrecGetNumGfnEvals(mem, &nge); check_flag(&flag, "IDABBDPrecGetNumGfnEvals", 1, 0); printf("-----------------------------------------------------------\n"); printf("\nFinal statistics: \n\n"); printf("Number of steps = %ld\n", nst); printf("Number of residual evaluations = %ld\n", nre+nreLS); printf("Number of nonlinear iterations = %ld\n", nni); printf("Number of error test failures = %ld\n", netf); printf("Number of nonlinear conv. failures = %ld\n\n", ncfn); printf("Number of linear iterations = %ld\n", nli); printf("Number of linear conv. failures = %ld\n\n", ncfl); printf("Number of preconditioner setups = %ld\n", npe); printf("Number of preconditioner solves = %ld\n", nps); printf("Number of local residual evals. = %ld\n", nge); }
static void PrintOutput(int id, void *mem, realtype t, N_Vector uu) { realtype umax, hused; int kused, ier; long int nst, nni, nre, nli, npe, nps, nreLS, nge; umax = N_VMaxNorm(uu); if (id == 0) { ier = IDAGetLastOrder(mem, &kused); check_flag(&ier, "IDAGetLastOrder", 1, id); ier = IDAGetNumSteps(mem, &nst); check_flag(&ier, "IDAGetNumSteps", 1, id); ier = IDAGetNumNonlinSolvIters(mem, &nni); check_flag(&ier, "IDAGetNumNonlinSolvIters", 1, id); ier = IDAGetNumResEvals(mem, &nre); check_flag(&ier, "IDAGetNumResEvals", 1, id); ier = IDAGetLastStep(mem, &hused); check_flag(&ier, "IDAGetLastStep", 1, id); ier = IDASpilsGetNumLinIters(mem, &nli); check_flag(&ier, "IDASpilsGetNumLinIters", 1, id); ier = IDASpilsGetNumResEvals(mem, &nreLS); check_flag(&ier, "IDASpilsGetNumResEvals", 1, id); ier = IDABBDPrecGetNumGfnEvals(mem, &nge); check_flag(&ier, "IDABBDPrecGetNumGfnEvals", 1, id); ier = IDASpilsGetNumPrecEvals(mem, &npe); check_flag(&ier, "IDASpilsGetPrecEvals", 1, id); ier = IDASpilsGetNumPrecSolves(mem, &nps); check_flag(&ier, "IDASpilsGetNumPrecSolves", 1, id); #if defined(SUNDIALS_EXTENDED_PRECISION) printf(" %5.2Lf %13.5Le %d %3ld %3ld %3ld %4ld %4ld %4ld %9.2Le %3ld %3ld\n", t, umax, kused, nst, nni, nli, nre, nreLS, nge, hused, npe, nps); #elif defined(SUNDIALS_DOUBLE_PRECISION) printf(" %5.2f %13.5e %d %3ld %3ld %3ld %4ld %4ld %4ld %9.2e %3ld %3ld\n", t, umax, kused, nst, nni, nli, nre, nreLS, nge, hused, npe, nps); #else printf(" %5.2f %13.5e %d %3ld %3ld %3ld %4ld %4ld %4ld %9.2e %3ld %3ld\n", t, umax, kused, nst, nni, nli, nre, nreLS, nge, hused, npe, nps); #endif } }
void FIDA_SOLVE(realtype *tout, realtype *tret, realtype *yret, realtype *ypret, int *itask, int *ier) { int klast, kcur; *ier = 0; /* Attach user data to vectors */ N_VSetArrayPointer(yret, F2C_IDA_vec); N_VSetArrayPointer(ypret, F2C_IDA_ypvec); *ier = IDASolve(IDA_idamem, *tout, tret, F2C_IDA_vec, F2C_IDA_ypvec, *itask); /* Reset data pointers */ N_VSetArrayPointer(NULL, F2C_IDA_vec); N_VSetArrayPointer(NULL, F2C_IDA_ypvec); /* Set optional outputs */ IDAGetWorkSpace(IDA_idamem, &IDA_iout[0], /* LENRW */ &IDA_iout[1]); /* LENIW */ IDAGetIntegratorStats(IDA_idamem, &IDA_iout[2], /* NST */ &IDA_iout[3], /* NRE */ &IDA_iout[7], /* NSETUPS */ &IDA_iout[4], /* NETF */ &klast, /* KLAST */ &kcur, /* KCUR */ &IDA_rout[0], /* HINUSED */ &IDA_rout[1], /* HLAST */ &IDA_rout[2], /* HCUR */ &IDA_rout[3]); /* TCUR */ IDA_iout[8] = (long int) klast; IDA_iout[9] = (long int) kcur; IDAGetNonlinSolvStats(IDA_idamem, &IDA_iout[6], /* NNI */ &IDA_iout[5]); /* NCFN */ IDAGetNumBacktrackOps(IDA_idamem, &IDA_iout[10]); /* NBCKTRK */ IDAGetTolScaleFactor(IDA_idamem, &IDA_rout[4]); /* TOLSFAC */ /* Root finding is on */ if (IDA_nrtfn != 0) IDAGetNumGEvals(IDA_idamem, &IDA_iout[11]); /* NGE */ switch(IDA_ls) { case IDA_LS_DENSE: case IDA_LS_BAND: case IDA_LS_LAPACKDENSE: case IDA_LS_LAPACKBAND: IDADlsGetWorkSpace(IDA_idamem, &IDA_iout[12], &IDA_iout[13]); /* LENRWLS, LENIWLS */ IDADlsGetLastFlag(IDA_idamem, &IDA_iout[14]); /* LSTF */ IDADlsGetNumResEvals(IDA_idamem, &IDA_iout[15]); /* NRE */ IDADlsGetNumJacEvals(IDA_idamem, &IDA_iout[16]); /* NJE */ break; case IDA_LS_KLU: case IDA_LS_SUPERLUMT: IDASlsGetLastFlag(IDA_idamem, &IDA_iout[14]); /* LSTF */ IDASlsGetNumJacEvals(IDA_idamem, &IDA_iout[16]); /* NJE */ break; case IDA_LS_SPGMR: case IDA_LS_SPBCG: case IDA_LS_SPTFQMR: IDASpilsGetWorkSpace(IDA_idamem, &IDA_iout[12], &IDA_iout[13]); /* LENRWLS, LENIWLS */ IDASpilsGetLastFlag(IDA_idamem, &IDA_iout[14]); /* LSTF */ IDASpilsGetNumResEvals(IDA_idamem, &IDA_iout[15]); /* NRE */ IDASpilsGetNumJtimesEvals(IDA_idamem, &IDA_iout[16]); /* NJE */ IDASpilsGetNumPrecEvals(IDA_idamem, &IDA_iout[17]); /* NPE */ IDASpilsGetNumPrecSolves(IDA_idamem, &IDA_iout[18]); /* NPS */ IDASpilsGetNumLinIters(IDA_idamem, &IDA_iout[19]); /* NLI */ IDASpilsGetNumConvFails(IDA_idamem, &IDA_iout[20]); /* NCFL */ break; } return; }