Actual source code: petsc.h

  1: /* $Id: petsc.h,v 1.297 2001/09/07 20:13:16 bsmith Exp $ */
  2: /*
  3:    This is the main PETSc include file (for C and C++).  It is included by all
  4:    other PETSc include files, so it almost never has to be specifically included.
  5: */

  9: /* ========================================================================== */
 10: /* 
 11:    Current PETSc version number and release date
 12: */
 13:  #include petscversion.h

 15: /* ========================================================================== */
 16: /* 
 17:    petscconf.h is contained in bmake/${PETSC_ARCH}/petscconf.h it is 
 18:    found automatically by the compiler due to the -I${PETSC_DIR}/bmake/${PETSC_ARCH}
 19:    in the bmake/common_variables definition of PETSC_INCLUDE
 20: */
 21: #include "petscconf.h"
 22: /*
 23:    Fixes for configure time choices which impact our interface. Currently only
 24:    calling conventions and extra compiler checking falls under this category.
 25: */
 26: #if !defined(PETSC_PRINTF_FORMAT_CHECK)
 27: #define PETSC_PRINTF_FORMAT_CHECK(a,b)
 28: #endif
 29: #if !defined (PETSC_STDCALL)
 30: #define PETSC_STDCALL
 31: #endif
 32: #if !defined (PETSC_TEMPLATE)
 33: #define PETSC_TEMPLATE
 34: #endif

 36: /* ========================================================================== */

 38: #include <stdio.h>
 39: /*
 40:     Defines the interface to MPI allowing the use of all MPI functions.
 41: */
 42: #include "mpi.h"

 44: /*
 45:     EXTERN indicates a PETSc function defined elsewhere
 46: */
 47: #if !defined(EXTERN)
 48: #define EXTERN extern
 49: #endif

 51: /*
 52:     Defines some elementary mathematics functions and constants.
 53: */
 54:  #include petscmath.h

 56: /*
 57:        Basic PETSc constants
 58: */

 60: /*E
 61:     PetscTruth - Logical variable. Actually an integer

 63:    Level: beginner

 65: E*/
 66: typedef enum { PETSC_FALSE,PETSC_TRUE } PetscTruth;

 68: #define PETSC_NULL           0
 69: #define PETSC_DECIDE         -1
 70: #define PETSC_DEFAULT        -2

 72: #define PETSC_YES            PETSC_TRUE
 73: #define PETSC_NO             PETSC_FALSE
 74: #define PETSC_IGNORE         PETSC_NULL
 75: #define PETSC_DETERMINE      PETSC_DECIDE


 78: extern MPI_Comm   PETSC_COMM_WORLD;
 79: extern MPI_Comm   PETSC_COMM_SELF;
 80: extern PetscTruth PetscInitializeCalled;
 81: EXTERN int        PetscSetCommWorld(MPI_Comm);
 82: EXTERN int        PetscSetHelpVersionFunctions(int (*)(MPI_Comm),int (*)(MPI_Comm));

 84: /*MC
 85:    PetscMalloc - Allocates memory

 87:    Input Parameter:
 88: .  m - number of bytes to allocate

 90:    Output Parameter:
 91: .  result - memory allocated

 93:    Synopsis:
 94:    int PetscMalloc(size_t m,void **result)

 96:    Level: beginner

 98:    Notes: Memory is always allocated at least double aligned

100: .seealso: PetscFree(), PetscNew()

102:   Concepts: memory allocation

104: M*/
105: #define PetscMalloc(a,b)     (*PetscTrMalloc)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__,(void**)(b))
106: /*MC
107:    PetscNew - Allocates memory of a particular type

109:    Input Parameter:
110: . type - structure name of space to be allocated. Memory of size sizeof(type) is allocated

112:    Output Parameter:
113: .  result - memory allocated

115:    Synopsis:
116:    int PetscNew(struct type,((type *))result)

118:    Level: beginner

120: .seealso: PetscFree(), PetscMalloc()

122:   Concepts: memory allocation

124: M*/
125: #define PetscNew(A,b)        PetscMalloc(sizeof(A),(b))
126: /*MC
127:    PetscFree - Frees memory

129:    Input Parameter:
130: .   memory - memory to free

132:    Synopsis:
133:    int PetscFree(void *memory)

135:    Level: beginner

137:    Notes: Memory must have been obtained with PetscNew() or PetscMalloc()

139: .seealso: PetscNew(), PetscMalloc()

141:   Concepts: memory allocation

143: M*/
144: #define PetscFree(a)         (*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__)
145: EXTERN int  (*PetscTrMalloc)(size_t,int,char*,char*,char*,void**);
146: EXTERN int  (*PetscTrFree)(void *,int,char*,char*,char*);
147: EXTERN int  PetscSetMalloc(int (*)(size_t,int,char*,char*,char*,void**),int (*)(void *,int,char*,char*,char*));
148: EXTERN int  PetscClearMalloc(void);

