| 140 | **********************************************************************/ |
| 141 | |
| 142 | static int CVDiagInit(CVodeMem cv_mem, boole *setupNonNull) |
| 143 | { |
| 144 | CVDiagMem cvdiag_mem; |
| 145 | |
| 146 | cvdiag_mem = (CVDiagMem) lmem; |
| 147 | |
| 148 | /* Print error message and return if cvdiag_mem is NULL */ |
| 149 | if (cvdiag_mem == NULL) { |
| 150 | fprintf(errfp, MSG_MEM_FAIL); |
| 151 | return(LINIT_ERR); |
| 152 | } |
| 153 | |
| 154 | /* Set flag setupNonNull = TRUE */ |
| 155 | *setupNonNull = TRUE; |
| 156 | |
| 157 | /* Allocate memory for M, bit, and bitcomp */ |
| 158 | |
| 159 | M = N_VNew(N, (machEnvType)machenv); |
| 160 | if (M == NULL) { |
| 161 | fprintf(errfp, MSG_MEM_FAIL); |
| 162 | return(LINIT_ERR); |
| 163 | } |
| 164 | bit = N_VNew(N, (machEnvType)machenv); |
| 165 | if (bit == NULL) { |
| 166 | fprintf(errfp, MSG_MEM_FAIL); |
| 167 | N_VFree(M); |
| 168 | return(LINIT_ERR); |
| 169 | } |
| 170 | bitcomp = N_VNew(N, (machEnvType)machenv); |
| 171 | if (bitcomp == NULL) { |
| 172 | fprintf(errfp, MSG_MEM_FAIL); |
| 173 | N_VFree(M); |
| 174 | N_VFree(bit); |
| 175 | return(LINIT_ERR); |
| 176 | } |
| 177 | |
| 178 | /* Set workspace lengths */ |
| 179 | if (iopt != NULL) { |
| 180 | iopt[DIAG_LRW] = N*3; |
| 181 | iopt[DIAG_LIW] = 0; |
| 182 | } |
| 183 | |
| 184 | return(LINIT_OK); |
| 185 | } |
| 186 | |
| 187 | /*************** CVDiagSetup ***************************************** |
| 188 | |