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) */ 35*a0a59b22SBarry Smith extern int PetscInitialize(int*,char***,char*,char*); 36*a0a59b22SBarry Smith extern int PetscFinalize(); 37*a0a59b22SBarry Smith 388ed539a5SBarry Smith extern int PetscDestroy(PetscObject); 398ed539a5SBarry Smith extern int PetscView(PetscObject,Viewer); 402eac72dbSBarry Smith 418ed539a5SBarry Smith extern int PetscError(int,char*,char*,int); 428ed539a5SBarry Smith extern int PetscPushErrorHandler(int (*handler)(int,char*,char*,int,void*),void* ); 438ed539a5SBarry Smith extern int PetscPopErrorHandler(); 448ed539a5SBarry Smith 458ed539a5SBarry Smith extern int PetscDefaultErrorHandler(int,char*,char*,int,void*); 468ed539a5SBarry Smith extern int PetscAbortErrorHandler(int,char*,char*,int,void* ); 478ed539a5SBarry Smith extern int PetscAttachDebuggerErrorHandler(int, char *,char *,int,void*); 488ed539a5SBarry Smith 498ed539a5SBarry Smith extern int PetscSetDebugger(char *,int,char *); 508ed539a5SBarry Smith extern int PetscAttachDebugger(); 518ed539a5SBarry Smith 52f97c0401SBarry Smith #include <signal.h> /* I don't like this, but? */ 53f97c0401SBarry Smith extern int PetscSetSignalHandler(void (*)(int,int,struct sigcontext *,char*)); 54f97c0401SBarry Smith 558ed539a5SBarry Smith extern void *trmalloc(unsigned int,int,char*); 568ed539a5SBarry Smith extern int trfree(void *,int,char*); 578ed539a5SBarry Smith 588ed539a5SBarry Smith 598ed539a5SBarry Smith #if defined(titan) || defined(cray) || defined(ncube) 608ed539a5SBarry Smith #define FORTRANCAPS 618ed539a5SBarry Smith #elif !defined(rs6000) && !defined(NeXT) && !defined(HPUX) 628ed539a5SBarry Smith #define FORTRANUNDERSCORE 632eac72dbSBarry Smith #endif 642eac72dbSBarry Smith 652eac72dbSBarry Smith #endif 66