150: /*
151:    Routines for tracing memory corruption/bleeding with default PETSc 
152:    memory allocation
153: */
154: EXTERN int   PetscTrDump(FILE *);
155: EXTERN int   PetscTrSpace(PetscLogDouble *,PetscLogDouble *,PetscLogDouble *);
156: EXTERN int   PetscTrValid(int,const char[],const char[],const char[]);
157: EXTERN int   PetscTrDebugLevel(int);
158: EXTERN int   PetscTrLog(void);
159: EXTERN int   PetscTrLogDump(FILE *);
160: EXTERN int   PetscGetResidentSetSize(PetscLogDouble *);

162: /*
163:     Variable type where we stash PETSc object pointers in Fortran.
164:     Assumes that sizeof(long) == sizeof(void*)which is true on 
165:     all machines that we know.
166: */
167: #define PetscFortranAddr   long

169: /*E
170:     PetscDataType - Used for handling different basic data types.

172:    Level: beginner

174: .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(),
175:           PetscDataTypeGetSize(), PetscDataTypeGetName()

177: E*/
178: typedef enum {PETSC_INT = 0,PETSC_DOUBLE = 1,PETSC_COMPLEX = 2,
179:               PETSC_LONG =3 ,PETSC_SHORT = 4,PETSC_FLOAT = 5,
180:               PETSC_CHAR = 6,PETSC_LOGICAL = 7} PetscDataType;
181: #if defined(PETSC_USE_COMPLEX)
182: #define PETSC_SCALAR PETSC_COMPLEX
183: #else
184: #if defined(PETSC_USE_SINGLE)
185: #define PETSC_SCALAR PETSC_FLOAT
186: #else
187: #define PETSC_SCALAR PETSC_DOUBLE
188: #endif
189: #endif
190: #if defined(PETSC_USE_SINGLE)
191: #define PETSC_REAL PETSC_FLOAT
192: #else
193: #define PETSC_REAL PETSC_DOUBLE
194: #endif
195: #define PETSC_FORTRANADDR PETSC_LONG

197: EXTERN int PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*);
198: EXTERN int PetscDataTypeGetSize(PetscDataType,int*);
199: EXTERN int PetscDataTypeGetName(PetscDataType,char*[]);

