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