Actual source code: petsc.h

  1: /*
  2:    This is the main PETSc include file (for C and C++).  It is included by all
  3:    other PETSc include files, so it almost never has to be specifically included.
  4: */
  7: /* ========================================================================== */
  8: /* 
  9:    petscconf.h is contained in bmake/${PETSC_ARCH}/petscconf.h it is 
 10:    found automatically by the compiler due to the -I${PETSC_DIR}/bmake/${PETSC_ARCH}
 11:    in the bmake/common/variables definition of PETSC_INCLUDE
 12: */
 13: #include "petscconf.h"

 15: /* ========================================================================== */
 16: /* 
 17:    This facilitates using C version of PETSc from C++ and 
 18:    C++ version from C. Use --with-c-support --with-clanguage=c++ with config/configure.py for the latter)
 19: */
 21: #error "PETSc configured with --with-clanguage=c++ and NOT --with-c-support - it can be used only with a C++ compiler"
 22: #endif      

 27: #else
 30: #endif
 31: /* ========================================================================== */
 32: /* 
 33:    Current PETSc version number and release date. Also listed in
 34:     Web page
 35:     src/docs/tex/manual/intro.tex,
 36:     src/docs/tex/manual/manual.tex.
 37:     src/docs/website/index.html.
 38: */
 39:  #include petscversion.h
 40: #define PETSC_AUTHOR_INFO        "\
 41:        The PETSc Team\n\
 42:     petsc-maint@mcs.anl.gov\n\
 43:  http://www.mcs.anl.gov/petsc/\n"
 44: #if (PETSC_VERSION_RELEASE == 1)
 45: #define PetscGetVersion(version,len) (PetscSNPrintf(*(version),len,"Petsc Release Version %d.%d.%d, Patch %d, ", \
 46:                                          PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, \
 47:                                          PETSC_VERSION_PATCH),PetscStrcat(*(version),PETSC_VERSION_PATCH_DATE), \
 48:                                          PetscStrcat(*(version)," HG revision: "),PetscStrcat(*(version),PETSC_VERSION_HG),0)
 49: #else
 50: #define PetscGetVersion(version,len) (PetscSNPrintf(*(version),len,"Petsc Development Version %d.%d.%d, Patch %d, ", \
 51:                                          PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, \
 52:                                          PETSC_VERSION_PATCH),PetscStrcat(*(version),PETSC_VERSION_PATCH_DATE), \
 53:                                          PetscStrcat(*(version)," HG revision: "),PetscStrcat(*(version),PETSC_VERSION_HG),0)
 54: #endif

 56: /*MC
 57:     PetscGetVersion - Gets the Petsc Version information in a string.

 59:     Output Parameter:
 60: .   version - version string

 62:     Input Parameter:
 63: .   len - length of the string

 65:     Level: developer

 67:     Usage:
 68:     char version[256];
 69:     PetscGetVersion(&version,256);

 71:     Fortran Note:
 72:     This routine is not supported in Fortran.

 74: .seealso: PetscGetProgramName()

 76: M*/

 78: /* ========================================================================== */

 80: /*
 81:    Currently cannot check formatting for PETSc print statements because we have our
 82:    own format %D and %G
 83: */
 84: #undef  PETSC_PRINTF_FORMAT_CHECK
 85: #define PETSC_PRINTF_FORMAT_CHECK(a,b)
 86: #undef  PETSC_FPRINTF_FORMAT_CHECK
 87: #define PETSC_FPRINTF_FORMAT_CHECK(a,b)

 89: /*
 90:    Fixes for configure time choices which impact our interface. Currently only
 91:    calling conventions and extra compiler checking falls under this category.
 92: */
 93: #if !defined(PETSC_STDCALL)
 94: #define PETSC_STDCALL
 95: #endif
 96: #if !defined(PETSC_TEMPLATE)
 97: #define PETSC_TEMPLATE
 98: #endif
 99: #if !defined(PETSC_HAVE_DLL_EXPORT)
100: #define PETSC_DLL_EXPORT
101: #define PETSC_DLL_IMPORT
102: #endif
103: #if !defined()
104: #define 
105: #endif
106: #if !defined()
107: #define 
108: #endif
109: #if !defined()
110: #define 
111: #endif
112: #if !defined()
113: #define 
114: #endif
115: #if !defined()
116: #define 
117: #endif
118: #if !defined()
119: #define 
120: #endif
121: #if !defined()
122: #define 
123: #endif
124: #if !defined()
125: #define 
126: #endif
127: /* ========================================================================== */

129: /*
130:     Defines the interface to MPI allowing the use of all MPI functions.

132:     PETSc does not use the C++ binding of MPI at ALL. The following flag
133:     makes sure the C++ bindings are not included. The C++ bindings REQUIRE
134:     putting mpi.h before ANY C++ include files, we cannot control this
135:     with all PETSc users.
136: */
137: #define MPICH_SKIP_MPICXX 1
138: #include "mpi.h"
139: /*
140:     Yuck, we need to put stdio.h AFTER mpi.h for MPICH2 with C++ compiler 
141:     see the top of mpicxx.h

143:     The MPI STANDARD HAS TO BE CHANGED to prevent this nonsense.
144: */
145: #include <stdio.h>

147: /* MSMPI on 32bit windows requires this yukky hack - that breaks MPI standard compliance */
148: #if !defined(MPIAPI)
149: #define MPIAPI
150: #endif

152: /*MC
153:     PetscErrorCode - datatype used for return error code from all PETSc functions

155:     Level: beginner

157: .seealso: CHKERRQ, SETERRQ
158: M*/
159: typedef int PetscErrorCode;

161: /*MC

163:     PetscCookie - A unique id used to identify each PETSc object.
164:          (internal integer in the data structure used for error
165:          checking). These are all defined by an offset from the lowest
166:          one, PETSC_SMALLEST_COOKIE. 

168:     Level: advanced

171: M*/
172: typedef int PetscCookie;

174: /*MC
175:     PetscEvent - id used to identify PETSc or user events - primarily for logging

177:     Level: intermediate

180: M*/
181: typedef int PetscEvent;

183: /*MC
184:     PetscBLASInt - datatype used to represent 'int' parameters to blas functions.

186:     Level: intermediate
187: M*/
188: typedef int PetscBLASInt;

190: /*MC
191:     PetscMPIInt - datatype used to represent 'int' parameters to MPI functions.

193:     Level: intermediate
194: M*/
195: typedef int PetscMPIInt;

197: /*MC
198:     PetscEnum - datatype used to pass enum types within PETSc functions.

200:     Level: intermediate

202: .seealso: PetscOptionsGetEnum(), PetscOptionsEnum(), PetscBagRegisterEnum()
203: M*/
204: typedef enum { ENUM_DUMMY } PetscEnum;

206: /*MC
207:     PetscInt - PETSc type that represents integer - used primarily to
208:       represent size of objects. Its size can be configured with the option
209:       --with-64-bit-indices - to be either 32bit or 64bit [default 32 bit ints]

211:    Level: intermediate

213: .seealso: PetscScalar
214: M*/
215: #if defined(PETSC_USE_64BIT_INDICES)
216: typedef long long PetscInt;
217: #define MPIU_INT MPI_LONG_LONG_INT
218: #else
219: typedef int PetscInt;
220: #define MPIU_INT MPI_INT
221: #endif  

223: /*
224:       You can use PETSC_STDOUT as a replacement of stdout. You can also change
225:     the value of PETSC_STDOUT to redirect all standard output elsewhere
226: */

229: /*
230:       You can use PETSC_STDERR as a replacement of stderr. You can also change
231:     the value of PETSC_STDERR to redirect all standard error elsewhere
232: */

236: /*MC
237:       PetscPolymorphicSubroutine - allows defining a C++ polymorphic version of 
238:             a PETSc function that remove certain optional arguments for a simplier user interface

240:      Not collective

242:    Synopsis:
243:    PetscPolymorphicSubroutine(Functionname,(arguments of C++ function),(arguments of C function))
244:  
245:    Level: developer

247:     Example:
248:       PetscPolymorphicSubroutine(VecNorm,(Vec x,PetscReal *r),(x,NORM_2,r)) generates the new routine
249:            PetscErrorCode VecNorm(Vec x,PetscReal *r) = VecNorm(x,NORM_2,r)

251: .seealso: PetscPolymorphicFunction()

253: M*/
254: #define PetscPolymorphicSubroutine(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {return A C;}

