xref: /petsc/include/petsc.h (revision f97c04019bd66f7fac0b5341bf50c86ab1e4ba0e)
12eac72dbSBarry Smith 
22eac72dbSBarry Smith #if !defined(__PETSC_PACKAGE)
32eac72dbSBarry Smith #define __PETSC_PACKAGE
42eac72dbSBarry Smith 
58ed539a5SBarry Smith #if PETSC_COMPLEX
68ed539a5SBarry Smith #include <complex.h>
78ed539a5SBarry Smith #define Scalar complex
88ed539a5SBarry Smith #else
98ed539a5SBarry Smith #define Scalar double
108ed539a5SBarry Smith #endif
118ed539a5SBarry Smith 
128ed539a5SBarry Smith 
132eac72dbSBarry Smith /*  Macros for getting and freeing memory */
148ed539a5SBarry Smith #if defined(PETSC_MALLOC)
158ed539a5SBarry Smith #define MALLOC(a)       trmalloc(a,__LINE__,__FILE__)
168ed539a5SBarry Smith #define FREE(a)         trfree(a,__LINE__,__FILE__)
178ed539a5SBarry Smith #else
182eac72dbSBarry Smith #define MALLOC(a)       malloc(a)
192eac72dbSBarry Smith #define FREE(a)         free(a)
208ed539a5SBarry Smith #endif
218ed539a5SBarry Smith #define NEW(a)          (a *) MALLOC(sizeof(a))
222eac72dbSBarry Smith #define MEMCPY(a,b,n)   memcpy((char*)(a),(char*)(b),n)
238ed539a5SBarry Smith #define MEMSET(a,b,n)   memset((char*)(a),(int)(b),n)
242eac72dbSBarry Smith 
252eac72dbSBarry Smith /*  Macros for error checking */
268ed539a5SBarry Smith #define SETERR(n,s)     {return PetscError(__LINE__,__FILE__,s,n);}
272eac72dbSBarry Smith #define CHKERR(n)       {if (n) SETERR(n,(char *)0);}
282eac72dbSBarry Smith #define CHKPTR(p)       if (!p) SETERR(1,"No memory");
292eac72dbSBarry Smith 
302eac72dbSBarry Smith 
318ed539a5SBarry Smith typedef struct _PetscObject* PetscObject;
328ed539a5SBarry Smith typedef struct _Viewer*      Viewer;
332eac72dbSBarry Smith 
348ed539a5SBarry Smith /* useful Petsc routines (used often) */
358ed539a5SBarry Smith extern int  PetscDestroy(PetscObject);
368ed539a5SBarry Smith extern int  PetscView(PetscObject,Viewer);
372eac72dbSBarry Smith 
388ed539a5SBarry Smith extern int  PetscError(int,char*,char*,int);
398ed539a5SBarry Smith extern int  PetscPushErrorHandler(int (*handler)(int,char*,char*,int,void*),void* );
408ed539a5SBarry Smith extern int  PetscPopErrorHandler();
418ed539a5SBarry Smith 
428ed539a5SBarry Smith extern int  PetscDefaultErrorHandler(int,char*,char*,int,void*);
438ed539a5SBarry Smith extern int  PetscAbortErrorHandler(int,char*,char*,int,void* );
448ed539a5SBarry Smith extern int  PetscAttachDebuggerErrorHandler(int, char *,char *,int,void*);
458ed539a5SBarry Smith 
468ed539a5SBarry Smith extern int  PetscSetDebugger(char *,int,char *);
478ed539a5SBarry Smith extern int  PetscAttachDebugger();
488ed539a5SBarry Smith 
49*f97c0401SBarry Smith #include <signal.h> /* I don't like this, but? */
50*f97c0401SBarry Smith extern int PetscSetSignalHandler(void (*)(int,int,struct sigcontext *,char*));
51*f97c0401SBarry Smith 
528ed539a5SBarry Smith extern void *trmalloc(unsigned int,int,char*);
538ed539a5SBarry Smith extern int  trfree(void *,int,char*);
548ed539a5SBarry Smith 
558ed539a5SBarry Smith 
568ed539a5SBarry Smith #if defined(titan) || defined(cray) || defined(ncube)
578ed539a5SBarry Smith #define FORTRANCAPS
588ed539a5SBarry Smith #elif !defined(rs6000) && !defined(NeXT) && !defined(HPUX)
598ed539a5SBarry Smith #define FORTRANUNDERSCORE
602eac72dbSBarry Smith #endif
612eac72dbSBarry Smith 
622eac72dbSBarry Smith #endif
63