201: /*
202:     Basic memory and string operations. These are usually simple wrappers
203:    around the basic Unix system calls, but a few of them have additional
204:    functionality and/or error checking.
205: */
206: EXTERN int   PetscMemcpy(void *,const void *,int);
207: EXTERN int   PetscBitMemcpy(void*,int,const void*,int,int,PetscDataType);
208: EXTERN int   PetscMemmove(void *,void *,int);
209: EXTERN int   PetscMemzero(void *,int);
210: EXTERN int   PetscMemcmp(const void*,const void*,int,PetscTruth *);
211: EXTERN int   PetscStrlen(const char[],int*);
212: EXTERN int   PetscStrcmp(const char[],const char[],PetscTruth *);
213: EXTERN int   PetscStrgrt(const char[],const char[],PetscTruth *);
214: EXTERN int   PetscStrcasecmp(const char[],const char[],PetscTruth*);
215: EXTERN int   PetscStrncmp(const char[],const char[],int,PetscTruth*);
216: EXTERN int   PetscStrcpy(char[],const char[]);
217: EXTERN int   PetscStrcat(char[],const char[]);
218: EXTERN int   PetscStrncat(char[],const char[],int);
219: EXTERN int   PetscStrncpy(char[],const char[],int);
220: EXTERN int   PetscStrchr(const char[],char,char **);
221: EXTERN int   PetscStrtolower(char[]);
222: EXTERN int   PetscStrrchr(const char[],char,char **);
223: EXTERN int   PetscStrstr(const char[],const char[],char **);
224: EXTERN int   PetscStrallocpy(const char[],char **);
225: EXTERN int   PetscStrreplace(MPI_Comm,const char[],char*,int);
226: #define      PetscStrfree(a) ((a) ? PetscFree(a) : 0) 
227: typedef struct {char token;char *array;char *current;} PetscToken;
228: EXTERN int   PetscTokenCreate(const char[],const char,PetscToken**);
229: EXTERN int   PetscTokenFind(PetscToken*,char **);
230: EXTERN int   PetscTokenDestroy(PetscToken*);

232: /*
233:    These are  MPI operations for MPI_Allreduce() etc
234: */
235: EXTERN MPI_Op PetscMaxSum_Op;
236: #if defined(PETSC_USE_COMPLEX)
237: EXTERN MPI_Op PetscSum_Op;
238: #else
239: #define PetscSum_Op MPI_SUM
240: #endif
241: EXTERN int PetscMaxSum(MPI_Comm,const int[],int*,int*);

243: /*S
244:      PetscObject - any PETSc object, PetscViewer, Mat, Vec, SLES etc

246:    Level: beginner

248: .seealso:  PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName()
249: S*/
250: typedef struct _p_PetscObject* PetscObject;

252: /*S
253:      PetscFList - Linked list of functions, possibly stored in dynamic libraries, accessed
254:       by string name

256:    Level: advanced

258: .seealso:  PetscFListAdd(), PetscFListDestroy()
259: S*/
260: typedef struct _PetscFList *PetscFList;

262:  #include petscviewer.h
263:  #include petscoptions.h

265: EXTERN int PetscShowMemoryUsage(PetscViewer,char*);
266: EXTERN int PetscGetTime(PetscLogDouble*);
267: EXTERN int PetscGetCPUTime(PetscLogDouble*);
268: EXTERN int PetscSleep(int);

270: /*
271:     Initialization of PETSc
272: */
273: EXTERN int  PetscInitialize(int*,char***,char[],const char[]);
274: EXTERN int  PetscInitializeNoArguments(void);
275: EXTERN int  PetscFinalize(void);
276: EXTERN int  PetscInitializeFortran(void);
277: EXTERN int  PetscGetArgs(int*,char ***);
278: EXTERN int  PetscEnd(void);

280: /*
281:    ParameterDict is an abstraction for arguments to interface mechanisms
282: */
283: extern int DICT_COOKIE;
284: typedef struct _p_Dict *ParameterDict;

286: typedef void (**PetscVoidFunction)(void);