256: /*MC
257:       PetscPolymorphicScalar - allows defining a C++ polymorphic version of 
258:             a PETSc function that replaces a PetscScalar * argument with a PetscScalar argument

260:      Not collective

262:    Synopsis:
263:    PetscPolymorphicScalar(Functionname,(arguments of C++ function),(arguments of C function))
264:  
265:    Level: developer

267:     Example:
268:       PetscPolymorphicScalar(VecAXPY,(PetscScalar _val,Vec x,Vec y),(&_Val,x,y)) generates the new routine
269:            PetscErrorCode VecAXPY(PetscScalar _val,Vec x,Vec y) = {PetscScalar _Val = _val; return VecAXPY(&_Val,x,y);}

271: .seealso: PetscPolymorphicFunction(),PetscPolymorphicSubroutine()

273: M*/
274: #define PetscPolymorphicScalar(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {PetscScalar _Val = _val; return A C;}

276: /*MC
277:       PetscPolymorphicFunction - allows defining a C++ polymorphic version of 
278:             a PETSc function that remove certain optional arguments for a simplier user interface
279:             and returns the computed value (istead of an error code)

281:      Not collective

283:    Synopsis:
284:    PetscPolymorphicFunction(Functionname,(arguments of C++ function),(arguments of C function),return type,return variable name)
285:  
286:    Level: developer

288:     Example:
289:       PetscPolymorphicFunction(VecNorm,(Vec x,NormType t),(x,t,&r),PetscReal,r) generates the new routine
290:          PetscReal VecNorm(Vec x,NormType t) = {PetscReal r; VecNorm(x,t,&r); return r;}

292: .seealso: PetscPolymorphicSubroutine()

294: M*/
295: #define PetscPolymorphicFunction(A,B,C,D,E) PETSC_STATIC_INLINE D A B {D E; A C;return E;}

297: #else
298: #define PetscPolymorphicSubroutine(A,B,C)
299: #define PetscPolymorphicScalar(A,B,C)
300: #define PetscPolymorphicFunction(A,B,C,D,E)
301: #endif

303: /*
304:     Extern indicates a PETSc function defined elsewhere
305: */
306: #if !defined(EXTERN)
307: #define EXTERN extern
308: #endif

310: /*
311:     Defines some elementary mathematics functions and constants.
312: */
313:  #include petscmath.h

315: /*
317: */


321: /*
322:        Basic PETSc constants
323: */

325: /*E
326:     PetscTruth - Logical variable. Actually an integer

328:    Level: beginner

330: E*/
331: typedef enum { PETSC_FALSE,PETSC_TRUE } PetscTruth;

334: /*MC
335:     PETSC_FALSE - False value of PetscTruth

337:     Level: beginner

339:     Note: Zero integer

341: .seealso: PetscTruth, PETSC_TRUE
342: M*/

344: /*MC
345:     PETSC_TRUE - True value of PetscTruth

347:     Level: beginner

349:     Note: Nonzero integer

351: .seealso: PetscTruth, PETSC_FALSE
352: M*/

354: /*MC
355:     PETSC_YES - Alias for PETSC_TRUE

357:     Level: beginner

359:     Note: Zero integer

361: .seealso: PetscTruth, PETSC_TRUE, PETSC_FALSE, PETSC_NO
362: M*/
363: #define PETSC_YES            PETSC_TRUE

365: /*MC
366:     PETSC_NO - Alias for PETSC_FALSE

368:     Level: beginner

370:     Note: Nonzero integer

372: .seealso: PetscTruth, PETSC_TRUE, PETSC_FALSE, PETSC_YES
373: M*/
374: #define PETSC_NO             PETSC_FALSE

376: /*MC
377:     PETSC_NULL - standard way of passing in a null or array or pointer

379:    Level: beginner

381:    Notes: accepted by many PETSc functions to not set a parameter and instead use
382:           some default

384:           This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER, 
385:           PETSC_NULL_DOUBLE_PRECISION etc

387: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE

389: M*/
390: #define PETSC_NULL           0

392: /*MC
393:     PETSC_DECIDE - standard way of passing in integer or floating point parameter
394:        where you wish PETSc to use the default.

396:    Level: beginner

398: .seealso: PETSC_NULL, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE

400: M*/
401: #define PETSC_DECIDE         -1

403: /*MC
404:     PETSC_DEFAULT - standard way of passing in integer or floating point parameter
405:        where you wish PETSc to use the default.

407:    Level: beginner

409: .seealso: PETSC_DECIDE, PETSC_NULL, PETSC_IGNORE, PETSC_DETERMINE

411: M*/
412: #define PETSC_DEFAULT        -2


415: /*MC
416:     PETSC_IGNORE - same as PETSC_NULL, means PETSc will ignore this argument

418:    Level: beginner

420:    Notes: accepted by many PETSc functions to not set a parameter and instead use
421:           some default

423:           This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER, 
424:           PETSC_NULL_DOUBLE_PRECISION etc

426: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_NULL, PETSC_DETERMINE

428: M*/
429: #define PETSC_IGNORE         PETSC_NULL

431: /*MC
432:     PETSC_DETERMINE - standard way of passing in integer or floating point parameter
433:        where you wish PETSc to compute the required value.

435:    Level: beginner

437: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_NULL, VecSetSizes()

439: M*/
440: #define PETSC_DETERMINE      PETSC_DECIDE

442: /*MC
443:     PETSC_COMM_WORLD - the equivalent of the MPI_COMM_WORLD communicator which represents
444:            all the processs that PETSc knows about. 

446:    Level: beginner

448:    Notes: By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unless you wish to 
449:           run PETSc on ONLY a subset of MPI_COMM_WORLD. In that case create your new (smaller)
450:           communicator, call it, say comm, and set PETSC_COMM_WORLD = comm BEFORE calling
451:           PetscInitialize()

453: .seealso: PETSC_COMM_SELF

455: M*/

458: /*MC
459:     PETSC_COMM_SELF - a duplicate of the MPI_COMM_SELF communicator which represents
460:            the current process

462:    Level: beginner

464:    Notes: PETSC_COMM_SELF and MPI_COMM_SELF are equivalent.

466: .seealso: PETSC_COMM_WORLD

468: M*/
469: #define PETSC_COMM_SELF MPI_COMM_SELF


474: EXTERN PetscErrorCode  PetscSetHelpVersionFunctions(PetscErrorCode (*)(MPI_Comm),PetscErrorCode (*)(MPI_Comm));
475: EXTERN PetscErrorCode  PetscCommDuplicate(MPI_Comm,MPI_Comm*,int*);
476: EXTERN PetscErrorCode  PetscCommDestroy(MPI_Comm*);

478: /*MC
479:    PetscMalloc - Allocates memory

481:    Input Parameter:
482: .  m - number of bytes to allocate

484:    Output Parameter:
485: .  result - memory allocated

487:    Synopsis:
488:    PetscErrorCode PetscMalloc(size_t m,void **result)

490:    Level: beginner

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

494:           If you request memory of zero size it will allocate no space and assign the pointer to 0; PetscFree() will 
495:           properly handle not freeing the null pointer.

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

499:   Concepts: memory allocation

501: M*/
502: #define PetscMalloc(a,b)  ((a != 0) ? (*PetscTrMalloc)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__,(void**)(b)) : (*(b) = 0,0) )

504: /*MC
505:    PetscMalloc2 - Allocates 2 chunks of  memory

507:    Input Parameter:
508: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
509: .  t1 - type of first memory elements 
510: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
511: -  t2 - type of second memory elements

513:    Output Parameter:
514: +  r1 - memory allocated in first chunk
515: -  r2 - memory allocated in second chunk

517:    Synopsis:
518:    PetscErrorCode PetscMalloc2(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2)

520:    Level: developer

522:    Notes: Memory of first chunk is always allocated at least double aligned

524: .seealso: PetscFree(), PetscNew(), PetscMalloc()

526:   Concepts: memory allocation

528: M*/
529: #if defined(PETSC_USE_DEBUG)
530: #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2))
531: #else
532: #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2),r1) || (*(r2) = (t2*)(*(r1)+m1),0))
533: #endif

