cvode_dense.h File Reference

#include "sundials_dense.h"
#include "sundials_nvector.h"

Include dependency graph for cvode_dense.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define CVD_MSBJ   50
#define CVD_DGMAX   RCONST(0.2)
#define CVDENSE_SUCCESS   0
#define CVDENSE_MEM_NULL   -1
#define CVDENSE_LMEM_NULL   -2
#define CVDENSE_ILL_INPUT   -3
#define CVDENSE_MEM_FAIL   -4
#define CVDENSE_JACFUNC_UNRECVR   -5
#define CVDENSE_JACFUNC_RECVR   -6

Typedefs

typedef int(* CVDenseJacFn )(long int N, DenseMat J, realtype t, N_Vector y, N_Vector fy, void *jac_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)

Functions

int CVDense (void *cvode_mem, long int N)
int CVDenseSetJacFn (void *cvode_mem, CVDenseJacFn djac, void *jac_data)
int CVDenseGetWorkSpace (void *cvode_mem, long int *lenrwLS, long int *leniwLS)
int CVDenseGetNumJacEvals (void *cvode_mem, long int *njevals)
int CVDenseGetNumRhsEvals (void *cvode_mem, long int *nfevalsLS)
int CVDenseGetLastFlag (void *cvode_mem, int *flag)
char * CVDenseGetReturnFlagName (int flag)


Define Documentation

#define CVD_DGMAX   RCONST(0.2)

Definition at line 41 of file cvode_dense.h.

Referenced by CVDenseSetup().

#define CVD_MSBJ   50

Definition at line 40 of file cvode_dense.h.

Referenced by CVDenseSetup().

#define CVDENSE_ILL_INPUT   -3

Definition at line 196 of file cvode_dense.h.

Referenced by CVDense(), and CVDenseGetReturnFlagName().

#define CVDENSE_JACFUNC_RECVR   -6

Definition at line 202 of file cvode_dense.h.

Referenced by CVDenseGetReturnFlagName(), and CVDenseSetup().

#define CVDENSE_JACFUNC_UNRECVR   -5

Definition at line 201 of file cvode_dense.h.

Referenced by CVDenseGetReturnFlagName(), and CVDenseSetup().

#define CVDENSE_LMEM_NULL   -2

#define CVDENSE_MEM_FAIL   -4

Definition at line 197 of file cvode_dense.h.

Referenced by CVDense(), and CVDenseGetReturnFlagName().

#define CVDENSE_MEM_NULL   -1

#define CVDENSE_SUCCESS   0


Typedef Documentation

typedef int(* CVDenseJacFn)(long int N, DenseMat J, realtype t, N_Vector y, N_Vector fy, void *jac_data, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)

Definition at line 106 of file cvode_dense.h.


Function Documentation

int CVDense ( void *  cvode_mem,
long int  N 
)

Definition at line 107 of file cvode_dense.c.

References CVDENSE_ILL_INPUT, CVDENSE_MEM_FAIL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVDenseDQJac(), CVDenseFree(), CVDenseInit(), CVDenseSetup(), CVDenseSolve(), CVProcessError(), DenseAllocMat(), DenseAllocPiv(), DenseFreeMat(), free(), J_data, jac, last_flag, lfree, linit, lmem, lsetup, lsolve, M, malloc(), MSGDS_BAD_NVECTOR, MSGDS_CVMEM_NULL, MSGDS_MEM_FAIL, n, NULL, pivots, savedJ, setupNonNull, TRUE, and vec_tmpl.

Referenced by cossim().

