1 2 #if !defined(__PETSC_PACKAGE) 3 #define __PETSC_PACKAGE 4 5 #include <stdio.h> 6 7 /* MPI interface */ 8 #include "mpi.h" 9 #include "mpe.h" 10 #if defined(PETSC_COMPLEX) 11 #define MPI_SCALAR MPIR_dcomplex_dte 12 #else 13 #define MPI_SCALAR MPI_DOUBLE 14 #endif 15 FILE *MPE_fopen(MPI_Comm,char *,char *); 16 int MPE_fclose(MPI_Comm,FILE*); 17 int MPE_fprintf(MPI_Comm,FILE*,char *,...); 18 int MPE_printf(MPI_Comm,char *,...); 19 20 21 #if defined(PETSC_COMPLEX) 22 /* work around for bug in alpha g++ compiler */ 23 #if defined(PARCH_alpha) 24 #define hypot(a,b) (double) sqrt((a)*(a)+(b)*(b)) 25 /* extern double hypot(double,double); */ 26 #endif 27 #include <complex.h> 28 #define PETSCREAL(a) real(a) 29 #define Scalar complex 30 #else 31 #define PETSCREAL(a) a 32 #define Scalar double 33 #endif 34 35 36 /* Macros for getting and freeing memory */ 37 #if defined(PETSC_MALLOC) 38 #define MALLOC(a) trmalloc(a,__LINE__,__FILE__) 39 #define FREE(a) trfree(a,__LINE__,__FILE__) 40 #else 41 #define MALLOC(a) malloc(a) 42 #define FREE(a) free(a) 43 #endif 44 #define NEW(a) (a *) MALLOC(sizeof(a)) 45 #define MEMCPY(a,b,n) memcpy((char*)(a),(char*)(b),n) 46 #define MEMSET(a,b,n) memset((char*)(a),(int)(b),n) 47 #include <memory.h> 48 49 /* Macros for error checking */ 50 #if !defined(__DIR__) 51 #define __DIR__ 0 52 #endif 53 #define SETERR(n,s) {return PetscError(__LINE__,__DIR__,__FILE__,s,n);} 54 #define CHKERR(n) {if (n) SETERR(n,(char *)0);} 55 #define CHKPTR(p) if (!p) SETERR(1,"No memory"); 56 57 58 typedef struct _PetscObject* PetscObject; 59 typedef struct _Viewer* Viewer; 60 61 /* useful Petsc routines (used often) */ 62 extern int PetscInitialize(int*,char***,char*,char*); 63 extern int PetscFinalize(); 64 65 extern int PetscDestroy(PetscObject); 66 extern int PetscView(PetscObject,Viewer); 67 68 extern int PetscDefaultErrorHandler(int,char*,char*,char*,int,void*); 69 extern int PetscAbortErrorHandler(int,char*,char*,char*,int,void* ); 70 extern int PetscAttachDebuggerErrorHandler(int,char*,char*,char*,int,void*); 71 extern int PetscError(int,char*,char*,char*,int); 72 extern int PetscPushErrorHandler(int 73 (*handler)(int,char*,char*,char*,int,void*),void* ); 74 extern int PetscPopErrorHandler(); 75 76 extern int PetscSetDebugger(char *,int,char *); 77 extern int PetscAttachDebugger(); 78 79 extern int PetscDefaultSignalHandler(int,void*); 80 extern int PetscPushSignalHandler(int (*)(int,void *),void*); 81 extern int PetscPopSignalHandler(); 82 extern int PetscSetFPTrap(int); 83 84 extern void *trmalloc(unsigned int,int,char*); 85 extern int trfree(void *,int,char*); 86 #include <stdio.h> /* I don't like this, but? */ 87 extern int trdump(FILE *); 88 89 #if defined(PARCH_cray) || defined(PARCH_NCUBE) 90 #define FORTRANCAPS 91 #elif !defined(PARCH_rs6000) && !defined(PACRH_NeXT) && !defined(PACRH_HPUX) 92 #define FORTRANUNDERSCORE 93 #endif 94 95 #endif 96