ida_dense.h File Reference

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

Include dependency graph for ida_dense.h:

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

Go to the source code of this file.

Defines

#define IDADENSE_SUCCESS   0
#define IDADENSE_MEM_NULL   -1
#define IDADENSE_LMEM_NULL   -2
#define IDADENSE_ILL_INPUT   -3
#define IDADENSE_MEM_FAIL   -4
#define IDADENSE_JACFUNC_UNRECVR   -5
#define IDADENSE_JACFUNC_RECVR   -6

Typedefs

typedef int(* IDADenseJacFn )(long int Neq, realtype tt, N_Vector yy, N_Vector yp, N_Vector rr, realtype c_j, void *jac_data, DenseMat Jac, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)

Functions

int IDADense (void *ida_mem, long int Neq)
int IDADenseSetJacFn (void *ida_mem, IDADenseJacFn djac, void *jac_data)
int IDADenseGetWorkSpace (void *ida_mem, long int *lenrwLS, long int *leniwLS)
int IDADenseGetNumJacEvals (void *ida_mem, long int *njevals)
int IDADenseGetNumResEvals (void *ida_mem, long int *nrevalsLS)
int IDADenseGetLastFlag (void *ida_mem, int *flag)
char * IDADenseGetReturnFlagName (int flag)


Define Documentation

#define IDADENSE_ILL_INPUT   -3

Definition at line 37 of file ida_dense.h.

Referenced by IDADense(), and IDADenseGetReturnFlagName().

#define IDADENSE_JACFUNC_RECVR   -6

Definition at line 43 of file ida_dense.h.

Referenced by IDADenseGetReturnFlagName(), and IDADenseSetup().

#define IDADENSE_JACFUNC_UNRECVR   -5

Definition at line 42 of file ida_dense.h.

Referenced by IDADenseGetReturnFlagName(), and IDADenseSetup().

#define IDADENSE_LMEM_NULL   -2

#define IDADENSE_MEM_FAIL   -4

Definition at line 38 of file ida_dense.h.

Referenced by IDADense(), and IDADenseGetReturnFlagName().

#define IDADENSE_MEM_NULL   -1

#define IDADENSE_SUCCESS   0


Typedef Documentation

typedef int(* IDADenseJacFn)(long int Neq, realtype tt, N_Vector yy, N_Vector yp, N_Vector rr, realtype c_j, void *jac_data, DenseMat Jac, N_Vector tmp1, N_Vector tmp2, N_Vector tmp3)

Definition at line 118 of file ida_dense.h.


Function Documentation

int IDADense ( void *  ida_mem,
long int  Neq 
)

Definition at line 110 of file ida_dense.c.

References DenseAllocMat(), DenseAllocPiv(), DenseFreeMat(), free(), IDADENSE_ILL_INPUT, IDADENSE_MEM_FAIL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDADenseDQJac(), IDADenseFree(), IDADenseInit(), IDADenseSetup(), IDADenseSolve(), IDAProcessError(), jac, jacdata, JJ, last_flag, lfree, linit, lmem, lperf, lsetup, lsolve, malloc(), MSGD_BAD_NVECTOR, MSGD_IDAMEM_NULL, MSGD_MEM_FAIL, neq, NULL, pivots, setupNonNull, TRUE, and vec_tmpl.

Referenced by cossimdaskr().

00111 {
00112   IDAMem IDA_mem;
00113   IDADenseMem idadense_mem;
00114   int flag;
00115 
00116   /* Return immediately if ida_mem is NULL. */
00117   if (ida_mem == NULL) {
00118     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADense", MSGD_IDAMEM_NULL);
00119     return(IDADENSE_MEM_NULL);
00120   }
00121   IDA_mem = (IDAMem) ida_mem;
00122 
00123   /* Test if the NVECTOR package is compatible with the DENSE solver */
00124   if(vec_tmpl->ops->nvgetarraypointer == NULL ||
00125      vec_tmpl->ops->nvsetarraypointer == NULL) {
00126     IDAProcessError(IDA_mem, IDADENSE_ILL_INPUT, "IDADENSE", "IDADense", MSGD_BAD_NVECTOR);
00127     return(IDADENSE_ILL_INPUT);
00128   }
00129 
00130   if (lfree != NULL) flag = lfree(IDA_mem);
00131 
00132   /* Set five main function fields in IDA_mem. */
00133   linit  = IDADenseInit;
00134   lsetup = IDADenseSetup;
00135   lsolve = IDADenseSolve;
00136   lperf  = NULL;
00137   lfree  = IDADenseFree;
00138 
00139   /* Get memory for IDADenseMemRec. */
00140   idadense_mem = NULL;
00141   idadense_mem = (IDADenseMem) malloc(sizeof(IDADenseMemRec));
00142   if (idadense_mem == NULL) {
00143     IDAProcessError(IDA_mem, IDADENSE_MEM_FAIL, "IDADENSE", "IDADense", MSGD_MEM_FAIL);
00144     return(IDADENSE_MEM_FAIL);
00145   }
00146 
00147   /* Set default Jacobian routine and Jacobian data */
00148   jac = IDADenseDQJac;
00149   jacdata = IDA_mem;
00150   last_flag = IDADENSE_SUCCESS;
00151 
00152   setupNonNull = TRUE;
00153 
00154   /* Store problem size */
00155   neq = Neq;
00156 
00157   /* Allocate memory for JJ and pivot array. */
00158   JJ = NULL;
00159   JJ = DenseAllocMat(Neq, Neq);
00160   if (JJ == NULL) {
00161     IDAProcessError(IDA_mem, IDADENSE_MEM_FAIL, "IDADENSE", "IDADense", MSGD_MEM_FAIL);
00162     free(idadense_mem); idadense_mem = NULL;
00163     return(IDADENSE_MEM_FAIL);
00164   }
00165 
00166   pivots = NULL;
00167   pivots = DenseAllocPiv(Neq);
00168   if (pivots == NULL) {
00169     IDAProcessError(IDA_mem, IDADENSE_MEM_FAIL, "IDADENSE", "IDADense", MSGD_MEM_FAIL);
00170     DenseFreeMat(JJ);
00171     free(idadense_mem); idadense_mem = NULL;
00172     return(IDADENSE_MEM_FAIL);
00173   }
00174 
00175   /* Attach linear solver memory to the integrator memory */
00176   lmem = idadense_mem;
00177 
00178   return(IDADENSE_SUCCESS);
00179 }