535: /*MC
536:    PetscMalloc3 - Allocates 3 chunks of  memory

538:    Input Parameter:
539: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
540: .  t1 - type of first memory elements 
541: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
542: .  t2 - type of second memory elements
543: .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
544: -  t3 - type of third memory elements

546:    Output Parameter:
547: +  r1 - memory allocated in first chunk
548: .  r2 - memory allocated in second chunk
549: -  r3 - memory allocated in third chunk

551:    Synopsis:
552:    PetscErrorCode PetscMalloc3(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3)

554:    Level: developer

556:    Notes: Memory of first chunk is always allocated at least double aligned

558: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3()

560:   Concepts: memory allocation

562: M*/
563: #if defined(PETSC_USE_DEBUG)
564: #define PetscMalloc3(m1,t1,r1,m2,t2,r2,m3,t3,r3) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2) || PetscMalloc((m3)*sizeof(t3),r3))
565: #else
566: #define PetscMalloc3(m1,t1,r1,m2,t2,r2,m3,t3,r3) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2)+(m3)*sizeof(t3),r1) || (*(r2) = (t2*)(*(r1)+m1),*(r3) = (t3*)(*(r2)+m2),0))
567: #endif

569: /*MC
570:    PetscMalloc4 - Allocates 4 chunks of  memory

572:    Input Parameter:
573: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
574: .  t1 - type of first memory elements 
575: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
576: .  t2 - type of second memory elements
577: .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
578: .  t3 - type of third memory elements
579: .  m4 - number of elements to allocate in 4th chunk  (may be zero)
580: -  t4 - type of fourth memory elements

582:    Output Parameter:
583: +  r1 - memory allocated in first chunk
584: .  r2 - memory allocated in second chunk
585: .  r3 - memory allocated in third chunk
586: -  r4 - memory allocated in fourth chunk

588:    Synopsis:
589:    PetscErrorCode PetscMalloc4(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3,size_t m4,type t4,void **r4)

591:    Level: developer

593:    Notes: Memory of first chunk is always allocated at least double aligned

595: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4()

597:   Concepts: memory allocation

599: M*/
600: #if defined(PETSC_USE_DEBUG)
601: #define PetscMalloc4(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2) || PetscMalloc((m3)*sizeof(t3),r3) || PetscMalloc((m4)*sizeof(t4),r4))
602: #else
603: #define PetscMalloc4(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2)+(m3)*sizeof(t3)+(m4)*sizeof(t4),r1) || (*(r2) = (t2*)(*(r1)+m1),*(r3) = (t3*)(*(r2)+m2),*(r4) = (t4*)(*(r3)+m3),0))
604: #endif

606: /*MC
607:    PetscMalloc5 - Allocates 5 chunks of  memory

609:    Input Parameter:
610: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
611: .  t1 - type of first memory elements 
612: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
613: .  t2 - type of second memory elements
614: .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
615: .  t3 - type of third memory elements
616: .  m4 - number of elements to allocate in 4th chunk  (may be zero)
617: .  t4 - type of fourth memory elements
618: .  m5 - number of elements to allocate in 5th chunk  (may be zero)
619: -  t5 - type of fifth memory elements

621:    Output Parameter:
622: +  r1 - memory allocated in first chunk
623: .  r2 - memory allocated in second chunk
624: .  r3 - memory allocated in third chunk
625: .  r4 - memory allocated in fourth chunk
626: -  r5 - memory allocated in fifth chunk

628:    Synopsis:
629:    PetscErrorCode PetscMalloc5(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3,size_t m4,type t4,void **r4,size_t m5,type t5,void **r5)

631:    Level: developer

633:    Notes: Memory of first chunk is always allocated at least double aligned

635: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5()

637:   Concepts: memory allocation

639: M*/
640: #if defined(PETSC_USE_DEBUG)
641: #define PetscMalloc5(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2) || PetscMalloc((m3)*sizeof(t3),r3) || PetscMalloc((m4)*sizeof(t4),r4) || PetscMalloc((m5)*sizeof(t5),r5))
642: #else
643: #define PetscMalloc5(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2)+(m3)*sizeof(t3)+(m4)*sizeof(t4)+(m5)*sizeof(t5),r1) || (*(r2) = (t2*)(*(r1)+m1),*(r3) = (t3*)(*(r2)+m2),*(r4) = (t4*)(*(r3)+m3),*(r5) = (t5*)(*(r4)+m4),0))
644: #endif


647: /*MC
648:    PetscMalloc6 - Allocates 6 chunks of  memory

650:    Input Parameter:
651: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
652: .  t1 - type of first memory elements 
653: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
654: .  t2 - type of second memory elements
655: .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
656: .  t3 - type of third memory elements
657: .  m4 - number of elements to allocate in 4th chunk  (may be zero)
658: .  t4 - type of fourth memory elements
659: .  m5 - number of elements to allocate in 5th chunk  (may be zero)
660: .  t5 - type of fifth memory elements
661: .  m6 - number of elements to allocate in 6th chunk  (may be zero)
662: -  t6 - type of sixth memory elements

664:    Output Parameter:
665: +  r1 - memory allocated in first chunk
666: .  r2 - memory allocated in second chunk
667: .  r3 - memory allocated in third chunk
668: .  r4 - memory allocated in fourth chunk
669: .  r5 - memory allocated in fifth chunk
670: -  r6 - memory allocated in sixth chunk

672:    Synopsis:
673:    PetscErrorCode PetscMalloc6(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3,size_t m4,type t4,void **r4,size_t m5,type t5,void **r5,size_t m6,type t6,void **r6)

675:    Level: developer

677:    Notes: Memory of first chunk is always allocated at least double aligned

679: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6()

681:   Concepts: memory allocation

683: M*/
684: #if defined(PETSC_USE_DEBUG)
685: #define PetscMalloc6(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2) || PetscMalloc((m3)*sizeof(t3),r3) || PetscMalloc((m4)*sizeof(t4),r4) || PetscMalloc((m5)*sizeof(t5),r5) || PetscMalloc((m6)*sizeof(t6),r6))
686: #else
687: #define PetscMalloc6(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2)+(m3)*sizeof(t3)+(m4)*sizeof(t4)+(m5)*sizeof(t5)+(m6)*sizeof(t6),r1) || (*(r2) = (t2*)(*(r1)+m1),*(r3) = (t3*)(*(r2)+m2),*(r4) = (t4*)(*(r3)+m3),*(r5) = (t5*)(*(r4)+m4),*(r6) = (t6*)(*(r5)+m5),0))
688: #endif

690: /*MC
691:    PetscMalloc7 - Allocates 7 chunks of  memory

693:    Input Parameter:
694: +  m1 - number of elements to allocate in 1st chunk  (may be zero)
695: .  t1 - type of first memory elements 
696: .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
697: .  t2 - type of second memory elements
698: .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
699: .  t3 - type of third memory elements
700: .  m4 - number of elements to allocate in 4th chunk  (may be zero)
701: .  t4 - type of fourth memory elements
702: .  m5 - number of elements to allocate in 5th chunk  (may be zero)
703: .  t5 - type of fifth memory elements
704: .  m6 - number of elements to allocate in 6th chunk  (may be zero)
705: .  t6 - type of sixth memory elements
706: .  m7 - number of elements to allocate in 7th chunk  (may be zero)
707: -  t7 - type of sixth memory elements

709:    Output Parameter:
710: +  r1 - memory allocated in first chunk
711: .  r2 - memory allocated in second chunk
712: .  r3 - memory allocated in third chunk
713: .  r4 - memory allocated in fourth chunk
714: .  r5 - memory allocated in fifth chunk
715: .  r6 - memory allocated in sixth chunk
716: -  r7 - memory allocated in sixth chunk

718:    Synopsis:
719:    PetscErrorCode PetscMalloc7(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3,size_t m4,type t4,void **r4,size_t m5,type t5,void **r5,size_t m6,type t6,void **r6,size_t m7,type t7,void **r7)

721:    Level: developer

723:    Notes: Memory of first chunk is always allocated at least double aligned

725: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6(), PetscFree7()

727:   Concepts: memory allocation

729: M*/
730: #if defined(PETSC_USE_DEBUG)
731: #define PetscMalloc7(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6,m7,t7,r7) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2) || PetscMalloc((m3)*sizeof(t3),r3) || PetscMalloc((m4)*sizeof(t4),r4) || PetscMalloc((m5)*sizeof(t5),r5) || PetscMalloc((m6)*sizeof(t6),r6) || PetscMalloc((m7)*sizeof(t7),r7))
732: #else
733: #define PetscMalloc7(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6,m7,t7,r7) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2)+(m3)*sizeof(t3)+(m4)*sizeof(t4)+(m5)*sizeof(t5)+(m6)*sizeof(t6)+(m7)*sizeof(t7),r1) || (*(r2) = (t2*)(*(r1)+m1),*(r3) = (t3*)(*(r2)+m2),*(r4) = (t4*)(*(r3)+m3),*(r5) = (t5*)(*(r4)+m4),*(r6) = (t6*)(*(r5)+m5),*(r7) = (t7*)(*(r6)+m6),0))
734: #endif

