| 736 | ********************************************************************/ |
| 737 | |
| 738 | int CVode(void *cvode_mem, real tout, N_Vector yout, real *t, int itask) |
| 739 | { |
| 740 | int nstloc, kflag, istate, next_q, ier; |
| 741 | real rh, next_h; |
| 742 | boole hOK, ewtsetOK; |
| 743 | CVodeMem cv_mem; |
| 744 | |
| 745 | /* Check for legal inputs in all cases */ |
| 746 | |
| 747 | cv_mem = (CVodeMem) cvode_mem; |
| 748 | if (cvode_mem == NULL) { |
| 749 | fprintf(stdout, MSG_CVODE_NO_MEM); |
| 750 | return(CVODE_NO_MEM); |
| 751 | } |
| 752 | |
| 753 | if ((y = yout) == NULL) { |
| 754 | fprintf(errfp, MSG_YOUT_NULL); |
| 755 | return(ILL_INPUT); |
| 756 | } |
| 757 | |
| 758 | if (t == NULL) { |
| 759 | fprintf(errfp, MSG_T_NULL); |
| 760 | return(ILL_INPUT); |
| 761 | } |
| 762 | *t = tn; |
| 763 | |
| 764 | if ((itask != NORMAL) && (itask != ONE_STEP)) { |
| 765 | fprintf(errfp, MSG_BAD_ITASK, itask, NORMAL, ONE_STEP); |
| 766 | return(ILL_INPUT); |
| 767 | } |
| 768 | |
| 769 | /* On first call, check solver functions and call linit function */ |
| 770 | |
| 771 | if (nst == 0) { |
| 772 | if (iter == NEWTON) { |
| 773 | if (linit == NULL) { |
| 774 | fprintf(errfp, MSG_LINIT_NULL); |
| 775 | return(ILL_INPUT); |
| 776 | } |
| 777 | if (lsetup == NULL) { |
| 778 | fprintf(errfp, MSG_LSETUP_NULL); |
| 779 | return(ILL_INPUT); |
| 780 | } |
| 781 | if (lsolve == NULL) { |
| 782 | fprintf(errfp, MSG_LSOLVE_NULL); |
| 783 | return(ILL_INPUT); |
| 784 | } |
| 785 | if (lfree == NULL) { |
| 786 | fprintf(errfp, MSG_LFREE_NULL); |
| 787 | return(ILL_INPUT); |
| 788 | } |
| 789 | linitOK = (linit(cv_mem, &(setupNonNull)) == LINIT_OK); |
| 790 | if (!linitOK) { |
| 791 | fprintf(errfp, MSG_LINIT_FAIL); |
| 792 | return(ILL_INPUT); |
| 793 | } |
| 794 | } |
| 795 |
no test coverage detected