xref: /petsc/include/petsc.h (revision fad68dfa178c86155e5d5291689bc2f3ad36ac6f)
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 */
5 #if !defined(__PETSC_H)
6 #define __PETSC_H
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"
14 
15 /* ========================================================================== */
16 /*
17    This facilitates using C version of PETSc from C++ and
18    C++ version from C (use --with-c-support --with-language=c++ with config/configure.py)
19 */
20 #if defined(PETSC_CLANGUAGE_CXX) && !defined(PETSC_USE_EXTERN_CXX) && !defined(__cplusplus)
21 #error "PETSc configured with --with-clanguage=c++ and NOT --with-c-support - it can be used only with a C++ compiler"
22 #endif
23 
24 
25 #if defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
26 #define PETSC_EXTERN_CXX_BEGIN extern "C" {
27 #define PETSC_EXTERN_CXX_END  }
28 #else
29 #define PETSC_EXTERN_CXX_BEGIN
30 #define PETSC_EXTERN_CXX_END
31 #endif
32 /* ========================================================================== */
33 /*
34    Current PETSc version number and release date
35 */
36 #include "petscversion.h"
37 
38 /*
39    Currently cannot check formatting for PETSc print statements because we have our
40    own format %D
41 */
42 #undef  PETSC_PRINTF_FORMAT_CHECK
43 #define PETSC_PRINTF_FORMAT_CHECK(a,b)
44 #undef  PETSC_FPRINTF_FORMAT_CHECK
45 #define PETSC_FPRINTF_FORMAT_CHECK(a,b)
46 
47 /*
48    Fixes for configure time choices which impact our interface. Currently only
49    calling conventions and extra compiler checking falls under this category.
50 */
51 #if !defined(PETSC_STDCALL)
52 #define PETSC_STDCALL
53 #endif
54 #if !defined(PETSC_TEMPLATE)
55 #define PETSC_TEMPLATE
56 #endif
57 #if !defined(PETSC_HAVE_DLL_EXPORT)
58 #define PETSC_DLL_EXPORT
59 #define PETSC_DLL_IMPORT
60 #endif
61 #if !defined(PETSC_DLLEXPORT)
62 #define PETSC_DLLEXPORT
63 #endif
64 #if !defined(PETSCVEC_DLLEXPORT)
65 #define PETSCVEC_DLLEXPORT
66 #endif
67 #if !defined(PETSCMAT_DLLEXPORT)
68 #define PETSCMAT_DLLEXPORT
69 #endif
70 #if !defined(PETSCDM_DLLEXPORT)
71 #define PETSCDM_DLLEXPORT
72 #endif
73 #if !defined(PETSCKSP_DLLEXPORT)
74 #define PETSCKSP_DLLEXPORT
75 #endif
76 #if !defined(PETSCSNES_DLLEXPORT)
77 #define PETSCSNES_DLLEXPORT
78 #endif
79 #if !defined(PETSCTS_DLLEXPORT)
80 #define PETSCTS_DLLEXPORT
81 #endif
82 #if !defined(PETSCFORTRAN_DLLEXPORT)
83 #define PETSCFORTRAN_DLLEXPORT
84 #endif
85 /* ========================================================================== */
86 
87 /*
88     Defines the interface to MPI allowing the use of all MPI functions.
89 
90     PETSc does not use the C++ binding of MPI at ALL. The following flag
91     makes sure the C++ bindings are not included. The C++ binds REQUIRE
92     putting mpi.h before ANY C++ include files, we cannot control this
93     with all PETSc users.
94 */
95 #define MPICH_SKIP_MPICXX 1
96 #include "mpi.h"
97 /*
98     Yuck, we need to put stdio.h AFTER mpi.h for MPICH2 with C++ compiler
99     see the top of mpicxx.h
100 
101     The MPI STANDARD HAS TO BE CHANGED to prevent this nonsense.
102 */
103 #include <stdio.h>
104 
105 /*
106     All PETSc C functions return this error code, it is the final argument of
107    all Fortran subroutines
108 */
109 
110 /*MC
111     PetscErrorCode - datatype used for return error code from all PETSc functions
112 
113     Level: beginner
114 
115 .seealso: CHKERRQ, SETERRQ
116 M*/
117 typedef int PetscErrorCode;
118 /*MC
119 
120     PetscCookie - A unique id used to identify each PETSc object.
121          (internal integer in the data structure used for error
122          checking). These are all defined by an offset from the lowest
123          one, PETSC_COOKIE.
124 
125     Level: advanced
126 M*/
127 typedef int PetscCookie;
128 /*MC
129     PetscEvent - id used to identify PETSc or user events - primarily for logging
130 
131     Level: intermediate
132 
133 .seealso: PetscLogEventRegister, PetscLogEventBegin PetscLogEventEnd
134 M*/
135 typedef int PetscEvent;
136 /*MC
137     PetscBLASInt - datatype used to represent 'int' parameters to blas functions.
138 
139     Level: intermediate
140 M*/
141 typedef int PetscBLASInt;
142 /*MC
143     PetscMPIInt - datatype used to represent 'int' parameters to MPI functions.
144 
145     Level: intermediate
146 M*/
147 typedef int PetscMPIInt;
148 /*MC
149     PetscEnum - datatype used to pass enum types within PETSc functions.
150 
151     Level: intermediate
152 
153 .seealso: PetscOptionsGetEnum, PetscOptionsEnum, PetscBagRegisterEnum
154 M*/
155 typedef enum { ENUM_DUMMY } PetscEnum;
156 /*MC
157     PetscInt - PETSc type that represents integer - used primarily to
158       represent size of objects. Its size can be configured with the option
159       --with-64-bit-indices - to be either 32bit or 64bit [default 32 bit ints]
160 
161    Level: intermediate
162 
163 .seealso: PetscScalar, VecSetSizes
164 M*/
165 #if defined(PETSC_USE_64BIT_INDICES)
166 typedef long long PetscInt;
167 #define MPIU_INT MPI_LONG_LONG_INT
168 #else
169 typedef int PetscInt;
170 #define MPIU_INT MPI_INT
171 #endif
172 
173 /*
174       You can use PETSC_STDOUT as a replacement of stdout. You can also change
175     the value of PETSC_STDOUT to redirect all standard output elsewhere
176 */
177 extern FILE* PETSC_STDOUT;
178 
179 #if !defined(PETSC_USE_EXTERN_CXX) && defined(__cplusplus)
180 /*MC
181       PetscPolymorphicSubroutine - allows defining a C++ polymorphic version of
182             a PETSc function that remove certain optional arguments for a simplier user interface
183 
184      Not collective
185 
186    Synopsis:
187    PetscPolymorphicSubroutine(Functionname,(arguments of C++ function),(arguments of C function))
188 
189    Level: developer
190 
191     Example:
192       PetscPolymorphicSubroutine(VecNorm,(Vec x,PetscReal *r),(x,NORM_2,r)) generates the new routine
193            PetscErrorCode VecNorm(Vec x,PetscReal *r) = VecNorm(x,NORM_2,r)
194 
195 .seealso: PetscPolymorphicFunction()
196 
197 M*/
198 #define PetscPolymorphicSubroutine(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {return A C;}
199 
200 /*MC
201       PetscPolymorphicScalar - allows defining a C++ polymorphic version of
202             a PETSc function that replaces a PetscScalar * argument with a PetscScalar argument
203 
204      Not collective
205 
206    Synopsis:
207    PetscPolymorphicScalar(Functionname,(arguments of C++ function),(arguments of C function))
208 
209    Level: developer
210 
211     Example:
212       PetscPolymorphicScalar(VecAXPY,(PetscScalar _t,Vec x,Vec y),(&_T,x,y)) generates the new routine
213            PetscErrorCode VecAXPY(PetscScalar _t,Vec x,Vec y) = {PetscScalar _T = _t; return VecAXPY(&_T,x,y);}
214 
215 .seealso: PetscPolymorphicFunction(),PetscPolymorphicSubroutine()
216 
217 M*/
218 #define PetscPolymorphicScalar(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {PetscScalar _T = _t; return A C;}
219 
220 /*MC
221       PetscPolymorphicFunction - allows defining a C++ polymorphic version of
222             a PETSc function that remove certain optional arguments for a simplier user interface
223             and returns the computed value (istead of an error code)
224 
225      Not collective
226 
227    Synopsis:
228    PetscPolymorphicFunction(Functionname,(arguments of C++ function),(arguments of C function),return type,return variable name)
229 
230    Level: developer
231 
232     Example:
233       PetscPolymorphicFunction(VecNorm,(Vec x,NormType t),(x,t,&r),PetscReal,r) generates the new routine
234          PetscReal VecNorm(Vec x,NormType t) = {PetscReal r; VecNorm(x,t,&r); return r;}
235 
236 .seealso: PetscPolymorphicSubroutine()
237 
238 M*/
239 #define PetscPolymorphicFunction(A,B,C,D,E) PETSC_STATIC_INLINE D A B {D E; A C;return E;}
240 
241 #else
242 #define PetscPolymorphicSubroutine(A,B,C)
243 #define PetscPolymorphicScalar(A,B,C)
244 #define PetscPolymorphicFunction(A,B,C,D,E)
245 #endif
246 
247 /*
248     Extern indicates a PETSc function defined elsewhere
249 */
250 #if !defined(EXTERN)
251 #define EXTERN extern
252 #endif
253 
254 /*
255     Defines some elementary mathematics functions and constants.
256 */
257 #include "petscmath.h"
258 
259 /*
260     Declare extern C stuff after incuding external header files
261 */
262 
263 PETSC_EXTERN_CXX_BEGIN
264 
265 /*
266        Basic PETSc constants
267 */
268 
269 /*E
270     PetscTruth - Logical variable. Actually an integer
271 
272    Level: beginner
273 
274 E*/
275 typedef enum { PETSC_FALSE,PETSC_TRUE } PetscTruth;
276 extern const char *PetscTruths[];
277 
278 /*MC
279     PETSC_FALSE - False value of PetscTruth
280 
281     Level: beginner
282 
283     Note: Zero integer
284 
285 .seealso: PetscTruth
286 M*/
287 
288 /*MC
289     PETSC_TRUE - True value of PetscTruth
290 
291     Level: beginner
292 
293     Note: Nonzero integer
294 
295 .seealso: PetscTruth
296 M*/
297 
298 /*MC
299     PETSC_YES - Alias for PETSC_TRUE
300 
301     Level: beginner
302 
303     Note: Zero integer
304 
305 .seealso: PetscTruth
306 M*/
307 #define PETSC_YES            PETSC_TRUE
308 
309 /*MC
310     PETSC_NO - Alias for PETSC_FALSE
311 
312     Level: beginner
313 
314     Note: Nonzero integer
315 
316 .seealso: PetscTruth
317 M*/
318 #define PETSC_NO             PETSC_FALSE
319 
320 /*MC
321     PETSC_NULL - standard way of passing in a null or array or pointer
322 
323    Level: beginner
324 
325    Notes: accepted by many PETSc functions to not set a parameter and instead use
326           some default
327 
328           This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER,
329           PETSC_NULL_DOUBLE_PRECISION etc
330 
331 .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE
332 
333 M*/
334 #define PETSC_NULL           0
335 
336 /*MC
337     PETSC_DECIDE - standard way of passing in integer or floating point parameter
338        where you wish PETSc to use the default.
339 
340    Level: beginner
341 
342 .seealso: PETSC_NULL, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE
343 
344 M*/
345 #define PETSC_DECIDE         -1
346 
347 /*MC
348     PETSC_DEFAULT - standard way of passing in integer or floating point parameter
349        where you wish PETSc to use the default.
350 
351    Level: beginner
352 
353 .seealso: PETSC_DECIDE, PETSC_NULL, PETSC_IGNORE, PETSC_DETERMINE
354 
355 M*/
356 #define PETSC_DEFAULT        -2
357 
358 
359 /*MC
360     PETSC_IGNORE - same as PETSC_NULL, means PETSc will ignore this argument
361 
362    Level: beginner
363 
364    Notes: accepted by many PETSc functions to not set a parameter and instead use
365           some default
366 
367           This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER,
368           PETSC_NULL_DOUBLE_PRECISION etc
369 
370 .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_NULL, PETSC_DETERMINE
371 
372 M*/
373 #define PETSC_IGNORE         PETSC_NULL
374 
375 /*MC
376     PETSC_DETERMINE - standard way of passing in integer or floating point parameter
377        where you wish PETSc to compute the required value.
378 
379    Level: beginner
380 
381 .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_NULL, VecSetSizes()
382 
383 M*/
384 #define PETSC_DETERMINE      PETSC_DECIDE
385 
386 /*MC
387     PETSC_COMM_WORLD - the equivalent of the MPI_COMM_WORLD communicator which represents
388            all the processs that PETSc knows about.
389 
390    Level: beginner
391 
392    Notes: By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unless you wish to
393           run PETSc on ONLY a subset of MPI_COMM_WORLD. In that case create your new (smaller)
394           communicator, call it, say comm, and set PETSC_COMM_WORLD = comm BEFORE calling
395           PetscInitialize()
396 
397 .seealso: PETSC_COMM_SELF
398 
399 M*/
400 extern MPI_Comm PETSC_COMM_WORLD;
401 
402 /*MC
403     PETSC_COMM_SELF - a duplicate of the MPI_COMM_SELF communicator which represents
404            the current process
405 
406    Level: beginner
407 
408    Notes: PETSC_COMM_SELF and MPI_COMM_SELF are equivalent.
409 
410 .seealso: PETSC_COMM_WORLD
411 
412 M*/
413 #define PETSC_COMM_SELF MPI_COMM_SELF
414 
415 extern PETSC_DLLEXPORT PetscTruth PetscInitializeCalled;
416 extern PETSC_DLLEXPORT PetscTruth PetscFinalizeCalled;
417 
418 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetHelpVersionFunctions(PetscErrorCode (*)(MPI_Comm),PetscErrorCode (*)(MPI_Comm));
419 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscCommDuplicate(MPI_Comm,MPI_Comm*,int*);
420 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscCommDestroy(MPI_Comm*);
421 
422 /*MC
423    PetscMalloc - Allocates memory
424 
425    Input Parameter:
426 .  m - number of bytes to allocate
427 
428    Output Parameter:
429 .  result - memory allocated
430 
431    Synopsis:
432    PetscErrorCode PetscMalloc(size_t m,void **result)
433 
434    Level: beginner
435 
436    Notes: Memory is always allocated at least double aligned
437 
438           If you request memory of zero size it will allocate no space and assign the pointer to 0; PetscFree() will
439           properly handle not freeing the null pointer.
440 
441 .seealso: PetscFree(), PetscNew()
442 
443   Concepts: memory allocation
444 
445 M*/
446 #define PetscMalloc(a,b)  ((a != 0) ? (*PetscTrMalloc)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__,(void**)(b)) : (*(b) = 0,0) )
447 
448 /*MC
449    PetscMalloc2 - Allocates 2 chunks of  memory
450 
451    Input Parameter:
452 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
453 .  t1 - type of first memory elements
454 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
455 -  t2 - type of second memory elements
456 
457    Output Parameter:
458 +  r1 - memory allocated in first chunk
459 -  r2 - memory allocated in second chunk
460 
461    Synopsis:
462    PetscErrorCode PetscMalloc2(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2)
463 
464    Level: developer
465 
466    Notes: Memory of first chunk is always allocated at least double aligned
467 
468 .seealso: PetscFree(), PetscNew(), PetscMalloc()
469 
470   Concepts: memory allocation
471 
472 M*/
473 #if defined(PETSC_USE_DEBUG)
474 #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2))
475 #else
476 #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2),r1) || (*(r2) = (t2*)(*(r1)+m1),0))
477 #endif
478 
479 /*MC
480    PetscMalloc3 - Allocates 3 chunks of  memory
481 
482    Input Parameter:
483 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
484 .  t1 - type of first memory elements
485 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
486 .  t2 - type of second memory elements
487 .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
488 -  t3 - type of third memory elements
489 
490    Output Parameter:
491 +  r1 - memory allocated in first chunk
492 .  r2 - memory allocated in second chunk
493 -  r3 - memory allocated in third chunk
494 
495    Synopsis:
496    PetscErrorCode PetscMalloc3(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3)
497 
498    Level: developer
499 
500    Notes: Memory of first chunk is always allocated at least double aligned
501 
502 .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3()
503 
504   Concepts: memory allocation
505 
506 M*/
507 #if defined(PETSC_USE_DEBUG)
508 #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))
509 #else
510 #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))
511 #endif
512 
513 /*MC
514    PetscMalloc4 - Allocates 4 chunks of  memory
515 
516    Input Parameter:
517 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
518 .  t1 - type of first memory elements
519 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
520 .  t2 - type of second memory elements
521 .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
522 .  t3 - type of third memory elements
523 .  m4 - number of elements to allocate in 4th chunk  (may be zero)
524 -  t4 - type of fourth memory elements
525 
526    Output Parameter:
527 +  r1 - memory allocated in first chunk
528 .  r2 - memory allocated in second chunk
529 .  r3 - memory allocated in third chunk
530 -  r4 - memory allocated in fourth chunk
531 
532    Synopsis:
533    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)
534 
535    Level: developer
536 
537    Notes: Memory of first chunk is always allocated at least double aligned
538 
539 .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4()
540 
541   Concepts: memory allocation
542 
543 M*/
544 #if defined(PETSC_USE_DEBUG)
545 #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))
546 #else
547 #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))
548 #endif
549 
550 /*MC
551    PetscMalloc5 - Allocates 5 chunks of  memory
552 
553    Input Parameter:
554 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
555 .  t1 - type of first memory elements
556 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
557 .  t2 - type of second memory elements
558 .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
559 .  t3 - type of third memory elements
560 .  m4 - number of elements to allocate in 4th chunk  (may be zero)
561 .  t4 - type of fourth memory elements
562 .  m5 - number of elements to allocate in 5th chunk  (may be zero)
563 -  t5 - type of fifth memory elements
564 
565    Output Parameter:
566 +  r1 - memory allocated in first chunk
567 .  r2 - memory allocated in second chunk
568 .  r3 - memory allocated in third chunk
569 .  r4 - memory allocated in fourth chunk
570 -  r5 - memory allocated in fifth chunk
571 
572    Synopsis:
573    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)
574 
575    Level: developer
576 
577    Notes: Memory of first chunk is always allocated at least double aligned
578 
579 .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5()
580 
581   Concepts: memory allocation
582 
583 M*/
584 #if defined(PETSC_USE_DEBUG)
585 #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))
586 #else
587 #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))
588 #endif
589 
590 
591 /*MC
592    PetscMalloc6 - Allocates 6 chunks of  memory
593 
594    Input Parameter:
595 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
596 .  t1 - type of first memory elements
597 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
598 .  t2 - type of second memory elements
599 .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
600 .  t3 - type of third memory elements
601 .  m4 - number of elements to allocate in 4th chunk  (may be zero)
602 .  t4 - type of fourth memory elements
603 .  m5 - number of elements to allocate in 5th chunk  (may be zero)
604 .  t5 - type of fifth memory elements
605 .  m6 - number of elements to allocate in 6th chunk  (may be zero)
606 -  t6 - type of sixth memory elements
607 
608    Output Parameter:
609 +  r1 - memory allocated in first chunk
610 .  r2 - memory allocated in second chunk
611 .  r3 - memory allocated in third chunk
612 .  r4 - memory allocated in fourth chunk
613 .  r5 - memory allocated in fifth chunk
614 -  r6 - memory allocated in sixth chunk
615 
616    Synopsis:
617    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)
618 
619    Level: developer
620 
621    Notes: Memory of first chunk is always allocated at least double aligned
622 
623 .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6()
624 
625   Concepts: memory allocation
626 
627 M*/
628 #if defined(PETSC_USE_DEBUG)
629 #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))
630 #else
631 #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))
632 #endif
633 
634 /*MC
635    PetscMalloc7 - Allocates 7 chunks of  memory
636 
637    Input Parameter:
638 +  m1 - number of elements to allocate in 1st chunk  (may be zero)
639 .  t1 - type of first memory elements
640 .  m2 - number of elements to allocate in 2nd chunk  (may be zero)
641 .  t2 - type of second memory elements
642 .  m3 - number of elements to allocate in 3rd chunk  (may be zero)
643 .  t3 - type of third memory elements
644 .  m4 - number of elements to allocate in 4th chunk  (may be zero)
645 .  t4 - type of fourth memory elements
646 .  m5 - number of elements to allocate in 5th chunk  (may be zero)
647 .  t5 - type of fifth memory elements
648 .  m6 - number of elements to allocate in 6th chunk  (may be zero)
649 .  t6 - type of sixth memory elements
650 .  m7 - number of elements to allocate in 7th chunk  (may be zero)
651 -  t7 - type of sixth memory elements
652 
653    Output Parameter:
654 +  r1 - memory allocated in first chunk
655 .  r2 - memory allocated in second chunk
656 .  r3 - memory allocated in third chunk
657 .  r4 - memory allocated in fourth chunk
658 .  r5 - memory allocated in fifth chunk
659 .  r6 - memory allocated in sixth chunk
660 -  r7 - memory allocated in sixth chunk
661 
662    Synopsis:
663    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)
664 
665    Level: developer
666 
667    Notes: Memory of first chunk is always allocated at least double aligned
668 
669 .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6(), PetscFree7()
670 
671   Concepts: memory allocation
672 
673 M*/
674 #if defined(PETSC_USE_DEBUG)
675 #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))
676 #else
677 #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))
678 #endif
679 
680 /*MC
681    PetscNew - Allocates memory of a particular type, Zeros the memory!
682 
683    Input Parameter:
684 . type - structure name of space to be allocated. Memory of size sizeof(type) is allocated
685 
686    Output Parameter:
687 .  result - memory allocated
688 
689    Synopsis:
690    PetscErrorCode PetscNew(struct type,((type *))result)
691 
692    Level: beginner
693 
694 .seealso: PetscFree(), PetscMalloc()
695 
696   Concepts: memory allocation
697 
698 M*/
699 #define PetscNew(A,b)        (PetscMalloc(sizeof(A),(b)) || PetscMemzero(*(b),sizeof(A)))
700 
701 /*MC
702    PetscFree - Frees memory
703 
704    Input Parameter:
705 .   memory - memory to free
706 
707    Synopsis:
708    PetscErrorCode PetscFree(void *memory)
709 
710    Level: beginner
711 
712    Notes: Memory must have been obtained with PetscNew() or PetscMalloc()
713 
714 .seealso: PetscNew(), PetscMalloc()
715 
716   Concepts: memory allocation
717 
718 M*/
719 #define PetscFree(a)   ((a) ? ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__) || ((a = 0),0)) : 0)
720 
721 /*MC
722    PetscFreeVoid - Frees memory
723 
724    Input Parameter:
725 .   memory - memory to free
726 
727    Synopsis:
728    void PetscFreeVoid(void *memory)
729 
730    Level: beginner
731 
732    Notes: This is different from PetscFree() in that no error code is returned
733 
734 .seealso: PetscFree(), PetscNew(), PetscMalloc()
735 
736   Concepts: memory allocation
737 
738 M*/
739 #define PetscFreeVoid(a) ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__),(a) = 0)
740 
741 
742 /*MC
743    PetscFree2 - Frees 2 chunks of memory obtained with PetscMalloc2()
744 
745    Input Parameter:
746 +   memory1 - memory to free
747 -   memory2 - 2nd memory to free
748 
749 
750    Synopsis:
751    PetscErrorCode PetscFree2(void *memory1,void *memory2)
752 
753    Level: developer
754 
755    Notes: Memory must have been obtained with PetscMalloc2()
756 
757 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree()
758 
759   Concepts: memory allocation
760 
761 M*/
762 #if defined(PETSC_USE_DEBUG)
763 #define PetscFree2(m1,m2)   (PetscFree(m2) || PetscFree(m1))
764 #else
765 #define PetscFree2(m1,m2)   (PetscFree(m1))
766 #endif
767 
768 /*MC
769    PetscFree3 - Frees 3 chunks of memory obtained with PetscMalloc3()
770 
771    Input Parameter:
772 +   memory1 - memory to free
773 .   memory2 - 2nd memory to free
774 -   memory3 - 3rd memory to free
775 
776 
777    Synopsis:
778    PetscErrorCode PetscFree3(void *memory1,void *memory2,void *memory3)
779 
780    Level: developer
781 
782    Notes: Memory must have been obtained with PetscMalloc3()
783 
784 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3()
785 
786   Concepts: memory allocation
787 
788 M*/
789 #if defined(PETSC_USE_DEBUG)
790 #define PetscFree3(m1,m2,m3)   (PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
791 #else
792 #define PetscFree3(m1,m2,m3)   (PetscFree(m1))
793 #endif
794 
795 /*MC
796    PetscFree4 - Frees 4 chunks of memory obtained with PetscMalloc4()
797 
798    Input Parameter:
799 +   m1 - memory to free
800 .   m2 - 2nd memory to free
801 .   m3 - 3rd memory to free
802 -   m4 - 4th memory to free
803 
804 
805    Synopsis:
806    PetscErrorCode PetscFree4(void *m1,void *m2,void *m3,void *m4)
807 
808    Level: developer
809 
810    Notes: Memory must have been obtained with PetscMalloc4()
811 
812 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4()
813 
814   Concepts: memory allocation
815 
816 M*/
817 #if defined(PETSC_USE_DEBUG)
818 #define PetscFree4(m1,m2,m3,m4)   (PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
819 #else
820 #define PetscFree4(m1,m2,m3,m4)   (PetscFree(m1))
821 #endif
822 
823 /*MC
824    PetscFree5 - Frees 5 chunks of memory obtained with PetscMalloc5()
825 
826    Input Parameter:
827 +   m1 - memory to free
828 .   m2 - 2nd memory to free
829 .   m3 - 3rd memory to free
830 .   m4 - 4th memory to free
831 -   m5 - 5th memory to free
832 
833 
834    Synopsis:
835    PetscErrorCode PetscFree5(void *m1,void *m2,void *m3,void *m4,void *m5)
836 
837    Level: developer
838 
839    Notes: Memory must have been obtained with PetscMalloc5()
840 
841 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5()
842 
843   Concepts: memory allocation
844 
845 M*/
846 #if defined(PETSC_USE_DEBUG)
847 #define PetscFree5(m1,m2,m3,m4,m5)   (PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
848 #else
849 #define PetscFree5(m1,m2,m3,m4,m5)   (PetscFree(m1))
850 #endif
851 
852 
853 /*MC
854    PetscFree6 - Frees 6 chunks of memory obtained with PetscMalloc6()
855 
856    Input Parameter:
857 +   m1 - memory to free
858 .   m2 - 2nd memory to free
859 .   m3 - 3rd memory to free
860 .   m4 - 4th memory to free
861 .   m5 - 5th memory to free
862 -   m6 - 6th memory to free
863 
864 
865    Synopsis:
866    PetscErrorCode PetscFree6(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6)
867 
868    Level: developer
869 
870    Notes: Memory must have been obtained with PetscMalloc6()
871 
872 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6()
873 
874   Concepts: memory allocation
875 
876 M*/
877 #if defined(PETSC_USE_DEBUG)
878 #define PetscFree6(m1,m2,m3,m4,m5,m6)   (PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
879 #else
880 #define PetscFree6(m1,m2,m3,m4,m5,m6)   (PetscFree(m1))
881 #endif
882 
883 /*MC
884    PetscFree7 - Frees 7 chunks of memory obtained with PetscMalloc7()
885 
886    Input Parameter:
887 +   m1 - memory to free
888 .   m2 - 2nd memory to free
889 .   m3 - 3rd memory to free
890 .   m4 - 4th memory to free
891 .   m5 - 5th memory to free
892 .   m6 - 6th memory to free
893 -   m7 - 7th memory to free
894 
895 
896    Synopsis:
897    PetscErrorCode PetscFree7(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6,void *m7)
898 
899    Level: developer
900 
901    Notes: Memory must have been obtained with PetscMalloc6()
902 
903 .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6(),
904           PetscMalloc7()
905 
906   Concepts: memory allocation
907 
908 M*/
909 #if defined(PETSC_USE_DEBUG)
910 #define PetscFree7(m1,m2,m3,m4,m5,m6,m7)   (PetscFree(m7) || PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
911 #else
912 #define PetscFree7(m1,m2,m3,m4,m5,m6,m7)   (PetscFree(m1))
913 #endif
914 
915 EXTERN PETSC_DLLEXPORT PetscErrorCode (*PetscTrMalloc)(size_t,int,const char[],const char[],const char[],void**);
916 EXTERN PETSC_DLLEXPORT PetscErrorCode (*PetscTrFree)(void*,int,const char[],const char[],const char[]);
917 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscSetMalloc(PetscErrorCode (*)(size_t,int,const char[],const char[],const char[],void**),PetscErrorCode (*)(void*,int,const char[],const char[],const char[]));
918 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscClearMalloc(void);
919 
920 /*
921    Routines for tracing memory corruption/bleeding with default PETSc
922    memory allocation
923 */
924 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocDump(FILE *);
925 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocDumpLog(FILE *);
926 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocGetCurrentUsage(PetscLogDouble *);
927 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocGetMaximumUsage(PetscLogDouble *);
928 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocDebug(PetscTruth);
929 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocValidate(int,const char[],const char[],const char[]);
930 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMallocSetDumpLog(void);
931 
932 
933 /*
934     Variable type where we stash PETSc object pointers in Fortran.
935     Assumes that sizeof(long) == sizeof(void*)which is true on
936     all machines that we know.
937 */
938 #define PetscFortranAddr   long
939 
940 /*E
941     PetscDataType - Used for handling different basic data types.
942 
943    Level: beginner
944 
945 .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(),
946           PetscDataTypeGetSize()
947 
948 E*/
949 typedef enum {PETSC_INT = 0,PETSC_DOUBLE = 1,PETSC_COMPLEX = 2,
950               PETSC_LONG = 3 ,PETSC_SHORT = 4,PETSC_FLOAT = 5,
951               PETSC_CHAR = 6,PETSC_LOGICAL = 7,PETSC_ENUM = 8,PETSC_TRUTH=9} PetscDataType;
952 extern const char *PetscDataTypes[];
953 
954 #if defined(PETSC_USE_COMPLEX)
955 #define PETSC_SCALAR PETSC_COMPLEX
956 #else
957 #if defined(PETSC_USE_SINGLE)
958 #define PETSC_SCALAR PETSC_FLOAT
959 #else
960 #define PETSC_SCALAR PETSC_DOUBLE
961 #endif
962 #endif
963 #if defined(PETSC_USE_SINGLE)
964 #define PETSC_REAL PETSC_FLOAT
965 #else
966 #define PETSC_REAL PETSC_DOUBLE
967 #endif
968 #define PETSC_FORTRANADDR PETSC_LONG
969 
970 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*);
971 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDataTypeGetSize(PetscDataType,PetscInt*);
972 
973 /*
974     Basic memory and string operations. These are usually simple wrappers
975    around the basic Unix system calls, but a few of them have additional
976    functionality and/or error checking.
977 */
978 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMemcpy(void*,const void *,size_t);
979 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscBitMemcpy(void*,PetscInt,const void*,PetscInt,PetscInt,PetscDataType);
980 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMemmove(void*,void *,size_t);
981 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMemzero(void*,size_t);
982 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscMemcmp(const void*,const void*,size_t,PetscTruth *);
983 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrlen(const char[],size_t*);
984 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrcmp(const char[],const char[],PetscTruth *);
985 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrgrt(const char[],const char[],PetscTruth *);
986 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrcasecmp(const char[],const char[],PetscTruth*);
987 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrncmp(const char[],const char[],size_t,PetscTruth*);
988 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrcpy(char[],const char[]);
989 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrcat(char[],const char[]);
990 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrncat(char[],const char[],size_t);
991 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrncpy(char[],const char[],size_t);
992 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrchr(const char[],char,char *[]);
993 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrtolower(char[]);
994 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrrchr(const char[],char,char *[]);
995 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrstr(const char[],const char[],char *[]);
996 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrrstr(const char[],const char[],char *[]);
997 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrallocpy(const char[],char *[]);
998 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscStrreplace(MPI_Comm,const char[],char[],size_t);
999 #define      PetscStrfree(a) ((a) ? PetscFree(a) : 0)
1000 /*S
1001     PetscToken - 'Token' used for managing tokenizing strings
1002 
1003   Level: intermediate
1004 
1005 .seealso: PetscTokenCreate(), PetscTokenFind(), PetscTokenDestroy()
1006 S*/
1007 typedef struct {char token;char *array;char *current;} PetscToken;
1008 
1009 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscTokenCreate(const char[],const char,PetscToken**);
1010 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscTokenFind(PetscToken*,char *[]);
1011 EXTERN PetscErrorCode PETSC_DLLEXPORT   PetscTokenDestroy(PetscToken*);
1012 
1013 /*
1014    These are  MPI operations for MPI_Allreduce() etc
1015 */
1016 EXTERN PETSC_DLLEXPORT MPI_Op PetscMaxSum_Op;
1017 #if defined(PETSC_USE_COMPLEX)
1018 EXTERN PETSC_DLLEXPORT MPI_Op PetscSum_Op;
1019 #else
1020 #define PetscSum_Op MPI_SUM
1021 #endif
1022 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMaxSum(MPI_Comm,const PetscInt[],PetscInt*,PetscInt*);
1023 
1024 /*S
1025      PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc
1026 
1027    Level: beginner
1028 
1029    Note: This is the base class from which all objects appear.
1030 
1031 .seealso:  PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName()
1032 S*/
1033 typedef struct _p_PetscObject* PetscObject;
1034 
1035 /*S
1036      PetscFList - Linked list of functions, possibly stored in dynamic libraries, accessed
1037       by string name
1038 
1039    Level: advanced
1040 
1041 .seealso:  PetscFListAdd(), PetscFListDestroy()
1042 S*/
1043 typedef struct _n_PetscFList *PetscFList;
1044 
1045 /*E
1046   PetscFileMode - Access mode for a file.
1047 
1048   Level: beginner
1049 
1050   FILE_MODE_READ - open a file at its beginning for reading
1051 
1052   FILE_MODE_WRITE - open a file at its beginning for writing (will create if the file does not exist)
1053 
1054   FILE_MODE_APPEND - open a file at end for writing
1055 
1056   FILE_MODE_UPDATE - open a file for updating, meaning for reading and writing
1057 
1058   FILE_MODE_APPEND_UPDATE - open a file for updating, meaning for reading and writing, at the end
1059 
1060 .seealso: PetscViewerFileSetMode()
1061 E*/
1062 typedef enum {FILE_MODE_READ, FILE_MODE_WRITE, FILE_MODE_APPEND, FILE_MODE_UPDATE, FILE_MODE_APPEND_UPDATE} PetscFileMode;
1063 
1064 #include "petscviewer.h"
1065 #include "petscoptions.h"
1066 
1067 #if defined (PETSC_USE_LOG)
1068 #define PETSC_COOKIE 1211211
1069 #else
1070 #define PETSC_COOKIE 0
1071 #endif
1072 extern PETSC_DLLEXPORT PetscCookie PETSC_LARGEST_COOKIE;
1073 extern PETSC_DLLEXPORT PetscCookie PETSC_OBJECT_COOKIE;
1074 
1075 /*
1076    Routines that get memory usage information from the OS
1077 */
1078 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMemoryGetCurrentUsage(PetscLogDouble *);
1079 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMemoryGetMaximumUsage(PetscLogDouble *);
1080 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMemorySetGetMaximumUsage(void);
1081 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMemoryShowUsage(PetscViewer,const char[]);
1082 
1083 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscVerboseInfoAllow(PetscTruth,const char []);
1084 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetTime(PetscLogDouble*);
1085 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetCPUTime(PetscLogDouble*);
1086 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSleep(int);
1087 
1088 /*
1089     Initialization of PETSc
1090 */
1091 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInitialize(int*,char***,const char[],const char[]);
1092 PetscPolymorphicSubroutine(PetscInitialize,(int *argc,char ***args),(argc,args,PETSC_NULL,PETSC_NULL))
1093 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInitializeNoArguments(void);
1094 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInitialized(PetscTruth *);
1095 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFinalized(PetscTruth *);
1096 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFinalize(void);
1097 EXTERN PetscErrorCode PetscInitializeFortran(void);
1098 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetArgs(int*,char ***);
1099 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscEnd(void);
1100 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscInitializePackage(char *);
1101 typedef void (**PetscVoidFunction)(void);
1102 
1103 /*
1104    PetscTryMethod - Queries an object for a method, if it exists then calls it.
1105               These are intended to be used only inside PETSc functions.
1106 */
1107 #define  PetscTryMethod(obj,A,B,C) \
1108   0;{ PetscErrorCode (*f)B, __ierr; \
1109     __ierr = PetscObjectQueryFunction((PetscObject)obj,#A,(PetscVoidFunction)&f);CHKERRQ(__ierr); \
1110     if (f) {__ierr = (*f)C;CHKERRQ(__ierr);}\
1111   }
1112 #define  PetscUseMethod(obj,A,B,C) \
1113   0;{ PetscErrorCode (*f)B, __ierr; \
1114     __ierr = PetscObjectQueryFunction((PetscObject)obj,A,(PetscVoidFunction)&f);CHKERRQ(__ierr); \
1115     if (f) {__ierr = (*f)C;CHKERRQ(__ierr);}\
1116     else {SETERRQ1(PETSC_ERR_SUP,"Cannot locate function %s in object",A);} \
1117   }
1118 /*
1119     Functions that can act on any PETSc object.
1120 */
1121 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectCreate(MPI_Comm,PetscObject*);
1122 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectDestroy(PetscObject);
1123 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectExists(PetscObject,PetscTruth*);
1124 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetComm(PetscObject,MPI_Comm *);
1125 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetCookie(PetscObject,int *);
1126 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectSetType(PetscObject,const char []);
1127 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetType(PetscObject,const char *[]);
1128 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectSetName(PetscObject,const char[]);
1129 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetName(PetscObject,const char*[]);
1130 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectReference(PetscObject);
1131 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetReference(PetscObject,PetscInt*);
1132 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectDereference(PetscObject);
1133 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetNewTag(PetscObject,PetscMPIInt *);
1134 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscCommGetNewTag(MPI_Comm,PetscMPIInt *);
1135 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectView(PetscObject,PetscViewer);
1136 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectCompose(PetscObject,const char[],PetscObject);
1137 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectQuery(PetscObject,const char[],PetscObject *);
1138 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectComposeFunction(PetscObject,const char[],const char[],void (*)(void));
1139 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectSetFromOptions(PetscObject);
1140 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectSetUp(PetscObject);
1141 
1142 typedef void (*FCNVOID)(void); /* cast in next macro should never be extern C */
1143 typedef PetscErrorCode (*FCNINTVOID)(void); /* used in casts to make sure they are not extern C */
1144 /*MC
1145    PetscObjectComposeFunctionDynamic - Associates a function with a given PETSc object.
1146 
1147    Collective on PetscObject
1148 
1149    Input Parameters:
1150 +  obj - the PETSc object; this must be cast with a (PetscObject), for example,
1151          PetscObjectCompose((PetscObject)mat,...);
1152 .  name - name associated with the child function
1153 .  fname - name of the function
1154 -  ptr - function pointer (or PETSC_NULL if using dynamic libraries)
1155 
1156    Level: advanced
1157 
1158     Synopsis:
1159     PetscErrorCode PetscObjectComposeFunctionDynamic(PetscObject obj,const char name[],const char fname[],void *ptr)
1160 
1161    Notes:
1162    To remove a registered routine, pass in a PETSC_NULL rname and fnc().
1163 
1164    PetscObjectComposeFunctionDynamic() can be used with any PETSc object (such as
1165    Mat, Vec, KSP, SNES, etc.) or any user-provided object.
1166 
1167    The composed function must be wrapped in a EXTERN_C_BEGIN/END for this to
1168    work in C++/complex with dynamic link libraries (PETSC_USE_DYNAMIC_LIBRARIES)
1169    enabled.
1170 
1171    Concepts: objects^composing functions
1172    Concepts: composing functions
1173    Concepts: functions^querying
1174    Concepts: objects^querying
1175    Concepts: querying objects
1176 
1177 .seealso: PetscObjectQueryFunction()
1178 M*/
1179 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1180 #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,0)
1181 #else
1182 #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,(FCNVOID)(d))
1183 #endif
1184 
1185 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectQueryFunction(PetscObject,const char[],void (**)(void));
1186 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectSetOptionsPrefix(PetscObject,const char[]);
1187 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectAppendOptionsPrefix(PetscObject,const char[]);
1188 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectPrependOptionsPrefix(PetscObject,const char[]);
1189 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectGetOptionsPrefix(PetscObject,const char*[]);
1190 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectPublish(PetscObject);
1191 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectChangeTypeName(PetscObject,const char[]);
1192 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectRegisterDestroy(PetscObject);
1193 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectRegisterDestroyAll(void);
1194 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectName(PetscObject);
1195 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscTypeCompare(PetscObject,const char[],PetscTruth*);
1196 
1197 /*
1198     Defines PETSc error handling.
1199 */
1200 #include "petscerror.h"
1201 
1202 /*S
1203      PetscOList - Linked list of PETSc objects, accessable by string name
1204 
1205    Level: advanced
1206 
1207 .seealso:  PetscOListAdd(), PetscOListDestroy(), PetscOListFind()
1208 S*/
1209 typedef struct _n_PetscOList *PetscOList;
1210 
1211 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOListDestroy(PetscOList *);
1212 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOListFind(PetscOList,const char[],PetscObject*);
1213 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOListReverseFind(PetscOList,PetscObject,char**);
1214 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOListAdd(PetscOList *,const char[],PetscObject);
1215 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscOListDuplicate(PetscOList,PetscOList *);
1216 
1217 /*
1218     Dynamic library lists. Lists of names of routines in dynamic
1219   link libraries that will be loaded as needed.
1220 */
1221 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListAdd(PetscFList*,const char[],const char[],void (*)(void));
1222 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListDestroy(PetscFList*);
1223 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListFind(MPI_Comm,PetscFList,const char[],void (**)(void));
1224 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListPrintTypes(MPI_Comm,FILE*,const char[],const char[],const char[],const char[],PetscFList);
1225 #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1226 #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,0)
1227 #else
1228 #define    PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,(void (*)(void))c)
1229 #endif
1230 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListDuplicate(PetscFList,PetscFList *);
1231 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListView(PetscFList,PetscViewer);
1232 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListConcat(const char [],const char [],char []);
1233 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFListGet(PetscFList,char ***,int*);
1234 
1235 /*S
1236      PetscDLLibraryList - Linked list of dynamics libraries to search for functions
1237 
1238    Level: advanced
1239 
1240    PETSC_USE_DYNAMIC_LIBRARIES must be defined in petscconf.h to use dynamic libraries
1241 
1242 .seealso:  PetscDLLibraryOpen()
1243 S*/
1244 typedef struct _n_PetscDLLibraryList *PetscDLLibraryList;
1245 extern PetscDLLibraryList DLLibrariesLoaded;
1246 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryRetrieve(MPI_Comm,const char[],char *,int,PetscTruth *);
1247 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryOpen(MPI_Comm,const char[],void **);
1248 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibrarySym(MPI_Comm,PetscDLLibraryList *,const char[],const char[],void **);
1249 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryAppend(MPI_Comm,PetscDLLibraryList *,const char[]);
1250 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryPrepend(MPI_Comm,PetscDLLibraryList *,const char[]);
1251 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryClose(PetscDLLibraryList);
1252 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryPrintPath(void);
1253 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscDLLibraryGetInfo(void*,const char[],const char *[]);
1254 
1255 /*
1256     Mechanism for translating PETSc object representations between languages
1257     Not currently used.
1258 */
1259 typedef enum {PETSC_LANGUAGE_C,PETSC_LANGUAGE_CXX} PetscLanguage;
1260 #define PETSC_LANGUAGE_F77 PETSC_LANGUAGE_C
1261 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectComposeLanguage(PetscObject,PetscLanguage,void *);
1262 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectQueryLanguage(PetscObject,PetscLanguage,void **);
1263 
1264 /*
1265      Useful utility routines
1266 */
1267 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSplitOwnership(MPI_Comm,PetscInt*,PetscInt*);
1268 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSplitOwnershipBlock(MPI_Comm,PetscInt,PetscInt*,PetscInt*);
1269 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSequentialPhaseBegin(MPI_Comm,PetscMPIInt);
1270 PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(MPI_Comm comm),(comm,1))
1271 PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(void),(PETSC_COMM_WORLD,1))
1272 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSequentialPhaseEnd(MPI_Comm,PetscMPIInt);
1273 PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(MPI_Comm comm),(comm,1))
1274 PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(void),(PETSC_COMM_WORLD,1))
1275 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBarrier(PetscObject);
1276 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscMPIDump(FILE*);
1277 
1278 #define PetscNot(a) ((a) ? PETSC_FALSE : PETSC_TRUE)
1279 /*
1280     Defines basic graphics available from PETSc.
1281 */
1282 #include "petscdraw.h"
1283 
1284 /*
1285     Defines the base data structures for all PETSc objects
1286 */
1287 PETSC_EXTERN_CXX_END
1288 #include "private/petscimpl.h"
1289 PETSC_EXTERN_CXX_BEGIN
1290 /*
1291      Defines PETSc profiling.
1292 */
1293 #include "petsclog.h"
1294 
1295 /*
1296           For locking, unlocking and destroying AMS memories associated with
1297     PETSc objects. Not currently used.
1298 */
1299 #define PetscPublishAll(v)           0
1300 #define PetscObjectTakeAccess(obj)   0
1301 #define PetscObjectGrantAccess(obj)  0
1302 #define PetscObjectDepublish(obj)    0
1303 
1304 
1305 
1306 /*
1307       This code allows one to pass a MPI communicator between
1308     C and Fortran. MPI 2.0 defines a standard API for doing this.
1309     The code here is provided to allow PETSc to work with MPI 1.1
1310     standard MPI libraries.
1311 */
1312 EXTERN PetscErrorCode MPICCommToFortranComm(MPI_Comm,int *);
1313 EXTERN PetscErrorCode MPIFortranCommToCComm(int,MPI_Comm*);
1314 
1315 /*
1316       Simple PETSc parallel IO for ASCII printing
1317 */
1318 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscFixFilename(const char[],char[]);
1319 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscFOpen(MPI_Comm,const char[],const char[],FILE**);
1320 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscFClose(MPI_Comm,FILE*);
1321 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1322 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscPrintf(MPI_Comm,const char[],...)  PETSC_PRINTF_FORMAT_CHECK(2,3);
1323 
1324 /* These are used internally by PETSc ASCII IO routines*/
1325 #include <stdarg.h>
1326 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscVSNPrintf(char*,size_t,const char*,va_list);
1327 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscVFPrintf(FILE*,const char*,va_list);
1328 
1329 /*MC
1330     PetscErrorPrintf - Prints error messages.
1331 
1332     Not Collective
1333 
1334    Synopsis:
1335      PetscErrorCode (*PetscErrorPrintf)(const char format[],...);
1336 
1337     Input Parameters:
1338 .   format - the usual printf() format string
1339 
1340    Options Database Keys:
1341 .    -error_output_stderr - cause error messages to be printed to stderr instead of the
1342          (default) stdout
1343 
1344 
1345    Level: developer
1346 
1347     Fortran Note:
1348     This routine is not supported in Fortran.
1349 
1350     Concepts: error messages^printing
1351     Concepts: printing^error messages
1352 
1353 .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscHelpPrintf()
1354 M*/
1355 EXTERN PETSC_DLLEXPORT PetscErrorCode (*PetscErrorPrintf)(const char[],...);
1356 
1357 /*MC
1358     PetscHelpPrintf - Prints help messages.
1359 
1360     Not Collective
1361 
1362    Synopsis:
1363      PetscErrorCode (*PetscHelpPrintf)(const char format[],...);
1364 
1365     Input Parameters:
1366 .   format - the usual printf() format string
1367 
1368    Level: developer
1369 
1370     Fortran Note:
1371     This routine is not supported in Fortran.
1372 
1373     Concepts: help messages^printing
1374     Concepts: printing^help messages
1375 
1376 .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscErrorPrintf()
1377 M*/
1378 EXTERN PETSC_DLLEXPORT PetscErrorCode  (*PetscHelpPrintf)(MPI_Comm,const char[],...);
1379 
1380 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscPOpen(MPI_Comm,const char[],const char[],const char[],FILE **);
1381 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscPClose(MPI_Comm,FILE*);
1382 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscSynchronizedPrintf(MPI_Comm,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
1383 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscSynchronizedFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1384 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscSynchronizedFlush(MPI_Comm);
1385 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscSynchronizedFGets(MPI_Comm,FILE*,size_t,char[]);
1386 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscStartMatlab(MPI_Comm,const char[],const char[],FILE**);
1387 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscStartJava(MPI_Comm,const char[],const char[],FILE**);
1388 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscGetPetscDir(const char*[]);
1389 
1390 EXTERN PetscErrorCode PETSC_DLLEXPORT  PetscPopUpSelect(MPI_Comm,char*,char*,int,char**,int*);
1391 /*S
1392      PetscObjectContainer - Simple PETSc object that contains a pointer to any required data
1393 
1394    Level: advanced
1395 
1396 .seealso:  PetscObject, PetscObjectContainerCreate()
1397 S*/
1398 typedef struct _p_PetscObjectContainer*  PetscObjectContainer;
1399 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectContainerGetPointer(PetscObjectContainer,void **);
1400 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectContainerSetPointer(PetscObjectContainer,void *);
1401 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectContainerDestroy(PetscObjectContainer);
1402 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectContainerCreate(MPI_Comm comm,PetscObjectContainer *);
1403 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscObjectContainerSetUserDestroy(PetscObjectContainer, PetscErrorCode (*)(void*));
1404 
1405 /*
1406    For use in debuggers
1407 */
1408 extern PETSC_DLLEXPORT PetscMPIInt PetscGlobalRank;
1409 extern PETSC_DLLEXPORT PetscMPIInt PetscGlobalSize;
1410 
1411 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscIntView(PetscInt,PetscInt[],PetscViewer);
1412 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRealView(PetscInt,PetscReal[],PetscViewer);
1413 EXTERN PetscErrorCode PETSC_DLLEXPORT PetscScalarView(PetscInt,PetscScalar[],PetscViewer);
1414 
1415 /*
1416     Allows accessing Matlab Engine
1417 */
1418 #include "petscmatlab.h"
1419 
1420 /*
1421       Determine if some of the kernel computation routines use
1422    Fortran (rather than C) for the numerical calculations. On some machines
1423    and compilers (like complex numbers) the Fortran version of the routines
1424    is faster than the C/C++ versions. The flag PETSC_USE_FORTRAN_KERNELS
1425    would be set in the petscconf.h file
1426 */
1427 #if defined(PETSC_USE_FORTRAN_KERNELS)
1428 
1429 #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCRL)
1430 #define PETSC_USE_FORTRAN_KERNEL_MULTCRL
1431 #endif
1432 
1433 #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM)
1434 #define PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM
1435 #endif
1436 
1437 #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1438 #define PETSC_USE_FORTRAN_KERNEL_MULTAIJ
1439 #endif
1440 
1441 #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1442 #define PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ
1443 #endif
1444 
1445 #if !defined(PETSC_USE_FORTRAN_KERNEL_NORM)
1446 #define PETSC_USE_FORTRAN_KERNEL_NORM
1447 #endif
1448 
1449 #if !defined(PETSC_USE_FORTRAN_KERNEL_MAXPY)
1450 #define PETSC_USE_FORTRAN_KERNEL_MAXPY
1451 #endif
1452 
1453 #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ)
1454 #define PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ
1455 #endif
1456 
1457 #if !defined(PETSC_USE_FORTRAN_KERNEL_RELAXAIJ)
1458 #define PETSC_USE_FORTRAN_KERNEL_RELAXAIJ
1459 #endif
1460 
1461 #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ)
1462 #define PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ
1463 #endif
1464 
1465 #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1466 #define PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ
1467 #endif
1468 
1469 #if !defined(PETSC_USE_FORTRAN_KERNEL_MDOT)
1470 #define PETSC_USE_FORTRAN_KERNEL_MDOT
1471 #endif
1472 
1473 #if !defined(PETSC_USE_FORTRAN_KERNEL_XTIMESY)
1474 #define PETSC_USE_FORTRAN_KERNEL_XTIMESY
1475 #endif
1476 
1477 #if !defined(PETSC_USE_FORTRAN_KERNEL_AYPX)
1478 #define PETSC_USE_FORTRAN_KERNEL_AYPX
1479 #endif
1480 
1481 #if !defined(PETSC_USE_FORTRAN_KERNEL_WAXPY)
1482 #define PETSC_USE_FORTRAN_KERNEL_WAXPY
1483 #endif
1484 
1485 #endif
1486 
1487 /*
1488     Macros for indicating code that should be compiled with a C interface,
1489    rather than a C++ interface. Any routines that are dynamically loaded
1490    (such as the PCCreate_XXX() routines) must be wrapped so that the name
1491    mangler does not change the functions symbol name. This just hides the
1492    ugly extern "C" {} wrappers.
1493 */
1494 #if defined(__cplusplus)
1495 #define EXTERN_C_BEGIN extern "C" {
1496 #define EXTERN_C_END }
1497 #else
1498 #define EXTERN_C_BEGIN
1499 #define EXTERN_C_END
1500 #endif
1501 
1502 /* --------------------------------------------------------------------*/
1503 
1504 /*MC
1505     size - integer variable used to contain the number of processors in
1506            the relevent MPI_Comm
1507 
1508    Level: beginner
1509 
1510 .seealso: rank, comm
1511 M*/
1512 
1513 /*MC
1514     rank - integer variable used to contain the number of this processor relative
1515            to all in the relevent MPI_Comm
1516 
1517    Level: beginner
1518 
1519 .seealso: size, comm
1520 M*/
1521 
1522 /*MC
1523     comm - MPI_Comm used in the current routine or object
1524 
1525    Level: beginner
1526 
1527 .seealso: size, rank
1528 M*/
1529 
1530 /*MC
1531     MPI_Comm - the basic object used by MPI to determine which processes are involved in a
1532         communication
1533 
1534    Level: beginner
1535 
1536    Note: This manual page is a place-holder because MPICH does not have a manual page for MPI_Comm
1537 
1538 .seealso: size, rank, comm, PETSC_COMM_WORLD, PETSC_COMM_SELF
1539 M*/
1540 
1541 /*MC
1542     PetscScalar - PETSc type that represents either a double precision real number or
1543        a double precision complex number if the code is configured with --with-scalar-type=complex
1544 
1545    Level: beginner
1546 
1547 .seealso: PetscReal, PassiveReal, PassiveScalar
1548 M*/
1549 
1550 /*MC
1551     PetscReal - PETSc type that represents a double precision real number
1552 
1553    Level: beginner
1554 
1555 .seealso: PetscScalar, PassiveReal, PassiveScalar
1556 M*/
1557 
1558 /*MC
1559     PassiveScalar - PETSc type that represents either a double precision real number or
1560        a double precision complex number if the code is  code is configured with --with-scalar-type=complex
1561 
1562    Level: beginner
1563 
1564     This is the same as a PetscScalar except in code that is automatically differentiated it is
1565    treated as a constant (not an indendent or dependent variable)
1566 
1567 .seealso: PetscReal, PassiveReal, PetscScalar
1568 M*/
1569 
1570 /*MC
1571     PassiveReal - PETSc type that represents a double precision real number
1572 
1573    Level: beginner
1574 
1575     This is the same as a PetscReal except in code that is automatically differentiated it is
1576    treated as a constant (not an indendent or dependent variable)
1577 
1578 .seealso: PetscScalar, PetscReal, PassiveScalar
1579 M*/
1580 
1581 /*MC
1582     MPIU_SCALAR - MPI datatype corresponding to PetscScalar
1583 
1584    Level: beginner
1585 
1586     Note: In MPI calls that require an MPI datatype that matches a PetscScalar or array of PetscScalars
1587           pass this value
1588 
1589 .seealso: PetscReal, PassiveReal, PassiveScalar, PetscScalar
1590 M*/
1591 
1592 /*
1593      The IBM include files define hz, here we hide it so that it may be used
1594    as a regular user variable.
1595 */
1596 #if defined(hz)
1597 #undef hz
1598 #endif
1599 
1600 /*  For arrays that contain filenames or paths */
1601 
1602 
1603 #if defined(PETSC_HAVE_LIMITS_H)
1604 #include <limits.h>
1605 #endif
1606 #if defined(PETSC_HAVE_SYS_PARAM_H)
1607 #include <sys/param.h>
1608 #endif
1609 #if defined(PETSC_HAVE_SYS_TYPES_H)
1610 #include <sys/types.h>
1611 #endif
1612 #if defined(MAXPATHLEN)
1613 #  define PETSC_MAX_PATH_LEN     MAXPATHLEN
1614 #elif defined(MAX_PATH)
1615 #  define PETSC_MAX_PATH_LEN     MAX_PATH
1616 #elif defined(_MAX_PATH)
1617 #  define PETSC_MAX_PATH_LEN     _MAX_PATH
1618 #else
1619 #  define PETSC_MAX_PATH_LEN     4096
1620 #endif
1621 
1622 PETSC_EXTERN_CXX_END
1623 #endif
1624 
1625 
1626