736: /*MC
737:    PetscNew - Allocates memory of a particular type, zeros the memory!

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

742:    Output Parameter:
743: .  result - memory allocated

745:    Synopsis:
746:    PetscErrorCode PetscNew(struct type,((type *))result)

748:    Level: beginner

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

752:   Concepts: memory allocation

754: M*/
755: #define PetscNew(A,b)        (PetscMalloc(sizeof(A),(b)) || PetscMemzero(*(b),sizeof(A)))

757: /*MC
758:    PetscFree - Frees memory

760:    Input Parameter:
761: .   memory - memory to free (the pointer is ALWAYS set to 0 upon sucess)

763:    Synopsis:
764:    PetscErrorCode PetscFree(void *memory)

766:    Level: beginner

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

770: .seealso: PetscNew(), PetscMalloc(), PetscFreeVoid()

772:   Concepts: memory allocation

774: M*/
775: #define PetscFree(a)   ((a) ? ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__) || ((a = 0),0)) : 0)

777: /*MC
778:    PetscFreeVoid - Frees memory

780:    Input Parameter:
781: .   memory - memory to free

783:    Synopsis:
784:    void PetscFreeVoid(void *memory)

786:    Level: beginner

788:    Notes: This is different from PetscFree() in that no error code is returned

790: .seealso: PetscFree(), PetscNew(), PetscMalloc()

792:   Concepts: memory allocation

794: M*/
795: #define PetscFreeVoid(a) ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__),(a) = 0)


798: /*MC
799:    PetscFree2 - Frees 2 chunks of memory obtained with PetscMalloc2()

801:    Input Parameter:
802: +   memory1 - memory to free
803: -   memory2 - 2nd memory to free


806:    Synopsis:
807:    PetscErrorCode PetscFree2(void *memory1,void *memory2)

809:    Level: developer

811:    Notes: Memory must have been obtained with PetscMalloc2()

813: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree()

815:   Concepts: memory allocation

817: M*/
818: #if defined(PETSC_USE_DEBUG)
819: #define PetscFree2(m1,m2)   (PetscFree(m2) || PetscFree(m1))
820: #else
821: #define PetscFree2(m1,m2)   (PetscFree(m1))
822: #endif

824: /*MC
825:    PetscFree3 - Frees 3 chunks of memory obtained with PetscMalloc3()

827:    Input Parameter:
828: +   memory1 - memory to free
829: .   memory2 - 2nd memory to free
830: -   memory3 - 3rd memory to free


833:    Synopsis:
834:    PetscErrorCode PetscFree3(void *memory1,void *memory2,void *memory3)

836:    Level: developer

838:    Notes: Memory must have been obtained with PetscMalloc3()

840: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3()

842:   Concepts: memory allocation

844: M*/
845: #if defined(PETSC_USE_DEBUG)
846: #define PetscFree3(m1,m2,m3)   (PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
847: #else
848: #define PetscFree3(m1,m2,m3)   (PetscFree(m1))
849: #endif

851: /*MC
852:    PetscFree4 - Frees 4 chunks of memory obtained with PetscMalloc4()

854:    Input Parameter:
855: +   m1 - memory to free
856: .   m2 - 2nd memory to free
857: .   m3 - 3rd memory to free
858: -   m4 - 4th memory to free


861:    Synopsis:
862:    PetscErrorCode PetscFree4(void *m1,void *m2,void *m3,void *m4)

864:    Level: developer

866:    Notes: Memory must have been obtained with PetscMalloc4()

868: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4()

870:   Concepts: memory allocation

872: M*/
873: #if defined(PETSC_USE_DEBUG)
874: #define PetscFree4(m1,m2,m3,m4)   (PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
875: #else
876: #define PetscFree4(m1,m2,m3,m4)   (PetscFree(m1))
877: #endif

879: /*MC
880:    PetscFree5 - Frees 5 chunks of memory obtained with PetscMalloc5()

882:    Input Parameter:
883: +   m1 - memory to free
884: .   m2 - 2nd memory to free
885: .   m3 - 3rd memory to free
886: .   m4 - 4th memory to free
887: -   m5 - 5th memory to free


890:    Synopsis:
891:    PetscErrorCode PetscFree5(void *m1,void *m2,void *m3,void *m4,void *m5)

893:    Level: developer

895:    Notes: Memory must have been obtained with PetscMalloc5()

897: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5()

899:   Concepts: memory allocation

901: M*/
902: #if defined(PETSC_USE_DEBUG)
903: #define PetscFree5(m1,m2,m3,m4,m5)   (PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
904: #else
905: #define PetscFree5(m1,m2,m3,m4,m5)   (PetscFree(m1))
906: #endif


909: /*MC
910:    PetscFree6 - Frees 6 chunks of memory obtained with PetscMalloc6()

912:    Input Parameter:
913: +   m1 - memory to free
914: .   m2 - 2nd memory to free
915: .   m3 - 3rd memory to free
916: .   m4 - 4th memory to free
917: .   m5 - 5th memory to free
918: -   m6 - 6th memory to free


921:    Synopsis:
922:    PetscErrorCode PetscFree6(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6)

924:    Level: developer

926:    Notes: Memory must have been obtained with PetscMalloc6()

928: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6()

930:   Concepts: memory allocation

932: M*/
933: #if defined(PETSC_USE_DEBUG)
934: #define PetscFree6(m1,m2,m3,m4,m5,m6)   (PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
935: #else
936: #define PetscFree6(m1,m2,m3,m4,m5,m6)   (PetscFree(m1))
937: #endif

939: /*MC
940:    PetscFree7 - Frees 7 chunks of memory obtained with PetscMalloc7()

942:    Input Parameter:
943: +   m1 - memory to free
944: .   m2 - 2nd memory to free
945: .   m3 - 3rd memory to free
946: .   m4 - 4th memory to free
947: .   m5 - 5th memory to free
948: .   m6 - 6th memory to free
949: -   m7 - 7th memory to free


952:    Synopsis:
953:    PetscErrorCode PetscFree7(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6,void *m7)

955:    Level: developer

957:    Notes: Memory must have been obtained with PetscMalloc7()

959: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6(),
960:           PetscMalloc7()

962:   Concepts: memory allocation

964: M*/
965: #if defined(PETSC_USE_DEBUG)
966: #define PetscFree7(m1,m2,m3,m4,m5,m6,m7)   (PetscFree(m7) || PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
967: #else
968: #define PetscFree7(m1,m2,m3,m4,m5,m6,m7)   (PetscFree(m1))
969: #endif

971: EXTERN  PetscErrorCode (*PetscTrMalloc)(size_t,int,const char[],const char[],const char[],void**);
972: EXTERN  PetscErrorCode (*PetscTrFree)(void*,int,const char[],const char[],const char[]);
973: EXTERN PetscErrorCode   PetscSetMalloc(PetscErrorCode (*)(size_t,int,const char[],const char[],const char[],void**),PetscErrorCode (*)(void*,int,const char[],const char[],const char[]));
974: EXTERN PetscErrorCode   PetscClearMalloc(void);

976: /*
977:    Routines for tracing memory corruption/bleeding with default PETSc 
978:    memory allocation
979: */
980: EXTERN PetscErrorCode    PetscMallocDump(FILE *);
981: EXTERN PetscErrorCode    PetscMallocDumpLog(FILE *);
982: EXTERN PetscErrorCode    PetscMallocGetCurrentUsage(PetscLogDouble *);
983: EXTERN PetscErrorCode    PetscMallocGetMaximumUsage(PetscLogDouble *);
984: EXTERN PetscErrorCode    PetscMallocDebug(PetscTruth);
985: EXTERN PetscErrorCode    PetscMallocValidate(int,const char[],const char[],const char[]);
986: EXTERN PetscErrorCode    PetscMallocSetDumpLog(void);


989: /*
990:     Variable type where we stash PETSc object pointers in Fortran.
991:     On most machines size(pointer) == sizeof(long) - except windows
992:     where its sizeof(long long)
993: */