00108 {
00109   CVodeMem cv_mem;
00110   CVDenseMem cvdense_mem;
00111 
00112   /* Return immediately if cvode_mem is NULL */
00113   if (cvode_mem == NULL) {
00114     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDense", MSGDS_CVMEM_NULL);
00115     return(CVDENSE_MEM_NULL);
00116   }
00117   cv_mem = (CVodeMem) cvode_mem;
00118 
00119   /* Test if the NVECTOR package is compatible with the DENSE solver */
00120   if (vec_tmpl->ops->nvgetarraypointer == NULL ||
00121       vec_tmpl->ops->nvsetarraypointer == NULL) {
00122     CVProcessError(cv_mem, CVDENSE_ILL_INPUT, "CVDENSE", "CVDense", MSGDS_BAD_NVECTOR);
00123     return(CVDENSE_ILL_INPUT);
00124   }
00125 
00126   if (lfree !=NULL) lfree(cv_mem);
00127 
00128   /* Set four main function fields in cv_mem */
00129   linit  = CVDenseInit;
00130   lsetup = CVDenseSetup;
00131   lsolve = CVDenseSolve;
00132   lfree  = CVDenseFree;
00133 
00134   /* Get memory for CVDenseMemRec */
00135   cvdense_mem = NULL;
00136   cvdense_mem = (CVDenseMem) malloc(sizeof(CVDenseMemRec));
00137   if (cvdense_mem == NULL) {
00138     CVProcessError(cv_mem, CVDENSE_MEM_FAIL, "CVDENSE", "CVDense", MSGDS_MEM_FAIL);
00139     return(CVDENSE_MEM_FAIL);
00140   }
00141 
00142   /* Set default Jacobian routine and Jacobian data */
00143   jac = CVDenseDQJac;
00144   J_data = cvode_mem;
00145   last_flag = CVDENSE_SUCCESS;
00146 
00147   setupNonNull = TRUE;
00148 
00149   /* Set problem dimension */
00150   n = N;
00151 
00152   /* Allocate memory for M, savedJ, and pivot array */
00153 
00154   M = NULL;
00155   M = DenseAllocMat(N, N);
00156   if (M == NULL) {
00157     CVProcessError(cv_mem, CVDENSE_MEM_FAIL, "CVDENSE", "CVDense", MSGDS_MEM_FAIL);
00158     free(cvdense_mem); cvdense_mem = NULL;
00159     return(CVDENSE_MEM_FAIL);
00160   }
00161   savedJ = NULL;
00162   savedJ = DenseAllocMat(N, N);
00163   if (savedJ == NULL) {
00164     CVProcessError(cv_mem, CVDENSE_MEM_FAIL, "CVDENSE", "CVDense", MSGDS_MEM_FAIL);
00165     DenseFreeMat(M);
00166     free(cvdense_mem); cvdense_mem = NULL;
00167     return(CVDENSE_MEM_FAIL);
00168   }
00169   pivots = NULL;
00170   pivots = DenseAllocPiv(N);
00171   if (pivots == NULL) {
00172     CVProcessError(cv_mem, CVDENSE_MEM_FAIL, "CVDENSE", "CVDense", MSGDS_MEM_FAIL);
00173     DenseFreeMat(M);
00174     DenseFreeMat(savedJ);
00175     free(cvdense_mem); cvdense_mem = NULL;
00176     return(CVDENSE_MEM_FAIL);
00177   }
00178 
00179   /* Attach linear solver memory to integrator memory */
00180   lmem = cvdense_mem;
00181 
00182   return(CVDENSE_SUCCESS);
00183 }

Here is the call graph for this function:

Here is the caller graph for this function:

int CVDenseGetLastFlag ( void *  cvode_mem,
int *  flag 
)

Definition at line 350 of file cvode_dense.c.

References CVDENSE_LMEM_NULL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVProcessError(), last_flag, lmem, MSGDS_CVMEM_NULL, MSGDS_LMEM_NULL, and NULL.