288: /*
289:    PetscTryMethod - Queries an object for a method, if it exists then calls it.
290:           Can support argument checking 
291: */
292: #if defined(PETSC_FORTRAN_STUBS)
293: #define  PetscTryMethod(obj,A,B,C) 
294:   0;{ int (*f)B; 
295:    *PetscObjectQueryFunction((PetscObject)obj,#A,(PetscVoidFunction)&f);if (*ierr) return; 
296:     if (f) {*(*f)C;if (*ierr) return;}
297:   }
298: #else
299: #define  PetscTryMethod(obj,A,B,C) 
300:   0;{ int (*f)B, __ierr; 
301:     __PetscObjectQueryFunction((PetscObject)obj,#A,(PetscVoidFunction)&f);CHKERRQ(__ierr); 
302:     if (f) {__(*f)C;CHKERRQ(__ierr);}
303:   }
304: #endif

306: /*
307:     Functions that can act on any PETSc object.
308: */
309: EXTERN int PetscObjectDestroy(PetscObject);
310: EXTERN int PetscObjectExists(PetscObject,PetscTruth*);
311: EXTERN int PetscObjectGetComm(PetscObject,MPI_Comm *);
312: EXTERN int PetscObjectGetCookie(PetscObject,int *);
313: EXTERN int PetscObjectGetType(PetscObject,int *);
314: EXTERN int PetscObjectSetName(PetscObject,const char[]);
315: EXTERN int PetscObjectGetName(PetscObject,char*[]);
316: EXTERN int PetscObjectReference(PetscObject);
317: EXTERN int PetscObjectGetReference(PetscObject,int*);
318: EXTERN int PetscObjectDereference(PetscObject);
319: EXTERN int PetscObjectGetNewTag(PetscObject,int *);
320: EXTERN int PetscObjectSetParameterDict(PetscObject,ParameterDict);
321: EXTERN int PetscObjectGetParameterDict(PetscObject,ParameterDict*);
322: EXTERN int PetscCommGetNewTag(MPI_Comm,int *);
323: EXTERN int PetscObjectView(PetscObject,PetscViewer);
324: EXTERN int PetscObjectCompose(PetscObject,const char[],PetscObject);
325: EXTERN int PetscObjectQuery(PetscObject,const char[],PetscObject *);
326: EXTERN int PetscObjectComposeFunction(PetscObject,const char[],const char[],void (*)(void));
327: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
328: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,0)
329: #else
330: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,(void (*)(void))(d))
331: #endif
332: EXTERN int PetscObjectQueryFunction(PetscObject,const char[],void (**)(void));
333: EXTERN int PetscObjectSetOptionsPrefix(PetscObject,const char[]);
334: EXTERN int PetscObjectAppendOptionsPrefix(PetscObject,const char[]);
335: EXTERN int PetscObjectPrependOptionsPrefix(PetscObject,const char[]);
336: EXTERN int PetscObjectGetOptionsPrefix(PetscObject,char*[]);
337: EXTERN int PetscObjectPublish(PetscObject);
338: EXTERN int PetscObjectChangeTypeName(PetscObject,char *);
339: EXTERN int PetscObjectChangeSerializeName(PetscObject,char *);
340: EXTERN int PetscObjectRegisterDestroy(PetscObject);
341: EXTERN int PetscObjectRegisterDestroyAll(void);
342: EXTERN int PetscObjectName(PetscObject);
343: EXTERN int PetscTypeCompare(PetscObject,char*,PetscTruth*);
344: EXTERN int PetscSerializeCompare(PetscObject,char*,PetscTruth*);

346: /*
347:     Defines PETSc error handling.
348: */
349:  #include petscerror.h

351: /*S
352:      PetscOList - Linked list of PETSc objects, accessable by string name

354:    Level: advanced

356: .seealso:  PetscOListAdd(), PetscOListDestroy(), PetscOListFind()
357: S*/
358: typedef struct _PetscOList *PetscOList;

360: EXTERN int PetscOListDestroy(PetscOList *);
361: EXTERN int PetscOListFind(PetscOList,const char[],PetscObject*);
362: EXTERN int PetscOListReverseFind(PetscOList,PetscObject,char**);
363: EXTERN int PetscOListAdd(PetscOList *,const char[],PetscObject);
364: EXTERN int PetscOListDuplicate(PetscOList,PetscOList *);

366: /*
367:     Dynamic library lists. Lists of names of routines in dynamic 
368:   link libraries that will be loaded as needed.
369: */
370: EXTERN int PetscFListAdd(PetscFList*,const char[],const char[],void (*)(void));
371: EXTERN int PetscFListDestroy(PetscFList*);
372: EXTERN int PetscFListFind(MPI_Comm,PetscFList,const char[],void (**)(void));
373: EXTERN int PetscFListPrintTypes(MPI_Comm,FILE*,const char[],const char[],char *,char *,PetscFList);
374: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
375: #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,0)
376: #else
377: #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,(void (*)(void))c)
378: #endif
379: EXTERN int PetscFListDuplicate(PetscFList,PetscFList *);
380: EXTERN int PetscFListView(PetscFList,PetscViewer);
381: EXTERN int PetscFListConcat(const char [],const char [],char []);
382: EXTERN int PetscFListGet(PetscFList,char ***,int*);