995: #if (PETSC_SIZEOF_VOID_P) == (PETSC_SIZEOF_LONG)
996: #define PetscFortranAddr   long
997: #elif  (PETSC_SIZEOF_VOID_P) == (PETSC_SIZEOF_LONG_LONG)
998: #define PetscFortranAddr   long long
999: #else
1000: #error "Unknown size for PetscFortranAddr! Send us a bugreport at petsc-maint@mcs.anl.gov"
1001: #endif

1003: /*E
1004:     PetscDataType - Used for handling different basic data types.

1006:    Level: beginner

1008: .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(),
1009:           PetscDataTypeGetSize()

1011: E*/
1012: typedef enum {PETSC_INT = 0,PETSC_DOUBLE = 1,PETSC_COMPLEX = 2, PETSC_LONG = 3 ,PETSC_SHORT = 4,PETSC_FLOAT = 5,
1013:               PETSC_CHAR = 6,PETSC_LOGICAL = 7,PETSC_ENUM = 8,PETSC_TRUTH=9, PETSC_LONG_DOUBLE = 10} PetscDataType;

1016: #if defined(PETSC_USE_COMPLEX)
1017: #define PETSC_SCALAR PETSC_COMPLEX
1018: #else
1019: #if defined(PETSC_USE_SINGLE)
1020: #define PETSC_SCALAR PETSC_FLOAT
1021: #elif defined(PETSC_USE_LONG_DOUBLE)
1022: #define PETSC_SCALAR PETSC_LONG_DOUBLE
1023: #elif defined(PETSC_USE_INT)
1024: #define PETSC_SCALAR PETSC_INT
1025: #else
1026: #define PETSC_SCALAR PETSC_DOUBLE
1027: #endif
1028: #endif
1029: #if defined(PETSC_USE_SINGLE)
1030: #define PETSC_REAL PETSC_FLOAT
1031: #elif defined(PETSC_USE_LONG_DOUBLE)
1032: #define PETSC_REAL PETSC_LONG_DOUBLE
1033: #elif defined(PETSC_USE_INT)
1034: #define PETSC_REAL PETSC_INT
1035: #else
1036: #define PETSC_REAL PETSC_DOUBLE
1037: #endif
1038: #define PETSC_FORTRANADDR PETSC_LONG

1040: EXTERN PetscErrorCode  PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*);
1041: EXTERN PetscErrorCode  PetscDataTypeGetSize(PetscDataType,PetscInt*);

1043: /*
1044:     Basic memory and string operations. These are usually simple wrappers
1045:    around the basic Unix system calls, but a few of them have additional
1046:    functionality and/or error checking.
1047: */
1048: EXTERN PetscErrorCode    PetscMemcpy(void*,const void *,size_t);
1049: EXTERN PetscErrorCode    PetscBitMemcpy(void*,PetscInt,const void*,PetscInt,PetscInt,PetscDataType);
1050: EXTERN PetscErrorCode    PetscMemmove(void*,void *,size_t);
1051: EXTERN PetscErrorCode    PetscMemzero(void*,size_t);
1052: EXTERN PetscErrorCode    PetscMemcmp(const void*,const void*,size_t,PetscTruth *);
1053: EXTERN PetscErrorCode    PetscStrlen(const char[],size_t*);
1054: EXTERN PetscErrorCode    PetscStrcmp(const char[],const char[],PetscTruth *);
1055: EXTERN PetscErrorCode    PetscStrgrt(const char[],const char[],PetscTruth *);
1056: EXTERN PetscErrorCode    PetscStrcasecmp(const char[],const char[],PetscTruth*);
1057: EXTERN PetscErrorCode    PetscStrncmp(const char[],const char[],size_t,PetscTruth*);
1058: EXTERN PetscErrorCode    PetscStrcpy(char[],const char[]);
1059: EXTERN PetscErrorCode    PetscStrcat(char[],const char[]);
1060: EXTERN PetscErrorCode    PetscStrncat(char[],const char[],size_t);
1061: EXTERN PetscErrorCode    PetscStrncpy(char[],const char[],size_t);
1062: EXTERN PetscErrorCode    PetscStrchr(const char[],char,char *[]);
1063: EXTERN PetscErrorCode    PetscStrtolower(char[]);
1064: EXTERN PetscErrorCode    PetscStrrchr(const char[],char,char *[]);
1065: EXTERN PetscErrorCode    PetscStrstr(const char[],const char[],char *[]);
1066: EXTERN PetscErrorCode    PetscStrrstr(const char[],const char[],char *[]);
1067: EXTERN PetscErrorCode    PetscStrallocpy(const char[],char *[]);
1068: EXTERN PetscErrorCode    PetscStrreplace(MPI_Comm,const char[],char[],size_t);
1069: #define      PetscStrfree(a) ((a) ? PetscFree(a) : 0) 

1071: /*S
1072:     PetscToken - 'Token' used for managing tokenizing strings

1074:   Level: intermediate

1076: .seealso: PetscTokenCreate(), PetscTokenFind(), PetscTokenDestroy()
1077: S*/
1078: typedef struct {char token;char *array;char *current;} PetscToken;

1080: EXTERN PetscErrorCode    PetscTokenCreate(const char[],const char,PetscToken**);
1081: EXTERN PetscErrorCode    PetscTokenFind(PetscToken*,char *[]);
1082: EXTERN PetscErrorCode    PetscTokenDestroy(PetscToken*);

1084: /*
1085:    These are  MPI operations for MPI_Allreduce() etc
1086: */
1087: EXTERN  MPI_Op PetscMaxSum_Op;
1088: #if defined(PETSC_USE_COMPLEX)
1089: EXTERN  MPI_Op PetscSum_Op;
1090: #else
1091: #define PetscSum_Op MPI_SUM
1092: #endif
1093: EXTERN PetscErrorCode  PetscMaxSum(MPI_Comm,const PetscInt[],PetscInt*,PetscInt*);

1095: /*S
1096:      PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc

1098:    Level: beginner

1100:    Note: This is the base class from which all objects appear.

1102: .seealso:  PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName()
1103: S*/
1104: typedef struct _p_PetscObject* PetscObject;

1106: /*S
1107:      PetscFList - Linked list of functions, possibly stored in dynamic libraries, accessed
1108:       by string name

1110:    Level: advanced

1112: .seealso:  PetscFListAdd(), PetscFListDestroy()
1113: S*/
1114: typedef struct _n_PetscFList *PetscFList;

1116: /*E
1117:   PetscFileMode - Access mode for a file.

1119:   Level: beginner

1121:   FILE_MODE_READ - open a file at its beginning for reading

1123:   FILE_MODE_WRITE - open a file at its beginning for writing (will create if the file does not exist)

1125:   FILE_MODE_APPEND - open a file at end for writing

1127:   FILE_MODE_UPDATE - open a file for updating, meaning for reading and writing

1129:   FILE_MODE_APPEND_UPDATE - open a file for updating, meaning for reading and writing, at the end

1131: .seealso: PetscViewerFileSetMode()
1132: E*/
1133: typedef enum {FILE_MODE_READ, FILE_MODE_WRITE, FILE_MODE_APPEND, FILE_MODE_UPDATE, FILE_MODE_APPEND_UPDATE} PetscFileMode;

1135:  #include petscviewer.h
1136:  #include petscoptions.h

1138: #define PETSC_SMALLEST_COOKIE 1211211
1141: EXTERN PetscErrorCode  PetscCookieRegister(PetscCookie *);

1143: /*
1144:    Routines that get memory usage information from the OS
1145: */
1146: EXTERN PetscErrorCode  PetscMemoryGetCurrentUsage(PetscLogDouble *);
1147: EXTERN PetscErrorCode  PetscMemoryGetMaximumUsage(PetscLogDouble *);
1148: EXTERN PetscErrorCode  PetscMemorySetGetMaximumUsage(void);
1149: EXTERN PetscErrorCode  PetscMemoryShowUsage(PetscViewer,const char[]);

1151: EXTERN PetscErrorCode  PetscInfoAllow(PetscTruth,const char []);
1152: EXTERN PetscErrorCode  PetscGetTime(PetscLogDouble*);
1153: EXTERN PetscErrorCode  PetscGetCPUTime(PetscLogDouble*);
1154: EXTERN PetscErrorCode  PetscSleep(int);