Here is the call graph for this function:

Here is the caller graph for this function:

int IDADenseGetLastFlag ( void *  ida_mem,
int *  flag 
)

Definition at line 281 of file ida_dense.c.

References IDADENSE_LMEM_NULL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDAProcessError(), last_flag, lmem, MSGD_IDAMEM_NULL, MSGD_LMEM_NULL, and NULL.

00282 {
00283   IDAMem IDA_mem;
00284   IDADenseMem idadense_mem;
00285 
00286   /* Return immediately if ida_mem is NULL */
00287   if (ida_mem == NULL) {
00288     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADenseGetLastFlag", MSGD_IDAMEM_NULL);
00289     return(IDADENSE_MEM_NULL);
00290   }
00291   IDA_mem = (IDAMem) ida_mem;
00292 
00293   if (lmem == NULL) {
00294     IDAProcessError(IDA_mem, IDADENSE_LMEM_NULL, "IDADENSE", "IDADenseGetLastFlag", MSGD_LMEM_NULL);
00295     return(IDADENSE_LMEM_NULL);
00296   }
00297   idadense_mem = (IDADenseMem) lmem;
00298 
00299   *flag = last_flag;
00300 
00301   return(IDADENSE_SUCCESS);
00302 }

Here is the call graph for this function:

int IDADenseGetNumJacEvals ( void *  ida_mem,
long int *  njevals 
)

Definition at line 235 of file ida_dense.c.

References IDADENSE_LMEM_NULL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDAProcessError(), lmem, MSGD_IDAMEM_NULL, MSGD_LMEM_NULL, nje, and NULL.

00236 {
00237   IDAMem IDA_mem;
00238   IDADenseMem idadense_mem;
00239 
00240   /* Return immediately if ida_mem is NULL */
00241   if (ida_mem == NULL) {
00242     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADenseGetNumJacEvals", MSGD_IDAMEM_NULL);
00243     return(IDADENSE_MEM_NULL);
00244   }
00245   IDA_mem = (IDAMem) ida_mem;
00246 
00247   if (lmem == NULL) {
00248     IDAProcessError(IDA_mem, IDADENSE_LMEM_NULL, "IDADENSE", "IDADenseGetNumJacEvals", MSGD_LMEM_NULL);
00249     return(IDADENSE_LMEM_NULL);
00250   }
00251   idadense_mem = (IDADenseMem) lmem;
00252 
00253   *njevals = nje;
00254 
00255   return(IDADENSE_SUCCESS);
00256 }

Here is the call graph for this function:

int IDADenseGetNumResEvals ( void *  ida_mem,
long int *  nrevalsLS 
)

Definition at line 258 of file ida_dense.c.

References IDADENSE_LMEM_NULL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDAProcessError(), lmem, MSGD_IDAMEM_NULL, MSGD_LMEM_NULL, nreD, and NULL.

00259 {
00260   IDAMem IDA_mem;
00261   IDADenseMem idadense_mem;
00262 
00263   /* Return immediately if ida_mem is NULL */
00264   if (ida_mem == NULL) {
00265     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADenseGetNumResEvals", MSGD_IDAMEM_NULL);
00266     return(IDADENSE_MEM_NULL);
00267   }
00268   IDA_mem = (IDAMem) ida_mem;
00269 
00270   if (lmem == NULL) {
00271     IDAProcessError(IDA_mem, IDADENSE_LMEM_NULL, "IDADENSE", "IDADenseGetNumResEvals", MSGD_LMEM_NULL);
00272     return(IDADENSE_LMEM_NULL);
00273   }
00274   idadense_mem = (IDADenseMem) lmem;
00275 
00276   *nrevalsLS = nreD;
00277 
00278   return(IDADENSE_SUCCESS);
00279 }