384: /*S
385:      PetscDLLibraryList - Linked list of dynamics libraries to search for functions

387:    Level: advanced

389:    PETSC_USE_DYNAMIC_LIBRARIES must be defined in petscconf.h to use dynamic libraries

391: .seealso:  PetscDLLibraryOpen()
392: S*/
393: typedef struct _PetscDLLibraryList *PetscDLLibraryList;
394: extern PetscDLLibraryList DLLibrariesLoaded;
395: EXTERN int PetscDLLibraryRetrieve(MPI_Comm,const char[],char *,int,PetscTruth *);
396: EXTERN int PetscDLLibraryOpen(MPI_Comm,const char[],void **);
397: EXTERN int PetscDLLibrarySym(MPI_Comm,PetscDLLibraryList *,const char[],const char[],void **);
398: EXTERN int PetscDLLibraryAppend(MPI_Comm,PetscDLLibraryList *,const char[]);
399: EXTERN int PetscDLLibraryPrepend(MPI_Comm,PetscDLLibraryList *,const char[]);
400: EXTERN int PetscDLLibraryClose(PetscDLLibraryList);
401: EXTERN int PetscDLLibraryPrintPath(void);
402: EXTERN int PetscDLLibraryGetInfo(void *,char *,char **);

404: /*
405:     Mechanism for translating PETSc object representations between languages
406:     Not currently used.
407: */
408: typedef enum {PETSC_LANGUAGE_C,PETSC_LANGUAGE_CPP} PetscLanguage;
409: #define PETSC_LANGUAGE_F77 PETSC_LANGUAGE_C
410: EXTERN int PetscObjectComposeLanguage(PetscObject,PetscLanguage,void *);
411: EXTERN int PetscObjectQueryLanguage(PetscObject,PetscLanguage,void **);

413: /*
414:      Useful utility routines
415: */
416: EXTERN int PetscSplitOwnership(MPI_Comm,int*,int*);
417: EXTERN int PetscSplitOwnershipBlock(MPI_Comm,int,int*,int*);
418: EXTERN int PetscSequentialPhaseBegin(MPI_Comm,int);
419: EXTERN int PetscSequentialPhaseEnd(MPI_Comm,int);
420: EXTERN int PetscBarrier(PetscObject);
421: EXTERN int PetscMPIDump(FILE*);

423: #define PetscNot(a) ((a) ? PETSC_FALSE : PETSC_TRUE)
424: /*
425:     Defines basic graphics available from PETSc.
426: */
427:  #include petscdraw.h

429: /*
430:     Defines the base data structures for all PETSc objects
431: */
432:  #include petschead.h

434: /*
435:      Defines PETSc profiling.
436: */
437:  #include petsclog.h

439: /*
440:           For locking, unlocking and destroying AMS memories associated with 
441:     PETSc objects
442: */
443: #if defined(PETSC_HAVE_AMS)

445: extern PetscTruth PetscAMSPublishAll;
446: #define PetscPublishAll(v) (PetscAMSPublishAll ? PetscObjectPublish((PetscObject)v) : 0)
447: #define PetscObjectTakeAccess(obj)  ((((PetscObject)(obj))->amem == -1) ? 0 : AMS_Memory_take_access(((PetscObject)(obj))->amem))
448: #define PetscObjectGrantAccess(obj) ((((PetscObject)(obj))->amem == -1) ? 0 : AMS_Memory_grant_access(((PetscObject)(obj))->amem))
449: #define PetscObjectDepublish(obj)   ((((PetscObject)(obj))->amem == -1) ? 0 : AMS_Memory_destroy(((PetscObject)(obj))->amem)); 
450:     ((PetscObject)(obj))->amem = -1;

452: #else

454: #define PetscPublishAll(v)           0
455: #define PetscObjectTakeAccess(obj)   0
456: #define PetscObjectGrantAccess(obj)  0
457: #define PetscObjectDepublish(obj)      0

459: #endif