1156: /*
1157:     Initialization of PETSc
1158: */
1159: EXTERN PetscErrorCode  PetscInitialize(int*,char***,const char[],const char[]);
1160: PetscPolymorphicSubroutine(PetscInitialize,(int *argc,char ***args),(argc,args,PETSC_NULL,PETSC_NULL))
1161: EXTERN PetscErrorCode  PetscInitializeNoArguments(void);
1162: EXTERN PetscErrorCode  PetscInitialized(PetscTruth *);
1163: EXTERN PetscErrorCode  PetscFinalized(PetscTruth *);
1164: EXTERN PetscErrorCode  PetscFinalize(void);
1165: EXTERN PetscErrorCode PetscInitializeFortran(void);
1166: EXTERN PetscErrorCode  PetscGetArgs(int*,char ***);
1167: EXTERN PetscErrorCode  PetscGetArguments(char ***args);
1168: EXTERN PetscErrorCode  PetscFreeArguments(char **args);

1170: EXTERN PetscErrorCode  PetscEnd(void);
1171: EXTERN PetscErrorCode  PetscInitializePackage(const char[]);

1173: EXTERN PetscErrorCode  PetscOpenMPMerge(PetscMPIInt);
1174: EXTERN PetscErrorCode  PetscOpenMPSpawn(PetscMPIInt);
1175: EXTERN PetscErrorCode  PetscOpenMPFinalize(void);
1176: EXTERN PetscErrorCode  PetscOpenMPRun(MPI_Comm,PetscErrorCode (*)(MPI_Comm,void *),void*);
1177: EXTERN PetscErrorCode  PetscOpenMPFree(MPI_Comm,void*);
1178: EXTERN PetscErrorCode  PetscOpenMPNew(MPI_Comm,PetscInt,void**);

1180: /*
1182:    function pointers. Since the regular C++ code expects its function pointers to be 
1183:    C++.
1184: */
1185: typedef void (**PetscVoidStarFunction)(void);
1186: typedef void (*PetscVoidFunction)(void);
1187: typedef PetscErrorCode (*PetscErrorCodeFunction)(void);

1189: /*
1190:    PetscTryMethod - Queries an object for a method, if it exists then calls it.
1191:               These are intended to be used only inside PETSc functions.
1192: */
1193: #define  PetscTryMethod(obj,A,B,C) \
1194:   0;{ PetscErrorCode (*f)B, __ierr; \
1195:     __PetscObjectQueryFunction((PetscObject)obj,#A,(PetscVoidStarFunction)&f);CHKERRQ(__ierr); \
1196:     if (f) {__(*f)C;CHKERRQ(__ierr);}\
1197:   }
1198: #define  PetscUseMethod(obj,A,B,C) \
1199:   0;{ PetscErrorCode (*f)B, __ierr; \
1200:     __PetscObjectQueryFunction((PetscObject)obj,A,(PetscVoidStarFunction)&f);CHKERRQ(__ierr); \
1201:     if (f) {__(*f)C;CHKERRQ(__ierr);}\
1202:     else {SETERRQ1(PETSC_ERR_SUP,"Cannot locate function %s in object",A);} \
1203:   }
1204: /*
1205:     Functions that can act on any PETSc object.
1206: */
1207: EXTERN PetscErrorCode  PetscObjectCreate(MPI_Comm,PetscObject*);
1208: EXTERN PetscErrorCode  PetscObjectCreateGeneric(MPI_Comm, PetscCookie, const char [], PetscObject *);
1209: EXTERN PetscErrorCode  PetscObjectDestroy(PetscObject);
1210: EXTERN PetscErrorCode  PetscObjectExists(PetscObject,PetscTruth*);
1211: EXTERN PetscErrorCode  PetscObjectGetComm(PetscObject,MPI_Comm *);
1212: EXTERN PetscErrorCode  PetscObjectGetCookie(PetscObject,PetscCookie *);
1213: EXTERN PetscErrorCode  PetscObjectSetType(PetscObject,const char []);
1214: EXTERN PetscErrorCode  PetscObjectGetType(PetscObject,const char *[]);
1215: EXTERN PetscErrorCode  PetscObjectSetName(PetscObject,const char[]);
1216: EXTERN PetscErrorCode  PetscObjectGetName(PetscObject,const char*[]);
1217: EXTERN PetscErrorCode  PetscObjectReference(PetscObject);
1218: EXTERN PetscErrorCode  PetscObjectGetReference(PetscObject,PetscInt*);
1219: EXTERN PetscErrorCode  PetscObjectDereference(PetscObject);
1220: EXTERN PetscErrorCode  PetscObjectGetNewTag(PetscObject,PetscMPIInt *);
1221: EXTERN PetscErrorCode  PetscObjectView(PetscObject,PetscViewer);
1222: EXTERN PetscErrorCode  PetscObjectCompose(PetscObject,const char[],PetscObject);
1223: EXTERN PetscErrorCode  PetscObjectQuery(PetscObject,const char[],PetscObject *);
1224: EXTERN PetscErrorCode  PetscObjectComposeFunction(PetscObject,const char[],const char[],void (*)(void));
1225: EXTERN PetscErrorCode  PetscObjectSetFromOptions(PetscObject);
1226: EXTERN PetscErrorCode  PetscObjectSetUp(PetscObject);
1227: EXTERN PetscErrorCode  PetscCommGetNewTag(MPI_Comm,PetscMPIInt *);

1229: /*MC
1230:    PetscObjectComposeFunctionDynamic - Associates a function with a given PETSc object. 
1231:                        
1232:    Collective on PetscObject

1234:    Input Parameters:
1235: +  obj - the PETSc object; this must be cast with a (PetscObject), for example, 
1236:          PetscObjectCompose((PetscObject)mat,...);
1237: .  name - name associated with the child function
1238: .  fname - name of the function
1239: -  ptr - function pointer (or PETSC_NULL if using dynamic libraries)

1241:    Level: advanced

1243:     Synopsis:
1244:     PetscErrorCode PetscObjectComposeFunctionDynamic(PetscObject obj,const char name[],const char fname[],void *ptr)

1246:    Notes:
1247:    To remove a registered routine, pass in a PETSC_NULL rname and fnc().

1249:    PetscObjectComposeFunctionDynamic() can be used with any PETSc object (such as
1250:    Mat, Vec, KSP, SNES, etc.) or any user-provided object. 

1253:    work in C++/complex with dynamic link libraries (config/configure.py options --with-shared --with-dynamic)
1254:    enabled.

1256:    Concepts: objects^composing functions
1257:    Concepts: composing functions
1258:    Concepts: functions^querying
1259:    Concepts: objects^querying
1260:    Concepts: querying objects

1262: .seealso: PetscObjectQueryFunction()
1263: M*/
1264: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1265: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,0)
1266: #else
1267: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,(PetscVoidFunction)(d))
1268: #endif

1270: EXTERN PetscErrorCode  PetscObjectQueryFunction(PetscObject,const char[],void (**)(void));
1271: EXTERN PetscErrorCode  PetscObjectSetOptionsPrefix(PetscObject,const char[]);
1272: EXTERN PetscErrorCode  PetscObjectAppendOptionsPrefix(PetscObject,const char[]);
1273: EXTERN PetscErrorCode  PetscObjectPrependOptionsPrefix(PetscObject,const char[]);
1274: EXTERN PetscErrorCode  PetscObjectGetOptionsPrefix(PetscObject,const char*[]);
1275: EXTERN PetscErrorCode  PetscObjectPublish(PetscObject);
1276: EXTERN PetscErrorCode  PetscObjectChangeTypeName(PetscObject,const char[]);
1277: EXTERN PetscErrorCode  PetscObjectRegisterDestroy(PetscObject);
1278: EXTERN PetscErrorCode  PetscObjectRegisterDestroyAll(void);
1279: EXTERN PetscErrorCode  PetscObjectName(PetscObject);
1280: EXTERN PetscErrorCode  PetscTypeCompare(PetscObject,const char[],PetscTruth*);

1282: /*
1283:     Defines PETSc error handling.
1284: */
1285:  #include petscerror.h

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

1290:    Level: advanced

1292: .seealso:  PetscOListAdd(), PetscOListDestroy(), PetscOListFind()
1293: S*/
1294: typedef struct _n_PetscOList *PetscOList;

1296: EXTERN PetscErrorCode  PetscOListDestroy(PetscOList);
1297: EXTERN PetscErrorCode  PetscOListFind(PetscOList,const char[],PetscObject*);
1298: EXTERN PetscErrorCode  PetscOListReverseFind(PetscOList,PetscObject,char**);
1299: EXTERN PetscErrorCode  PetscOListAdd(PetscOList *,const char[],PetscObject);
1300: EXTERN PetscErrorCode  PetscOListDuplicate(PetscOList,PetscOList *);