00351 {
00352   CVodeMem cv_mem;
00353   CVDenseMem cvdense_mem;
00354 
00355   /* Return immediately if cvode_mem is NULL */
00356   if (cvode_mem == NULL) {
00357     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDenseGetLastFlag", MSGDS_CVMEM_NULL);
00358     return(CVDENSE_MEM_NULL);
00359   }
00360   cv_mem = (CVodeMem) cvode_mem;
00361 
00362   if (lmem == NULL) {
00363     CVProcessError(cv_mem, CVDENSE_LMEM_NULL, "CVDENSE", "CVDenseGetLastFlag", MSGDS_LMEM_NULL);
00364     return(CVDENSE_LMEM_NULL);
00365   }
00366   cvdense_mem = (CVDenseMem) lmem;
00367 
00368   *flag = last_flag;
00369 
00370   return(CVDENSE_SUCCESS);
00371 }

Here is the call graph for this function:

int CVDenseGetNumJacEvals ( void *  cvode_mem,
long int *  njevals 
)

Definition at line 251 of file cvode_dense.c.

References CVDENSE_LMEM_NULL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVProcessError(), lmem, MSGDS_CVMEM_NULL, MSGDS_LMEM_NULL, nje, and NULL.

00252 {
00253   CVodeMem cv_mem;
00254   CVDenseMem cvdense_mem;
00255 
00256   /* Return immediately if cvode_mem is NULL */
00257   if (cvode_mem == NULL) {
00258     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDenseGetNumJacEvals", MSGDS_CVMEM_NULL);
00259     return(CVDENSE_MEM_NULL);
00260   }
00261   cv_mem = (CVodeMem) cvode_mem;
00262 
00263   if (lmem == NULL) {
00264     CVProcessError(cv_mem, CVDENSE_LMEM_NULL, "CVDENSE", "CVDenseGetNumJacEvals", MSGDS_LMEM_NULL);
00265     return(CVDENSE_LMEM_NULL);
00266   }
00267   cvdense_mem = (CVDenseMem) lmem;
00268 
00269   *njevals = nje;
00270 
00271   return(CVDENSE_SUCCESS);
00272 }

Here is the call graph for this function:

int CVDenseGetNumRhsEvals ( void *  cvode_mem,
long int *  nfevalsLS 
)

Definition at line 280 of file cvode_dense.c.

References CVDENSE_LMEM_NULL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVProcessError(), lmem, MSGDS_CVMEM_NULL, MSGDS_LMEM_NULL, nfeD, and NULL.

00281 {
00282   CVodeMem cv_mem;
00283   CVDenseMem cvdense_mem;
00284 
00285   /* Return immediately if cvode_mem is NULL */
00286   if (cvode_mem == NULL) {
00287     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDenseGetNumRhsEvals", MSGDS_CVMEM_NULL);
00288     return(CVDENSE_MEM_NULL);
00289   }
00290   cv_mem = (CVodeMem) cvode_mem;
00291 
00292   if (lmem == NULL) {
00293     CVProcessError(cv_mem, CVDENSE_LMEM_NULL, "CVDENSE", "CVDenseGetNumRhsEvals", MSGDS_LMEM_NULL);
00294     return(CVDENSE_LMEM_NULL);
00295   }
00296   cvdense_mem = (CVDenseMem) lmem;
00297 
00298   *nfevalsLS = nfeD;
00299 
00300   return(CVDENSE_SUCCESS);
00301 }

Here is the call graph for this function:

char* CVDenseGetReturnFlagName ( int  flag  ) 

Definition at line 309 of file cvode_dense.c.

References CVDENSE_ILL_INPUT, CVDENSE_JACFUNC_RECVR, CVDENSE_JACFUNC_UNRECVR, CVDENSE_LMEM_NULL, CVDENSE_MEM_FAIL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, malloc(), and name.