463: /*
464:       This code allows one to pass a MPI communicator between 
465:     C and Fortran. MPI 2.0 defines a standard API for doing this.
466:     The code here is provided to allow PETSc to work with MPI 1.1
467:     standard MPI libraries.
468: */
469: EXTERN int  MPICCommToFortranComm(MPI_Comm,int *);
470: EXTERN int  MPIFortranCommToCComm(int,MPI_Comm*);

472: /*
473:       Simple PETSc parallel IO for ASCII printing
474: */
475: EXTERN int  PetscFixFilename(const char[],char[]);
476: EXTERN int  PetscFOpen(MPI_Comm,const char[],const char[],FILE**);
477: EXTERN int  PetscFClose(MPI_Comm,FILE*);
478: EXTERN int  PetscFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
479: EXTERN int  PetscPrintf(MPI_Comm,const char[],...)  PETSC_PRINTF_FORMAT_CHECK(2,3);
480: EXTERN int  (*PetscErrorPrintf)(const char[],...);
481: EXTERN int  (*PetscHelpPrintf)(MPI_Comm,const char[],...);
482: EXTERN int  PetscPOpen(MPI_Comm,char *,char*,const char[],FILE **);
483: EXTERN int  PetscPClose(MPI_Comm,FILE*);
484: EXTERN int  PetscSynchronizedPrintf(MPI_Comm,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
485: EXTERN int  PetscSynchronizedFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
486: EXTERN int  PetscSynchronizedFlush(MPI_Comm);
487: EXTERN int  PetscSynchronizedFGets(MPI_Comm,FILE*,int,char[]);
488: EXTERN int  PetscStartMatlab(MPI_Comm,char *,char*,FILE**);
489: EXTERN int  PetscStartJava(MPI_Comm,char *,char*,FILE**);
490: EXTERN int  PetscGetPetscDir(char**);

492: EXTERN int  PetscPopUpSelect(MPI_Comm,char*,char*,int,char**,int*);
493: /*S
494:      PetscObjectContainer - Simple PETSc object that contains a pointer to any required data

496:    Level: advanced

498: .seealso:  PetscObject, PetscObjectContainerCreate()
499: S*/
500: typedef struct _p_PetscObjectContainer*  PetscObjectContainer;
501: EXTERN int PetscObjectContainerGetPointer(PetscObjectContainer,void **);
502: EXTERN int PetscObjectContainerSetPointer(PetscObjectContainer,void *);
503: EXTERN int PetscObjectContainerDestroy(PetscObjectContainer);
504: EXTERN int PetscObjectContainerCreate(MPI_Comm comm,PetscObjectContainer *);

506: /*
507:    For incremental debugging
508: */
509: extern PetscTruth PetscCompare;
510: EXTERN int        PetscCompareDouble(double);
511: EXTERN int        PetscCompareScalar(PetscScalar);
512: EXTERN int        PetscCompareInt(int);

514: /*
515:    For use in debuggers 
516: */
517: extern int PetscGlobalRank,PetscGlobalSize;
518: EXTERN int PetscIntView(int,int[],PetscViewer);
519: EXTERN int PetscRealView(int,PetscReal[],PetscViewer);
520: EXTERN int PetscScalarView(int,PetscScalar[],PetscViewer);

522: /*
523:     Allows accessing Matlab Engine
524: */
525:  #include petscengine.h

527: /*
528:     C code optimization is often enhanced by telling the compiler 
529:   that certain pointer arguments to functions are not aliased to 
530:   to other arguments. This is not yet ANSI C standard so we define 
531:   the macro "restrict" to indicate that the variable is not aliased 
532:   to any other argument.
533: */
534: #if defined(PETSC_HAVE_RESTRICT) && !defined(__cplusplus)
535: #define restrict _Restrict
536: #else
537: #if defined(restrict)
538: #undef restrict
539: #endif
540: #define restrict
541: #endif

543: /*
544:       Determine if some of the kernel computation routines use
545:    Fortran (rather than C) for the numerical calculations. On some machines
546:    and compilers (like complex numbers) the Fortran version of the routines
547:    is faster than the C/C++ versions. The flag PETSC_USE_FORTRAN_KERNELS  
548:    would be set in the petscconf.h file
549: */
550: #if defined(PETSC_USE_FORTRAN_KERNELS)

552: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
553: #define PETSC_USE_FORTRAN_KERNEL_MULTAIJ
554: #endif

556: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
557: #define PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ
558: #endif

560: #if !defined(PETSC_USE_FORTRAN_KERNEL_NORM)
561: #define PETSC_USE_FORTRAN_KERNEL_NORM
562: #endif

564: #if !defined(PETSC_USE_FORTRAN_KERNEL_MAXPY)
565: #define PETSC_USE_FORTRAN_KERNEL_MAXPY
566: #endif

568: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ)
569: #define PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ
570: #endif

