00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #if !defined(__PETSC_PACKAGE)
00032 #define __PETSC_PACKAGE
00033
00034
00035
00036
00037 #define PETSC_VERSION_NUMBER "PETSc Version 2.0.22, Released April 28, 1998."
00038
00039 #define PETSC_VERSION_MAJOR 2
00040 #define PETSC_VERSION_MINOR 0
00041 #define PETSC_VERSION_SUBMINOR 22
00042 #define PETSC_VERSION_DATE "April 29, 1998"
00043 #define PETSC_AUTHOR_INFO "The PETSc Team:\
00044 Satish Balay, Bill Gropp, Lois Curfman McInnes, Barry Smith\n\
00045 Bug reports, questions: petsc-maint@mcs.anl.gov\n\
00046 Web page: http://www.mcs.anl.gov/petsc/\n"
00047
00048
00049
00050
00051
00052
00053
00054
00055 #include <petscconf.h>
00056
00057
00058
00059
00060 #include <stdio.h>
00061
00062
00063
00064 #include "mpi.h"
00065
00066
00067
00068
00069 #include "petscmath.h"
00070
00071
00072
00073 #if defined(USE_POINTER_CONVERSION)
00074 #define PetscFortranAddr int
00075 #else
00076 #define PetscFortranAddr long
00077 #endif
00078
00079 extern MPI_Comm PETSC_COMM_WORLD;
00080 extern MPI_Comm PETSC_COMM_SELF;
00081 extern int PetscInitializedCalled;
00082 extern int PetscSetCommWorld(MPI_Comm);
00083
00084
00085
00086
00087 #define PetscMalloc(a) (*PetscTrMalloc)(a,__LINE__,__FUNC__,__FILE__,__SDIR__)
00088 #define PetscNew(A) (A*) PetscMalloc(sizeof(A))
00089 #define PetscFree(a) (*PetscTrFree)(a,__LINE__,__FUNC__,__FILE__,__SDIR__)
00090 extern void *(*PetscTrMalloc)(unsigned int,int,char*,char*,char*);
00091 extern int (*PetscTrFree)(void *,int,char*,char*,char*);
00092 extern int PetscSetMalloc(void *(*)(unsigned int,int,char*,char*,char*),
00093 int (*)(void *,int,char*,char*,char*));
00094 extern int PetscClearMalloc(void);
00095
00096 extern int PetscTrDump(FILE *);
00097 extern int PetscTrSpace( PLogDouble *, PLogDouble *,PLogDouble *);
00098 extern int PetscTrValid(int,char *,char *,char *);
00099 extern int PetscTrDebugLevel(int);
00100 extern int PetscTrLog(void);
00101 extern int PetscTrLogDump(FILE *);
00102 extern int PetscGetResidentSetSize(PLogDouble *);
00103
00104 #include <src/inline/bitarray.h>
00105
00106 typedef enum {PETSC_INT = 0, PETSC_DOUBLE = 1, PETSC_SHORT = 2, PETSC_FLOAT = 3,
00107 PETSC_COMPLEX = 4, PETSC_CHAR = 5, PETSC_LOGICAL = 6} PetscDataType;
00108 #if defined(USE_PETSC_COMPLEX)
00109 #define PETSC_SCALAR PETSC_COMPLEX
00110 #else
00111 #define PETSC_SCALAR PETSC_DOUBLE
00112 #endif
00113
00114 typedef enum {PETSC_INT_SIZE = sizeof(int), PETSC_DOUBLE_SIZE = sizeof(double),
00115 PETSC_SCALAR_SIZE = sizeof(Scalar), PETSC_COMPLEX_SIZE = sizeof(double),
00116 PETSC_CHAR_SIZE = sizeof(char), PETSC_LOGICAL_SIZE = 1} PetscDataTypeSize;
00117 extern int PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*);
00118 extern int PetscDataTypeGetSize(PetscDataType,int*);
00119 extern int PetscDataTypeGetName(PetscDataType,char**);
00120
00121
00122
00123
00124 extern int PetscMemcpy(void *,void *,int);
00125 extern int PetscBitMemcpy(void*,int,void*,int,int,PetscDataType);
00126 extern int PetscMemmove(void *,void *,int);
00127 extern int PetscMemzero(void *,int);
00128 extern int PetscMemcmp(void*, void*, int);
00129 extern int PetscStrlen(char *);
00130 extern int PetscStrcmp(char *,char *);
00131 extern int PetscStrcasecmp(char *,char *);
00132 extern int PetscStrncmp(char *,char *,int );
00133 extern int PetscStrcpy(char *,char *);
00134 extern int PetscStrcat(char *,char *);
00135 extern int PetscStrncat(char *,char *,int);
00136 extern int PetscStrncpy(char *,char *,int);
00137 extern char* PetscStrchr(char *,char);
00138 extern char* PetscStrrchr(char *,char);
00139 extern char* PetscStrstr(char*,char*);
00140 extern char* PetscStrtok(char*,char*);
00141 extern char* PetscStrrtok(char*,char*);
00142
00143
00144
00145
00146 typedef enum { PETSC_FALSE, PETSC_TRUE } PetscTruth;
00147 #define PETSC_NULL 0
00148 #define PETSC_DECIDE -1
00149 #define PETSC_DETERMINE PETSC_DECIDE
00150 #define PETSC_DEFAULT -2
00151
00152
00153
00154
00155
00156
00157
00158 #define PETSC_COOKIE 1211211
00159 #define LARGEST_PETSC_COOKIE_PREDEFINED PETSC_COOKIE + 30
00160 #define LARGEST_PETSC_COOKIE_ALLOWED PETSC_COOKIE + 50
00161 extern int LARGEST_PETSC_COOKIE;
00162
00163 #include "viewer.h"
00164 #include "options.h"
00165
00166
00167
00168
00169 #include "draw.h"
00170
00171 extern int PetscGetTime(PLogDouble*);
00172 extern int PetscGetCPUTime(PLogDouble*);
00173 extern int PetscSleep(int);
00174
00175 extern int PetscInitialize(int*,char***,char*,char*);
00176 extern int PetscInitializeNoArguments(void);
00177 extern int PetscFinalize(void);
00178 extern void PetscInitializeFortran(void);
00179
00180
00181
00182
00183 typedef struct _p_PetscObject* PetscObject;
00184 extern int PetscObjectDestroy(PetscObject);
00185 extern int PetscObjectExists(PetscObject,int*);
00186 extern int PetscObjectGetComm(PetscObject,MPI_Comm *comm);
00187 extern int PetscObjectGetCookie(PetscObject,int *cookie);
00188 extern int PetscObjectGetType(PetscObject,int *type);
00189 extern int PetscObjectSetName(PetscObject,char*);
00190 extern int PetscObjectGetName(PetscObject,char**);
00191 extern int PetscObjectReference(PetscObject);
00192 extern int PetscObjectGetReference(PetscObject,int*);
00193 extern int PetscObjectDereference(PetscObject);
00194 extern int PetscObjectGetNewTag(PetscObject,int *);
00195 extern int PetscObjectRestoreNewTag(PetscObject,int *);
00196 extern int PetscObjectView(PetscObject,Viewer);
00197
00198 extern int PetscObjectCompose(PetscObject,char *,PetscObject);
00199 extern int PetscObjectQuery(PetscObject,char *,PetscObject *);
00200 #if defined(USE_DYNAMIC_LIBRARIES)
00201 #define PetscObjectComposeFunction(a,b,c,d) PetscObjectComposeFunction_Private(a,b,c,0)
00202 #else
00203 #define PetscObjectComposeFunction(a,b,c,d) PetscObjectComposeFunction_Private(a,b,c,d)
00204 #endif
00205 extern int PetscObjectComposeFunction_Private(PetscObject,char *,char *,void *);
00206 extern int PetscObjectQueryFunction(PetscObject,char *,void **);
00207
00208
00209
00210
00211
00212 #include "petsopserror.h"
00213
00214
00215
00216
00217
00218 typedef struct _OList *OList;
00219 extern int OListDestroy(OList *);
00220 extern int OListFind(OList,char *,PetscObject*);
00221 extern int OListAdd(OList *,char *,PetscObject);
00222 extern int OListRemove(OList *,char *);
00223 extern int OListDuplicate(OList,OList *);
00224
00225
00226
00227
00228
00229 typedef struct _DLList *DLList;
00230 extern int DLRegister_Private(DLList*,char*,char*,int (*)(void *));
00231 extern int DLRegisterCreate(DLList *);
00232 extern int DLRegisterDestroy(DLList);
00233 extern int DLRegisterFind(MPI_Comm,DLList,char*,int (**)(void*));
00234 extern int DLRegisterPrintTypes(MPI_Comm,FILE*,char*,char *,DLList);
00235 #if defined(USE_DYNAMIC_LIBRARIES)
00236 #define DLRegister(a,b,p,c) DLRegister_Private(a,b,p,0)
00237 #else
00238 #define DLRegister(a,b,p,c) DLRegister_Private(a,b,p,(int (*)(void *))c)
00239 #endif
00240
00241 typedef struct _DLLibraryList *DLLibraryList;
00242 extern DLLibraryList DLLibrariesLoaded;
00243 extern int DLLibraryOpen(MPI_Comm,char *,void **);
00244 extern int DLLibrarySym(MPI_Comm,DLLibraryList *,char*,char *, void **);
00245 extern int DLLibraryAppend(MPI_Comm,DLLibraryList *,char *);
00246 extern int DLLibraryPrepend(MPI_Comm,DLLibraryList *,char *);
00247 extern int DLLibraryClose(DLLibraryList);
00248
00249
00250 #include "petschead.h"
00251
00252
00253
00254
00255 #include "petsclog.h"
00256
00257 extern int PetscSequentialPhaseBegin(MPI_Comm,int);
00258 extern int PetscSequentialPhaseEnd(MPI_Comm,int);
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277 #define PetscBarrier(A) \
00278 { \
00279 PetscValidHeader(A); \
00280 PLogEventBegin(Petsc_Barrier,A,0,0,0); \
00281 MPI_Barrier(((PetscObject)A)->comm); \
00282 PLogEventEnd(Petsc_Barrier,A,0,0,0); \
00283 }
00284
00285 extern int PetscMPIDump(FILE *);
00286
00287
00288
00289
00290
00291
00292 extern int PetscCObjectToFortranObject(void *,PetscFortranAddr *);
00293 extern int PetscFortranObjectToCObject(PetscFortranAddr,void *);
00294 extern int MPICCommToFortranComm(MPI_Comm,int *);
00295 extern int MPIFortranCommToCComm(int,MPI_Comm*);
00296
00297
00298
00299
00300 extern int PetscFixFilename(char*);
00301 extern FILE *PetscFOpen(MPI_Comm,char *,char *);
00302 extern int PetscFClose(MPI_Comm,FILE*);
00303 extern int PetscFPrintf(MPI_Comm,FILE*,char *,...);
00304 extern int PetscPrintf(MPI_Comm,char *,...);
00305 extern int (*PetscErrorPrintf)(char *,...);
00306 extern int (*PetscHelpPrintf)(MPI_Comm,char *,...);
00307
00308 extern int PetscSynchronizedPrintf(MPI_Comm,char *,...);
00309 extern int PetscSynchronizedFPrintf(MPI_Comm,FILE*,char *,...);
00310 extern int PetscSynchronizedFlush(MPI_Comm);
00311
00312
00313 typedef struct _p_PetscObjectContainer* PetscObjectContainer;
00314 extern int PetscObjectContainerGetPointer(PetscObjectContainer,void **);
00315 extern int PetscObjectContainerSetPointer(PetscObjectContainer,void *);
00316 extern int PetscObjectContainerDestroy(PetscObjectContainer);
00317 extern int PetscObjectContainerCreate(MPI_Comm comm,PetscObjectContainer *);
00318
00319
00320
00321
00322
00323
00324
00325
00326 #if defined(HAVE_RESTRICT) && !defined(__cplusplus)
00327 #define restrict _Restrict
00328 #else
00329 #define restrict
00330 #endif
00331
00332
00333
00334
00335 extern int PetscCompare;
00336 extern int PetscCompareDouble(double);
00337 extern int PetscCompareScalar(Scalar);
00338 extern int PetscCompareInt(int);
00339
00340
00341
00342
00343 extern int PetscGlobalRank,PetscGlobalSize;
00344 extern int PetscIntView(int,int*,Viewer);
00345 extern int PetscDoubleView(int,double *,Viewer);
00346
00347 #include <mat.h>
00348
00349 #endif