00310 {
00311   char *name;
00312 
00313   name = (char *)malloc(30*sizeof(char));
00314 
00315   switch(flag) {
00316   case CVDENSE_SUCCESS:
00317     sprintf(name,"CVDENSE_SUCCESS");
00318     break;   
00319   case CVDENSE_MEM_NULL:
00320     sprintf(name,"CVDENSE_MEM_NULL");
00321     break;
00322   case CVDENSE_LMEM_NULL:
00323     sprintf(name,"CVDENSE_LMEM_NULL");
00324     break;
00325   case CVDENSE_ILL_INPUT:
00326     sprintf(name,"CVDENSE_ILL_INPUT");
00327     break;
00328   case CVDENSE_MEM_FAIL:
00329     sprintf(name,"CVDENSE_MEM_FAIL");
00330     break;
00331   case CVDENSE_JACFUNC_UNRECVR:
00332     sprintf(name,"CVDENSE_JACFUNC_UNRECVR");
00333     break;
00334   case CVDENSE_JACFUNC_RECVR:
00335     sprintf(name,"CVDENSE_JACFUNC_RECVR");
00336     break;
00337   default:
00338     sprintf(name,"NONE");
00339   }
00340 
00341   return(name);
00342 }

Here is the call graph for this function:

int CVDenseGetWorkSpace ( void *  cvode_mem,
long int *  lenrwLS,
long int *  leniwLS 
)

Definition at line 221 of file cvode_dense.c.

References CVDENSE_LMEM_NULL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVProcessError(), lmem, MSGDS_CVMEM_NULL, MSGDS_LMEM_NULL, n, and NULL.

00222 {
00223   CVodeMem cv_mem;
00224   CVDenseMem cvdense_mem;
00225 
00226   /* Return immediately if cvode_mem is NULL */
00227   if (cvode_mem == NULL) {
00228     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDenseGetWorkSpace", MSGDS_CVMEM_NULL);
00229     return(CVDENSE_MEM_NULL);
00230   }
00231   cv_mem = (CVodeMem) cvode_mem;
00232 
00233   if (lmem == NULL) {
00234     CVProcessError(cv_mem, CVDENSE_LMEM_NULL, "CVDENSE", "CVDenseGetWorkSpace", MSGDS_LMEM_NULL);
00235     return(CVDENSE_LMEM_NULL);
00236   }
00237   cvdense_mem = (CVDenseMem) lmem;
00238 
00239   *lenrwLS = 2*n*n;
00240   *leniwLS = n;
00241 
00242   return(CVDENSE_SUCCESS);
00243 }

Here is the call graph for this function:

int CVDenseSetJacFn ( void *  cvode_mem,
CVDenseJacFn  djac,
void *  jac_data 
)

Definition at line 191 of file cvode_dense.c.

References CVDENSE_LMEM_NULL, CVDENSE_MEM_NULL, CVDENSE_SUCCESS, CVProcessError(), J_data, jac, lmem, MSGDS_CVMEM_NULL, MSGDS_LMEM_NULL, and NULL.

00192 {
00193   CVodeMem cv_mem;
00194   CVDenseMem cvdense_mem;
00195 
00196   /* Return immediately if cvode_mem is NULL */
00197   if (cvode_mem == NULL) {
00198     CVProcessError(NULL, CVDENSE_MEM_NULL, "CVDENSE", "CVDenseSetJacFn", MSGDS_CVMEM_NULL);
00199     return(CVDENSE_MEM_NULL);
00200   }
00201   cv_mem = (CVodeMem) cvode_mem;
00202 
00203   if (lmem == NULL) {
00204     CVProcessError(cv_mem, CVDENSE_LMEM_NULL, "CVDENSE", "CVDenseSetJacFn", MSGDS_LMEM_NULL);
00205     return(CVDENSE_LMEM_NULL);
00206   }
00207   cvdense_mem = (CVDenseMem) lmem;
00208 
00209   jac = djac;
00210   if (djac != NULL) J_data = jac_data;
00211 
00212   return(CVDENSE_SUCCESS);
00213 }

Here is the call graph for this function:


Generated on Tue Sep 9 18:17:08 2008 for Scilab [trunk] by  doxygen 1.5.5