572: #if !defined(PETSC_USE_FORTRAN_KERNEL_RELAXAIJ)
573: #define PETSC_USE_FORTRAN_KERNEL_RELAXAIJ
574: #endif

576: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ)
577: #define PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ
578: #endif

580: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
581: #define PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ
582: #endif

584: #if !defined(PETSC_USE_FORTRAN_KERNEL_MDOT)
585: #define PETSC_USE_FORTRAN_KERNEL_MDOT
586: #endif

588: #if !defined(PETSC_USE_FORTRAN_KERNEL_XTIMESY)
589: #define PETSC_USE_FORTRAN_KERNEL_XTIMESY
590: #endif

592: #if !defined(PETSC_USE_FORTRAN_KERNEL_AYPX)
593: #define PETSC_USE_FORTRAN_KERNEL_AYPX
594: #endif

596: #if !defined(PETSC_USE_FORTRAN_KERNEL_WAXPY)
597: #define PETSC_USE_FORTRAN_KERNEL_WAXPY
598: #endif

600: #endif

602: /*
603:     Macros for indicating code that should be compiled with a C interface,
604:    rather than a C++ interface. Any routines that are dynamically loaded
605:    (such as the PCCreate_XXX() routines) must be wrapped so that the name
606:    mangler does not change the functions symbol name. This just hides the 
607:    ugly extern "C" {} wrappers.
608: */
609: #if defined(__cplusplus)
610: #define EXTERN_C_BEGIN extern "C" {
611: #define EXTERN_C_END }
612: #else
613: #define EXTERN_C_BEGIN 
614: #define EXTERN_C_END 
615: #endif

617: /* --------------------------------------------------------------------*/

619: /*M
620:     size - integer variable used to contain the number of processors in
621:            the relevent MPI_Comm

623:    Level: beginner

625: .seealso: rank, comm
626: M*/

628: /*M
629:     rank - integer variable used to contain the number of this processor relative
630:            to all in the relevent MPI_Comm

632:    Level: beginner

634: .seealso: size, comm
635: M*/

637: /*M
638:     comm - MPI_Comm used in the current routine or object

640:    Level: beginner

642: .seealso: size, rank
643: M*/

645: /*M
646:     PetscScalar - PETSc type that represents either a double precision real number or 
647:        a double precision complex number if the code is compiled with BOPT=g_complex or O_complex

649:    Level: beginner

651: M*/

653: /*
654:      The IBM include files define hz, here we hide it so that it may be used
655:    as a regular user variable.
656: */
657: #if defined(hz)
658: #undef hz
659: #endif

661: /*  For arrays that contain filenames or paths */

663: #if defined(PETSC_HAVE_LIMITS_H)
664: #include <limits.h>
665: #endif
666: #if defined(PETSC_HAVE_SYS_PARAM_H)
667: #include <sys/param.h>
668: #endif

670: #if defined(MAXPATHLEN)
671: #  define PETSC_MAX_PATH_LEN     MAXPATHLEN
672: #elif defined(MAX_PATH)
673: #  define PETSC_MAX_PATH_LEN     MAX_PATH
674: #elif defined(_MAX_PATH)
675: #  define PETSC_MAX_PATH_LEN     _MAX_PATH
676: #else
677: #  define PETSC_MAX_PATH_LEN     4096
678: #endif

680: #endif