1302: /*
1303:     Dynamic library lists. Lists of names of routines in dynamic 
1304:   link libraries that will be loaded as needed.
1305: */
1306: EXTERN PetscErrorCode  PetscFListAdd(PetscFList*,const char[],const char[],void (*)(void));
1307: EXTERN PetscErrorCode  PetscFListDestroy(PetscFList*);
1308: EXTERN PetscErrorCode  PetscFListFind(PetscFList,MPI_Comm,const char[],void (**)(void));
1309: EXTERN PetscErrorCode  PetscFListPrintTypes(PetscFList,MPI_Comm,FILE*,const char[],const char[],const char[],const char[]);
1310: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1311: #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,0)
1312: #else
1313: #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,(void (*)(void))c)
1314: #endif
1315: EXTERN PetscErrorCode  PetscFListDuplicate(PetscFList,PetscFList *);
1316: EXTERN PetscErrorCode  PetscFListView(PetscFList,PetscViewer);
1317: EXTERN PetscErrorCode  PetscFListConcat(const char [],const char [],char []);
1318: EXTERN PetscErrorCode  PetscFListGet(PetscFList,char ***,int*);

1320: /*S
1321:      PetscDLLibrary - Linked list of dynamics libraries to search for functions

1323:    Level: advanced

1325:    --with-shared --with-dynamic must be used with config/configure.py to use dynamic libraries

1327: .seealso:  PetscDLLibraryOpen()
1328: S*/
1329: typedef struct _n_PetscDLLibrary *PetscDLLibrary;
1331: EXTERN PetscErrorCode  PetscDLLibraryRetrieve(MPI_Comm,const char[],char *,int,PetscTruth *);
1332: EXTERN PetscErrorCode  PetscDLLibraryOpen(MPI_Comm,const char[],void **);
1333: EXTERN PetscErrorCode  PetscDLLibrarySym(MPI_Comm,PetscDLLibrary *,const char[],const char[],void **);
1334: EXTERN PetscErrorCode  PetscDLLibraryAppend(MPI_Comm,PetscDLLibrary *,const char[]);
1335: EXTERN PetscErrorCode  PetscDLLibraryPrepend(MPI_Comm,PetscDLLibrary *,const char[]);
1336: EXTERN PetscErrorCode  PetscDLLibraryClose(PetscDLLibrary);
1337: EXTERN PetscErrorCode  PetscDLLibraryPrintPath(void);
1338: EXTERN PetscErrorCode  PetscDLLibraryGetInfo(void*,const char[],const char *[]);
1339: EXTERN PetscErrorCode  PetscDLLibraryCCAAppend(MPI_Comm,PetscDLLibrary *,const char[]);

1341: /*
1342:      Useful utility routines
1343: */
1344: EXTERN PetscErrorCode  PetscSplitOwnership(MPI_Comm,PetscInt*,PetscInt*);
1345: EXTERN PetscErrorCode  PetscSplitOwnershipBlock(MPI_Comm,PetscInt,PetscInt*,PetscInt*);
1346: EXTERN PetscErrorCode  PetscSequentialPhaseBegin(MPI_Comm,PetscMPIInt);
1347: PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(MPI_Comm comm),(comm,1))
1348: PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(void),(PETSC_COMM_WORLD,1))
1349: EXTERN PetscErrorCode  PetscSequentialPhaseEnd(MPI_Comm,PetscMPIInt);
1350: PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(MPI_Comm comm),(comm,1))
1351: PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(void),(PETSC_COMM_WORLD,1))
1352: EXTERN PetscErrorCode  PetscBarrier(PetscObject);
1353: EXTERN PetscErrorCode  PetscMPIDump(FILE*);

1355: #define PetscNot(a) ((a) ? PETSC_FALSE : PETSC_TRUE)
1356: /*
1357:     Defines basic graphics available from PETSc.
1358: */
1359:  #include petscdraw.h

1361: /*
1362:     Defines the base data structures for all PETSc objects
1363: */
1364:  #include private/petscimpl.h
1365: /*
1366:      Defines PETSc profiling.
1367: */
1368:  #include petsclog.h

1370: /*
1371:           For locking, unlocking and destroying AMS memories associated with 
1372:     PETSc objects. Not currently used.
1373: */
1374: #define PetscPublishAll(v)           0
1375: #define PetscObjectTakeAccess(obj)   0
1376: #define PetscObjectGrantAccess(obj)  0
1377: #define PetscObjectDepublish(obj)    0



1381: /*
1382:       This code allows one to pass a MPI communicator between 
1383:     C and Fortran. MPI 2.0 defines a standard API for doing this.
1384:     The code here is provided to allow PETSc to work with MPI 1.1
1385:     standard MPI libraries.
1386: */
1387: EXTERN PetscErrorCode MPICCommToFortranComm(MPI_Comm,int *);
1388: EXTERN PetscErrorCode MPIFortranCommToCComm(int,MPI_Comm*);

1390: /*
1391:       Simple PETSc parallel IO for ASCII printing
1392: */
1393: EXTERN PetscErrorCode   PetscFixFilename(const char[],char[]);
1394: EXTERN PetscErrorCode   PetscFOpen(MPI_Comm,const char[],const char[],FILE**);
1395: EXTERN PetscErrorCode   PetscFClose(MPI_Comm,FILE*);
1396: EXTERN PetscErrorCode   PetscFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1397: EXTERN PetscErrorCode   PetscPrintf(MPI_Comm,const char[],...)  PETSC_PRINTF_FORMAT_CHECK(2,3);
1398: EXTERN PetscErrorCode   PetscSNPrintf(char*,size_t,const char [],...);

1400: /* These are used internally by PETSc ASCII IO routines*/
1401: #include <stdarg.h>
1402: EXTERN PetscErrorCode   PetscVSNPrintf(char*,size_t,const char[],va_list);
1403: EXTERN PetscErrorCode   PetscVFPrintf(FILE*,const char[],va_list);

1405: /*MC
1406:     PetscErrorPrintf - Prints error messages.

1408:     Not Collective

1410:    Synopsis:
1411:      PetscErrorCode (*PetscErrorPrintf)(const char format[],...);

1413:     Input Parameters:
1414: .   format - the usual printf() format string 

1416:    Options Database Keys:
1417: +    -error_output_stderr - cause error messages to be printed to stderr instead of the
1418:          (default) stdout
1419: -    -error_output_none to turn off all printing of error messages (does not change the way the 
1420:           error is handled.)

1422:    Notes: Use
1423:      PetscErrorPrintf = PetscErrorPrintfNone; to turn off all printing of error messages (does not change the way the 
1424:            error is handled.) and
1425:      PetscErrorPrintf = PetscErrorPrintfDefault; to turn it back on


1428:   

1430:    Level: developer

1432:     Fortran Note:
1433:     This routine is not supported in Fortran.

1435:     Concepts: error messages^printing
1436:     Concepts: printing^error messages

1438: .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscHelpPrintf()
1439: M*/
1440: EXTERN  PetscErrorCode (*PetscErrorPrintf)(const char[],...);

1442: /*MC
1443:     PetscHelpPrintf - Prints help messages.

1445:     Not Collective

1447:    Synopsis:
1448:      PetscErrorCode (*PetscHelpPrintf)(const char format[],...);

1450:     Input Parameters:
1451: .   format - the usual printf() format string 

1453:    Level: developer

1455:     Fortran Note:
1456:     This routine is not supported in Fortran.

1458:     Concepts: help messages^printing
1459:     Concepts: printing^help messages

1461: .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscErrorPrintf()
1462: M*/
1463: EXTERN  PetscErrorCode  (*PetscHelpPrintf)(MPI_Comm,const char[],...);

1465: EXTERN PetscErrorCode  PetscErrorPrintfDefault(const char [],...);
1466: EXTERN PetscErrorCode  PetscErrorPrintfNone(const char [],...);
1467: EXTERN PetscErrorCode  PetscHelpPrintfDefault(MPI_Comm,const char [],...);

