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