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