1469: EXTERN PetscErrorCode   PetscPOpen(MPI_Comm,const char[],const char[],const char[],FILE **);
1470: EXTERN PetscErrorCode   PetscPClose(MPI_Comm,FILE*);
1471: EXTERN PetscErrorCode   PetscSynchronizedPrintf(MPI_Comm,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
1472: EXTERN PetscErrorCode   PetscSynchronizedFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1473: EXTERN PetscErrorCode   PetscSynchronizedFlush(MPI_Comm);
1474: EXTERN PetscErrorCode   PetscSynchronizedFGets(MPI_Comm,FILE*,size_t,char[]);
1475: EXTERN PetscErrorCode   PetscStartMatlab(MPI_Comm,const char[],const char[],FILE**);
1476: EXTERN PetscErrorCode   PetscStartJava(MPI_Comm,const char[],const char[],FILE**);
1477: EXTERN PetscErrorCode   PetscGetPetscDir(const char*[]);

1479: EXTERN PetscErrorCode   PetscPopUpSelect(MPI_Comm,char*,char*,int,char**,int*);

1481: /*S
1482:      PetscContainer - Simple PETSc object that contains a pointer to any required data

1484:    Level: advanced

1486: .seealso:  PetscObject, PetscContainerCreate()
1487: S*/
1489: typedef struct _p_PetscContainer*  PetscContainer;
1490: EXTERN PetscErrorCode  PetscContainerGetPointer(PetscContainer,void **);
1491: EXTERN PetscErrorCode  PetscContainerSetPointer(PetscContainer,void *);
1492: EXTERN PetscErrorCode  PetscContainerDestroy(PetscContainer);
1493: EXTERN PetscErrorCode  PetscContainerCreate(MPI_Comm,PetscContainer *);
1494: EXTERN PetscErrorCode  PetscContainerSetUserDestroy(PetscContainer, PetscErrorCode (*)(void*));

1496: /*
1497:    For use in debuggers 
1498: */

1502: EXTERN PetscErrorCode  PetscIntView(PetscInt,PetscInt[],PetscViewer);
1503: EXTERN PetscErrorCode  PetscRealView(PetscInt,PetscReal[],PetscViewer);
1504: EXTERN PetscErrorCode  PetscScalarView(PetscInt,PetscScalar[],PetscViewer);

1506: /*
1507:     Allows accessing Matlab Engine
1508: */
1509:  #include petscmatlab.h

1511: /*
1512:       Determine if some of the kernel computation routines use
1513:    Fortran (rather than C) for the numerical calculations. On some machines
1514:    and compilers (like complex numbers) the Fortran version of the routines
1515:    is faster than the C/C++ versions. The flag --with-fortran-kernels
1516:    should be used with config/configure.py to turn these on.
1517: */
1518: #if defined(PETSC_USE_FORTRAN_KERNELS)

1520: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCRL)
1521: #define PETSC_USE_FORTRAN_KERNEL_MULTCRL
1522: #endif

1524: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM)
1525: #define PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM
1526: #endif

1528: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1529: #define PETSC_USE_FORTRAN_KERNEL_MULTAIJ
1530: #endif

1532: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1533: #define PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ
1534: #endif

1536: #if !defined(PETSC_USE_FORTRAN_KERNEL_NORM)
1537: #define PETSC_USE_FORTRAN_KERNEL_NORM
1538: #endif

1540: #if !defined(PETSC_USE_FORTRAN_KERNEL_MAXPY)
1541: #define PETSC_USE_FORTRAN_KERNEL_MAXPY
1542: #endif

1544: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ)
1545: #define PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ
1546: #endif

1548: #if !defined(PETSC_USE_FORTRAN_KERNEL_RELAXAIJ)
1549: #define PETSC_USE_FORTRAN_KERNEL_RELAXAIJ
1550: #endif

1552: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ)
1553: #define PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ
1554: #endif

1556: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1557: #define PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ
1558: #endif

1560: #if !defined(PETSC_USE_FORTRAN_KERNEL_MDOT)
1561: #define PETSC_USE_FORTRAN_KERNEL_MDOT
1562: #endif

1564: #if !defined(PETSC_USE_FORTRAN_KERNEL_XTIMESY)
1565: #define PETSC_USE_FORTRAN_KERNEL_XTIMESY
1566: #endif

1568: #if !defined(PETSC_USE_FORTRAN_KERNEL_AYPX)
1569: #define PETSC_USE_FORTRAN_KERNEL_AYPX
1570: #endif

1572: #if !defined(PETSC_USE_FORTRAN_KERNEL_WAXPY)
1573: #define PETSC_USE_FORTRAN_KERNEL_WAXPY
1574: #endif

1576: #endif

1578: /*
1579:     Macros for indicating code that should be compiled with a C interface,
1580:    rather than a C++ interface. Any routines that are dynamically loaded
1581:    (such as the PCCreate_XXX() routines) must be wrapped so that the name
1582:    mangler does not change the functions symbol name. This just hides the 
1584: */
1585: #if defined(__cplusplus)
1588: #else
1591: #endif

1593: /* --------------------------------------------------------------------*/

1595: /*MC
1596:     size - integer variable used to contain the number of processors in
1597:            the relevent MPI_Comm

1599:    Level: beginner

1601: .seealso: rank, comm
1602: M*/

1604: /*MC
1605:     rank - integer variable used to contain the number of this processor relative
1606:            to all in the relevent MPI_Comm

1608:    Level: beginner

1610: .seealso: size, comm
1611: M*/

1613: /*MC
1614:     comm - MPI_Comm used in the current routine or object

1616:    Level: beginner

1618: .seealso: size, rank
1619: M*/

1621: /*MC
1622:     MPI_Comm - the basic object used by MPI to determine which processes are involved in a 
1623:         communication

1625:    Level: beginner

1627:    Note: This manual page is a place-holder because MPICH does not have a manual page for MPI_Comm

1629: .seealso: size, rank, comm, PETSC_COMM_WORLD, PETSC_COMM_SELF
1630: M*/

1632: /*MC
1633:     PetscScalar - PETSc type that represents either a double precision real number, a double precision
1634:        complex number, a single precision real number, a long double or an int - if the code is configured 
1635:        with --with-scalar-type=real,complex --with-precision=single,double,longdouble,int,matsingle


1638:    Level: beginner

1640: .seealso: PetscReal, PassiveReal, PassiveScalar
1641: M*/

1643: /*MC
1644:     PetscReal - PETSc type that represents a real number version of PetscScalar

1646:    Level: beginner

1648: .seealso: PetscScalar, PassiveReal, PassiveScalar
1649: M*/

1651: /*MC
1652:     PassiveScalar - PETSc type that represents a PetscScalar
1653:    Level: beginner

1655:     This is the same as a PetscScalar except in code that is automatically differentiated it is
1656:    treated as a constant (not an indendent or dependent variable)

1658: .seealso: PetscReal, PassiveReal, PetscScalar
1659: M*/

1661: /*MC
1662:     PassiveReal - PETSc type that represents a PetscReal

1664:    Level: beginner

1666:     This is the same as a PetscReal except in code that is automatically differentiated it is
1667:    treated as a constant (not an indendent or dependent variable)

1669: .seealso: PetscScalar, PetscReal, PassiveScalar
1670: M*/

1672: /*MC
1673:     MPIU_SCALAR - MPI datatype corresponding to PetscScalar

1675:    Level: beginner

1677:     Note: In MPI calls that require an MPI datatype that matches a PetscScalar or array of PetscScalars
1678:           pass this value

1680: .seealso: PetscReal, PassiveReal, PassiveScalar, PetscScalar
1681: M*/

1683: /*
1684:      The IBM include files define hz, here we hide it so that it may be used
1685:    as a regular user variable.
1686: */
1687: #if defined(hz)
1688: #undef hz
1689: #endif

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


1694: #if defined(PETSC_HAVE_LIMITS_H)
1695: #include <limits.h>
1696: #endif
1697: #if defined(PETSC_HAVE_SYS_PARAM_H)
1698: #include <sys/param.h>
1699: #endif
1700: #if defined(PETSC_HAVE_SYS_TYPES_H)
1701: #include <sys/types.h>
1702: #endif
1703: #if defined(MAXPATHLEN)
1704: #  define PETSC_MAX_PATH_LEN     MAXPATHLEN
1705: #elif defined(MAX_PATH)
1706: #  define PETSC_MAX_PATH_LEN     MAX_PATH
1707: #elif defined(_MAX_PATH)
1708: #  define PETSC_MAX_PATH_LEN     _MAX_PATH
1709: #else
1710: #  define PETSC_MAX_PATH_LEN     4096
1711: #endif

1714: #endif