Here is the call graph for this function:

char* IDADenseGetReturnFlagName ( int  flag  ) 

Definition at line 304 of file ida_dense.c.

References IDADENSE_ILL_INPUT, IDADENSE_JACFUNC_RECVR, IDADENSE_JACFUNC_UNRECVR, IDADENSE_LMEM_NULL, IDADENSE_MEM_FAIL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, malloc(), and name.

00305 {
00306   char *name;
00307 
00308   name = (char *)malloc(30*sizeof(char));
00309 
00310   switch(flag) {
00311   case IDADENSE_SUCCESS:
00312     sprintf(name,"IDADENSE_SUCCESS");
00313     break;   
00314   case IDADENSE_MEM_NULL:
00315     sprintf(name,"IDADENSE_MEM_NULL");
00316     break;
00317   case IDADENSE_LMEM_NULL:
00318     sprintf(name,"IDADENSE_LMEM_NULL");
00319     break;
00320   case IDADENSE_ILL_INPUT:
00321     sprintf(name,"IDADENSE_ILL_INPUT");
00322     break;
00323   case IDADENSE_MEM_FAIL:
00324     sprintf(name,"IDADENSE_MEM_FAIL");
00325     break;
00326   case IDADENSE_JACFUNC_UNRECVR:
00327     sprintf(name,"IDADENSE_JACFUNC_UNRECVR");
00328     break;
00329   case IDADENSE_JACFUNC_RECVR:
00330     sprintf(name,"IDADENSE_JACFUNC_RECVR");
00331     break;
00332   default:
00333     sprintf(name,"NONE");
00334   }
00335 
00336   return(name);
00337 }

Here is the call graph for this function:

int IDADenseGetWorkSpace ( void *  ida_mem,
long int *  lenrwLS,
long int *  leniwLS 
)

Definition at line 211 of file ida_dense.c.

References IDADENSE_LMEM_NULL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDAProcessError(), lmem, MSGD_IDAMEM_NULL, MSGD_LMEM_NULL, neq, and NULL.

00212 {
00213   IDAMem IDA_mem;
00214   IDADenseMem idadense_mem;
00215 
00216   /* Return immediately if ida_mem is NULL */
00217   if (ida_mem == NULL) {
00218     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADenseGetWorkSpace", MSGD_IDAMEM_NULL);
00219     return(IDADENSE_MEM_NULL);
00220   }
00221   IDA_mem = (IDAMem) ida_mem;
00222 
00223   if (lmem == NULL) {
00224     IDAProcessError(IDA_mem, IDADENSE_LMEM_NULL, "IDADENSE", "IDADenseGetWorkSpace", MSGD_LMEM_NULL);
00225     return(IDADENSE_LMEM_NULL);
00226   }
00227   idadense_mem = (IDADenseMem) lmem;
00228 
00229   *lenrwLS = neq*neq;
00230   *leniwLS = neq;
00231  
00232   return(IDADENSE_SUCCESS);
00233 }

Here is the call graph for this function:

int IDADenseSetJacFn ( void *  ida_mem,
IDADenseJacFn  djac,
void *  jac_data 
)

Definition at line 187 of file ida_dense.c.

References IDADENSE_LMEM_NULL, IDADENSE_MEM_NULL, IDADENSE_SUCCESS, IDAProcessError(), jac, jacdata, lmem, MSGD_IDAMEM_NULL, MSGD_LMEM_NULL, and NULL.

Referenced by cossimdaskr().

00188 {
00189   IDAMem IDA_mem;
00190   IDADenseMem idadense_mem;
00191 
00192   /* Return immediately if ida_mem is NULL */
00193   if (ida_mem == NULL) {
00194     IDAProcessError(NULL, IDADENSE_MEM_NULL, "IDADENSE", "IDADenseSetJacFn", MSGD_IDAMEM_NULL);
00195     return(IDADENSE_MEM_NULL);
00196   }
00197   IDA_mem = (IDAMem) ida_mem;
00198 
00199   if (lmem == NULL) {
00200     IDAProcessError(IDA_mem, IDADENSE_LMEM_NULL, "IDADENSE", "IDADenseSetJacFn", MSGD_LMEM_NULL);
00201     return(IDADENSE_LMEM_NULL);
00202   }
00203   idadense_mem = (IDADenseMem) lmem;
00204 
00205   jac = djac;
00206   if (djac != NULL) jacdata = jac_data;
00207 
00208   return(IDADENSE_SUCCESS);
00209 }

Here is the call graph for this function:

Here is the caller graph for this function:


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