Actual source code: petsc.h
1: /*
2: This is the main PETSc include file (for C and C++). It is included by all
3: other PETSc include files, so it almost never has to be specifically included.
4: */
7: /* ========================================================================== */
8: /*
9: petscconf.h is contained in ${PETSC_ARCH}/conf/petscconf.h it is
10: found automatically by the compiler due to the -I${PETSC_DIR}/${PETSC_ARCH}/include
11: in the bmake/common/variables definition of PETSC_INCLUDE
12: */
13: #include "petscconf.h"
15: /* ========================================================================== */
16: /*
17: This facilitates using C version of PETSc from C++ and
18: C++ version from C. Use --with-c-support --with-clanguage=c++ with config/configure.py for the latter)
19: */
21: #error "PETSc configured with --with-clanguage=c++ and NOT --with-c-support - it can be used only with a C++ compiler"
22: #endif
27: #else
30: #endif
31: /* ========================================================================== */
32: /*
33: Current PETSc version number and release date. Also listed in
34: Web page
35: src/docs/tex/manual/intro.tex,
36: src/docs/tex/manual/manual.tex.
37: src/docs/website/index.html.
38: */
39: #include petscversion.h
40: #define PETSC_AUTHOR_INFO "\
41: The PETSc Team\n\
42: petsc-maint@mcs.anl.gov\n\
43: http://www.mcs.anl.gov/petsc/\n"
44: #if (PETSC_VERSION_RELEASE == 1)
45: #define PetscGetVersion(version,len) (PetscSNPrintf(*(version),len,"Petsc Release Version %d.%d.%d, Patch %d, ", \
46: PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, \
47: PETSC_VERSION_PATCH),PetscStrcat(*(version),PETSC_VERSION_PATCH_DATE), \
48: PetscStrcat(*(version)," HG revision: "),PetscStrcat(*(version),PETSC_VERSION_HG),0)
49: #else
50: #define PetscGetVersion(version,len) (PetscSNPrintf(*(version),len,"Petsc Development Version %d.%d.%d, Patch %d, ", \
51: PETSC_VERSION_MAJOR,PETSC_VERSION_MINOR, PETSC_VERSION_SUBMINOR, \
52: PETSC_VERSION_PATCH),PetscStrcat(*(version),PETSC_VERSION_PATCH_DATE), \
53: PetscStrcat(*(version)," HG revision: "),PetscStrcat(*(version),PETSC_VERSION_HG),0)
54: #endif
56: /*MC
57: PetscGetVersion - Gets the Petsc Version information in a string.
59: Output Parameter:
60: . version - version string
62: Input Parameter:
63: . len - length of the string
65: Level: developer
67: Usage:
68: char version[256];
69: PetscGetVersion(&version,256);
71: Fortran Note:
72: This routine is not supported in Fortran.
74: .seealso: PetscGetProgramName()
76: M*/
78: /* ========================================================================== */
80: /*
81: Currently cannot check formatting for PETSc print statements because we have our
82: own format %D and %G
83: */
84: #undef PETSC_PRINTF_FORMAT_CHECK
85: #define PETSC_PRINTF_FORMAT_CHECK(a,b)
86: #undef PETSC_FPRINTF_FORMAT_CHECK
87: #define PETSC_FPRINTF_FORMAT_CHECK(a,b)
89: /*
90: Fixes for configure time choices which impact our interface. Currently only
91: calling conventions and extra compiler checking falls under this category.
92: */
93: #if !defined(PETSC_STDCALL)
94: #define PETSC_STDCALL
95: #endif
96: #if !defined(PETSC_TEMPLATE)
97: #define PETSC_TEMPLATE
98: #endif
99: #if !defined(PETSC_HAVE_DLL_EXPORT)
100: #define PETSC_DLL_EXPORT
101: #define PETSC_DLL_IMPORT
102: #endif
103: #if !defined()
104: #define
105: #endif
106: #if !defined()
107: #define
108: #endif
109: #if !defined()
110: #define
111: #endif
112: #if !defined()
113: #define
114: #endif
115: #if !defined()
116: #define
117: #endif
118: #if !defined()
119: #define
120: #endif
121: #if !defined()
122: #define
123: #endif
124: #if !defined()
125: #define
126: #endif
127: /* ========================================================================== */
129: /*
130: Defines the interface to MPI allowing the use of all MPI functions.
132: PETSc does not use the C++ binding of MPI at ALL. The following flag
133: makes sure the C++ bindings are not included. The C++ bindings REQUIRE
134: putting mpi.h before ANY C++ include files, we cannot control this
135: with all PETSc users.
136: */
137: #define MPICH_SKIP_MPICXX 1
138: #include "mpi.h"
139: /*
140: Yuck, we need to put stdio.h AFTER mpi.h for MPICH2 with C++ compiler
141: see the top of mpicxx.h
143: The MPI STANDARD HAS TO BE CHANGED to prevent this nonsense.
144: */
145: #include <stdio.h>
147: /*MC
148: PetscErrorCode - datatype used for return error code from all PETSc functions
150: Level: beginner
152: .seealso: CHKERRQ, SETERRQ
153: M*/
154: typedef int PetscErrorCode;
156: /*MC
158: PetscCookie - A unique id used to identify each PETSc object.
159: (internal integer in the data structure used for error
160: checking). These are all defined by an offset from the lowest
161: one, PETSC_SMALLEST_COOKIE.
163: Level: advanced
166: M*/
167: typedef int PetscCookie;
169: /*MC
170: PetscEvent - id used to identify PETSc or user events - primarily for logging
172: Level: intermediate
175: M*/
176: typedef int PetscEvent;
178: /*MC
179: PetscBLASInt - datatype used to represent 'int' parameters to blas functions.
181: Level: intermediate
182: M*/
183: typedef int PetscBLASInt;
185: /*MC
186: PetscMPIInt - datatype used to represent 'int' parameters to MPI functions.
188: Level: intermediate
189: M*/
190: typedef int PetscMPIInt;
192: /*MC
193: PetscEnum - datatype used to pass enum types within PETSc functions.
195: Level: intermediate
197: .seealso: PetscOptionsGetEnum(), PetscOptionsEnum(), PetscBagRegisterEnum()
198: M*/
199: typedef enum { ENUM_DUMMY } PetscEnum;
201: /*MC
202: PetscInt - PETSc type that represents integer - used primarily to
203: represent size of objects. Its size can be configured with the option
204: --with-64-bit-indices - to be either 32bit or 64bit [default 32 bit ints]
206: Level: intermediate
208: .seealso: PetscScalar
209: M*/
210: #if defined(PETSC_USE_64BIT_INDICES)
211: typedef long long PetscInt;
212: #define MPIU_INT MPI_LONG_LONG_INT
213: #else
214: typedef int PetscInt;
215: #define MPIU_INT MPI_INT
216: #endif
218: /*
219: You can use PETSC_STDOUT as a replacement of stdout. You can also change
220: the value of PETSC_STDOUT to redirect all standard output elsewhere
221: */
225: /*
226: You can use PETSC_STDERR as a replacement of stderr. You can also change
227: the value of PETSC_STDERR to redirect all standard error elsewhere
228: */
231: /*
232: PETSC_ZOPEFD is used to send data to the PETSc webpage. It can be used
233: in conjunction with PETSC_STDOUT, or by itself.
234: */
238: /*MC
239: PetscPolymorphicSubroutine - allows defining a C++ polymorphic version of
240: a PETSc function that remove certain optional arguments for a simplier user interface
242: Not collective
244: Synopsis:
245: PetscPolymorphicSubroutine(Functionname,(arguments of C++ function),(arguments of C function))
246:
247: Level: developer
249: Example:
250: PetscPolymorphicSubroutine(VecNorm,(Vec x,PetscReal *r),(x,NORM_2,r)) generates the new routine
251: PetscErrorCode VecNorm(Vec x,PetscReal *r) = VecNorm(x,NORM_2,r)
253: .seealso: PetscPolymorphicFunction()
255: M*/
256: #define PetscPolymorphicSubroutine(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {return A C;}
258: /*MC
259: PetscPolymorphicScalar - allows defining a C++ polymorphic version of
260: a PETSc function that replaces a PetscScalar * argument with a PetscScalar argument
262: Not collective
264: Synopsis:
265: PetscPolymorphicScalar(Functionname,(arguments of C++ function),(arguments of C function))
266:
267: Level: developer
269: Example:
270: PetscPolymorphicScalar(VecAXPY,(PetscScalar _val,Vec x,Vec y),(&_Val,x,y)) generates the new routine
271: PetscErrorCode VecAXPY(PetscScalar _val,Vec x,Vec y) = {PetscScalar _Val = _val; return VecAXPY(&_Val,x,y);}
273: .seealso: PetscPolymorphicFunction(),PetscPolymorphicSubroutine()
275: M*/
276: #define PetscPolymorphicScalar(A,B,C) PETSC_STATIC_INLINE PetscErrorCode A B {PetscScalar _Val = _val; return A C;}
278: /*MC
279: PetscPolymorphicFunction - allows defining a C++ polymorphic version of
280: a PETSc function that remove certain optional arguments for a simplier user interface
281: and returns the computed value (istead of an error code)
283: Not collective
285: Synopsis:
286: PetscPolymorphicFunction(Functionname,(arguments of C++ function),(arguments of C function),return type,return variable name)
287:
288: Level: developer
290: Example:
291: PetscPolymorphicFunction(VecNorm,(Vec x,NormType t),(x,t,&r),PetscReal,r) generates the new routine
292: PetscReal VecNorm(Vec x,NormType t) = {PetscReal r; VecNorm(x,t,&r); return r;}
294: .seealso: PetscPolymorphicSubroutine()
296: M*/
297: #define PetscPolymorphicFunction(A,B,C,D,E) PETSC_STATIC_INLINE D A B {D E; A C;return E;}
299: #else
300: #define PetscPolymorphicSubroutine(A,B,C)
301: #define PetscPolymorphicScalar(A,B,C)
302: #define PetscPolymorphicFunction(A,B,C,D,E)
303: #endif
305: /*
306: Extern indicates a PETSc function defined elsewhere
307: */
308: #if !defined(EXTERN)
309: #define EXTERN extern
310: #endif
312: /*
313: Defines some elementary mathematics functions and constants.
314: */
315: #include petscmath.h
317: /*
319: */
323: /*
324: Basic PETSc constants
325: */
327: /*E
328: PetscTruth - Logical variable. Actually an integer
330: Level: beginner
332: E*/
333: typedef enum { PETSC_FALSE,PETSC_TRUE } PetscTruth;
336: /*MC
337: PETSC_FALSE - False value of PetscTruth
339: Level: beginner
341: Note: Zero integer
343: .seealso: PetscTruth, PETSC_TRUE
344: M*/
346: /*MC
347: PETSC_TRUE - True value of PetscTruth
349: Level: beginner
351: Note: Nonzero integer
353: .seealso: PetscTruth, PETSC_FALSE
354: M*/
356: /*MC
357: PETSC_YES - Alias for PETSC_TRUE
359: Level: beginner
361: Note: Zero integer
363: .seealso: PetscTruth, PETSC_TRUE, PETSC_FALSE, PETSC_NO
364: M*/
365: #define PETSC_YES PETSC_TRUE
367: /*MC
368: PETSC_NO - Alias for PETSC_FALSE
370: Level: beginner
372: Note: Nonzero integer
374: .seealso: PetscTruth, PETSC_TRUE, PETSC_FALSE, PETSC_YES
375: M*/
376: #define PETSC_NO PETSC_FALSE
378: /*MC
379: PETSC_NULL - standard way of passing in a null or array or pointer
381: Level: beginner
383: Notes: accepted by many PETSc functions to not set a parameter and instead use
384: some default
386: This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER,
387: PETSC_NULL_DOUBLE_PRECISION etc
389: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE
391: M*/
392: #define PETSC_NULL 0
394: /*MC
395: PETSC_DECIDE - standard way of passing in integer or floating point parameter
396: where you wish PETSc to use the default.
398: Level: beginner
400: .seealso: PETSC_NULL, PETSC_DEFAULT, PETSC_IGNORE, PETSC_DETERMINE
402: M*/
403: #define PETSC_DECIDE -1
405: /*MC
406: PETSC_DEFAULT - standard way of passing in integer or floating point parameter
407: where you wish PETSc to use the default.
409: Level: beginner
411: .seealso: PETSC_DECIDE, PETSC_NULL, PETSC_IGNORE, PETSC_DETERMINE
413: M*/
414: #define PETSC_DEFAULT -2
417: /*MC
418: PETSC_IGNORE - same as PETSC_NULL, means PETSc will ignore this argument
420: Level: beginner
422: Notes: accepted by many PETSc functions to not set a parameter and instead use
423: some default
425: This macro does not exist in Fortran; you must use PETSC_NULL_INTEGER,
426: PETSC_NULL_DOUBLE_PRECISION etc
428: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_NULL, PETSC_DETERMINE
430: M*/
431: #define PETSC_IGNORE PETSC_NULL
433: /*MC
434: PETSC_DETERMINE - standard way of passing in integer or floating point parameter
435: where you wish PETSc to compute the required value.
437: Level: beginner
439: .seealso: PETSC_DECIDE, PETSC_DEFAULT, PETSC_IGNORE, PETSC_NULL, VecSetSizes()
441: M*/
442: #define PETSC_DETERMINE PETSC_DECIDE
444: /*MC
445: PETSC_COMM_WORLD - the equivalent of the MPI_COMM_WORLD communicator which represents
446: all the processs that PETSc knows about.
448: Level: beginner
450: Notes: By default PETSC_COMM_WORLD and MPI_COMM_WORLD are identical unless you wish to
451: run PETSc on ONLY a subset of MPI_COMM_WORLD. In that case create your new (smaller)
452: communicator, call it, say comm, and set PETSC_COMM_WORLD = comm BEFORE calling
453: PetscInitialize()
455: .seealso: PETSC_COMM_SELF
457: M*/
460: /*MC
461: PETSC_COMM_SELF - a duplicate of the MPI_COMM_SELF communicator which represents
462: the current process
464: Level: beginner
466: Notes: PETSC_COMM_SELF and MPI_COMM_SELF are equivalent.
468: .seealso: PETSC_COMM_WORLD
470: M*/
471: #define PETSC_COMM_SELF MPI_COMM_SELF
476: EXTERN PetscErrorCode PetscSetHelpVersionFunctions(PetscErrorCode (*)(MPI_Comm),PetscErrorCode (*)(MPI_Comm));
477: EXTERN PetscErrorCode PetscCommDuplicate(MPI_Comm,MPI_Comm*,int*);
478: EXTERN PetscErrorCode PetscCommDestroy(MPI_Comm*);
480: /*MC
481: PetscMalloc - Allocates memory
483: Input Parameter:
484: . m - number of bytes to allocate
486: Output Parameter:
487: . result - memory allocated
489: Synopsis:
490: PetscErrorCode PetscMalloc(size_t m,void **result)
492: Level: beginner
494: Notes: Memory is always allocated at least double aligned
496: If you request memory of zero size it will allocate no space and assign the pointer to 0; PetscFree() will
497: properly handle not freeing the null pointer.
499: .seealso: PetscFree(), PetscNew()
501: Concepts: memory allocation
503: M*/
504: #define PetscMalloc(a,b) ((a != 0) ? (*PetscTrMalloc)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__,(void**)(b)) : (*(b) = 0,0) )
506: /*MC
507: PetscMalloc2 - Allocates 2 chunks of memory
509: Input Parameter:
510: + m1 - number of elements to allocate in 1st chunk (may be zero)
511: . t1 - type of first memory elements
512: . m2 - number of elements to allocate in 2nd chunk (may be zero)
513: - t2 - type of second memory elements
515: Output Parameter:
516: + r1 - memory allocated in first chunk
517: - r2 - memory allocated in second chunk
519: Synopsis:
520: PetscErrorCode PetscMalloc2(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2)
522: Level: developer
524: Notes: Memory of first chunk is always allocated at least double aligned
526: .seealso: PetscFree(), PetscNew(), PetscMalloc()
528: Concepts: memory allocation
530: M*/
531: #if defined(PETSC_USE_DEBUG)
532: #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1),r1) || PetscMalloc((m2)*sizeof(t2),r2))
533: #else
534: #define PetscMalloc2(m1,t1,r1,m2,t2,r2) (PetscMalloc((m1)*sizeof(t1)+(m2)*sizeof(t2),r1) || (*(r2) = (t2*)(*(r1)+m1),0))
535: #endif
537: /*MC
538: PetscMalloc3 - Allocates 3 chunks of memory
540: Input Parameter:
541: + m1 - number of elements to allocate in 1st chunk (may be zero)
542: . t1 - type of first memory elements
543: . m2 - number of elements to allocate in 2nd chunk (may be zero)
544: . t2 - type of second memory elements
545: . m3 - number of elements to allocate in 3rd chunk (may be zero)
546: - t3 - type of third memory elements
548: Output Parameter:
549: + r1 - memory allocated in first chunk
550: . r2 - memory allocated in second chunk
551: - r3 - memory allocated in third chunk
553: Synopsis:
554: PetscErrorCode PetscMalloc3(size_t m1,type, t1,void **r1,size_t m2,type t2,void **r2,size_t m3,type t3,void **r3)
556: Level: developer
558: Notes: Memory of first chunk is always allocated at least double aligned
560: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3()
562: Concepts: memory allocation
564: M*/
565: #if defined(PETSC_USE_DEBUG)
566: #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))
567: #else
568: #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))
569: #endif
571: /*MC
572: PetscMalloc4 - Allocates 4 chunks of memory
574: Input Parameter:
575: + m1 - number of elements to allocate in 1st chunk (may be zero)
576: . t1 - type of first memory elements
577: . m2 - number of elements to allocate in 2nd chunk (may be zero)
578: . t2 - type of second memory elements
579: . m3 - number of elements to allocate in 3rd chunk (may be zero)
580: . t3 - type of third memory elements
581: . m4 - number of elements to allocate in 4th chunk (may be zero)
582: - t4 - type of fourth memory elements
584: Output Parameter:
585: + r1 - memory allocated in first chunk
586: . r2 - memory allocated in second chunk
587: . r3 - memory allocated in third chunk
588: - r4 - memory allocated in fourth chunk
590: Synopsis:
591: 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)
593: Level: developer
595: Notes: Memory of first chunk is always allocated at least double aligned
597: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4()
599: Concepts: memory allocation
601: M*/
602: #if defined(PETSC_USE_DEBUG)
603: #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))
604: #else
605: #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))
606: #endif
608: /*MC
609: PetscMalloc5 - Allocates 5 chunks of memory
611: Input Parameter:
612: + m1 - number of elements to allocate in 1st chunk (may be zero)
613: . t1 - type of first memory elements
614: . m2 - number of elements to allocate in 2nd chunk (may be zero)
615: . t2 - type of second memory elements
616: . m3 - number of elements to allocate in 3rd chunk (may be zero)
617: . t3 - type of third memory elements
618: . m4 - number of elements to allocate in 4th chunk (may be zero)
619: . t4 - type of fourth memory elements
620: . m5 - number of elements to allocate in 5th chunk (may be zero)
621: - t5 - type of fifth memory elements
623: Output Parameter:
624: + r1 - memory allocated in first chunk
625: . r2 - memory allocated in second chunk
626: . r3 - memory allocated in third chunk
627: . r4 - memory allocated in fourth chunk
628: - r5 - memory allocated in fifth chunk
630: Synopsis:
631: 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)
633: Level: developer
635: Notes: Memory of first chunk is always allocated at least double aligned
637: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5()
639: Concepts: memory allocation
641: M*/
642: #if defined(PETSC_USE_DEBUG)
643: #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))
644: #else
645: #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))
646: #endif
649: /*MC
650: PetscMalloc6 - Allocates 6 chunks of memory
652: Input Parameter:
653: + m1 - number of elements to allocate in 1st chunk (may be zero)
654: . t1 - type of first memory elements
655: . m2 - number of elements to allocate in 2nd chunk (may be zero)
656: . t2 - type of second memory elements
657: . m3 - number of elements to allocate in 3rd chunk (may be zero)
658: . t3 - type of third memory elements
659: . m4 - number of elements to allocate in 4th chunk (may be zero)
660: . t4 - type of fourth memory elements
661: . m5 - number of elements to allocate in 5th chunk (may be zero)
662: . t5 - type of fifth memory elements
663: . m6 - number of elements to allocate in 6th chunk (may be zero)
664: - t6 - type of sixth memory elements
666: Output Parameter:
667: + r1 - memory allocated in first chunk
668: . r2 - memory allocated in second chunk
669: . r3 - memory allocated in third chunk
670: . r4 - memory allocated in fourth chunk
671: . r5 - memory allocated in fifth chunk
672: - r6 - memory allocated in sixth chunk
674: Synopsis:
675: 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)
677: Level: developer
679: Notes: Memory of first chunk is always allocated at least double aligned
681: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6()
683: Concepts: memory allocation
685: M*/
686: #if defined(PETSC_USE_DEBUG)
687: #define PetscMalloc6(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6) (PetscMalloc((m1)*sizeof(t1),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))
688: #else
689: #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))
690: #endif
692: /*MC
693: PetscMalloc7 - Allocates 7 chunks of memory
695: Input Parameter:
696: + m1 - number of elements to allocate in 1st chunk (may be zero)
697: . t1 - type of first memory elements
698: . m2 - number of elements to allocate in 2nd chunk (may be zero)
699: . t2 - type of second memory elements
700: . m3 - number of elements to allocate in 3rd chunk (may be zero)
701: . t3 - type of third memory elements
702: . m4 - number of elements to allocate in 4th chunk (may be zero)
703: . t4 - type of fourth memory elements
704: . m5 - number of elements to allocate in 5th chunk (may be zero)
705: . t5 - type of fifth memory elements
706: . m6 - number of elements to allocate in 6th chunk (may be zero)
707: . t6 - type of sixth memory elements
708: . m7 - number of elements to allocate in 7th chunk (may be zero)
709: - t7 - type of sixth memory elements
711: Output Parameter:
712: + r1 - memory allocated in first chunk
713: . r2 - memory allocated in second chunk
714: . r3 - memory allocated in third chunk
715: . r4 - memory allocated in fourth chunk
716: . r5 - memory allocated in fifth chunk
717: . r6 - memory allocated in sixth chunk
718: - r7 - memory allocated in sixth chunk
720: Synopsis:
721: 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)
723: Level: developer
725: Notes: Memory of first chunk is always allocated at least double aligned
727: .seealso: PetscFree(), PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree3(), PetscFree4(), PetscFree5(), PetscFree6(), PetscFree7()
729: Concepts: memory allocation
731: M*/
732: #if defined(PETSC_USE_DEBUG)
733: #define PetscMalloc7(m1,t1,r1,m2,t2,r2,m3,t3,r3,m4,t4,r4,m5,t5,r5,m6,t6,r6,m7,t7,r7) (PetscMalloc((m1)*sizeof(t1),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))
734: #else
735: #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))
736: #endif
738: /*MC
739: PetscNew - Allocates memory of a particular type, zeros the memory!
741: Input Parameter:
742: . type - structure name of space to be allocated. Memory of size sizeof(type) is allocated
744: Output Parameter:
745: . result - memory allocated
747: Synopsis:
748: PetscErrorCode PetscNew(struct type,((type *))result)
750: Level: beginner
752: .seealso: PetscFree(), PetscMalloc()
754: Concepts: memory allocation
756: M*/
757: #define PetscNew(A,b) (PetscMalloc(sizeof(A),(b)) || PetscMemzero(*(b),sizeof(A)))
758: #define PetscNewLog(o,A,b) (PetscNew(A,b) || ((o) ? PetscLogObjectMemory(o,sizeof(A)) : 0))
760: /*MC
761: PetscFree - Frees memory
763: Input Parameter:
764: . memory - memory to free (the pointer is ALWAYS set to 0 upon sucess)
766: Synopsis:
767: PetscErrorCode PetscFree(void *memory)
769: Level: beginner
771: Notes: Memory must have been obtained with PetscNew() or PetscMalloc()
773: .seealso: PetscNew(), PetscMalloc(), PetscFreeVoid()
775: Concepts: memory allocation
777: M*/
778: #define PetscFree(a) ((a) ? ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__) || ((a = 0),0)) : 0)
780: /*MC
781: PetscFreeVoid - Frees memory
783: Input Parameter:
784: . memory - memory to free
786: Synopsis:
787: void PetscFreeVoid(void *memory)
789: Level: beginner
791: Notes: This is different from PetscFree() in that no error code is returned
793: .seealso: PetscFree(), PetscNew(), PetscMalloc()
795: Concepts: memory allocation
797: M*/
798: #define PetscFreeVoid(a) ((*PetscTrFree)((a),__LINE__,__FUNCT__,__FILE__,__SDIR__),(a) = 0)
801: /*MC
802: PetscFree2 - Frees 2 chunks of memory obtained with PetscMalloc2()
804: Input Parameter:
805: + memory1 - memory to free
806: - memory2 - 2nd memory to free
809: Synopsis:
810: PetscErrorCode PetscFree2(void *memory1,void *memory2)
812: Level: developer
814: Notes: Memory must have been obtained with PetscMalloc2()
816: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree()
818: Concepts: memory allocation
820: M*/
821: #if defined(PETSC_USE_DEBUG)
822: #define PetscFree2(m1,m2) (PetscFree(m2) || PetscFree(m1))
823: #else
824: #define PetscFree2(m1,m2) (PetscFree(m1))
825: #endif
827: /*MC
828: PetscFree3 - Frees 3 chunks of memory obtained with PetscMalloc3()
830: Input Parameter:
831: + memory1 - memory to free
832: . memory2 - 2nd memory to free
833: - memory3 - 3rd memory to free
836: Synopsis:
837: PetscErrorCode PetscFree3(void *memory1,void *memory2,void *memory3)
839: Level: developer
841: Notes: Memory must have been obtained with PetscMalloc3()
843: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3()
845: Concepts: memory allocation
847: M*/
848: #if defined(PETSC_USE_DEBUG)
849: #define PetscFree3(m1,m2,m3) (PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
850: #else
851: #define PetscFree3(m1,m2,m3) (PetscFree(m1))
852: #endif
854: /*MC
855: PetscFree4 - Frees 4 chunks of memory obtained with PetscMalloc4()
857: Input Parameter:
858: + m1 - memory to free
859: . m2 - 2nd memory to free
860: . m3 - 3rd memory to free
861: - m4 - 4th memory to free
864: Synopsis:
865: PetscErrorCode PetscFree4(void *m1,void *m2,void *m3,void *m4)
867: Level: developer
869: Notes: Memory must have been obtained with PetscMalloc4()
871: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4()
873: Concepts: memory allocation
875: M*/
876: #if defined(PETSC_USE_DEBUG)
877: #define PetscFree4(m1,m2,m3,m4) (PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
878: #else
879: #define PetscFree4(m1,m2,m3,m4) (PetscFree(m1))
880: #endif
882: /*MC
883: PetscFree5 - Frees 5 chunks of memory obtained with PetscMalloc5()
885: Input Parameter:
886: + m1 - memory to free
887: . m2 - 2nd memory to free
888: . m3 - 3rd memory to free
889: . m4 - 4th memory to free
890: - m5 - 5th memory to free
893: Synopsis:
894: PetscErrorCode PetscFree5(void *m1,void *m2,void *m3,void *m4,void *m5)
896: Level: developer
898: Notes: Memory must have been obtained with PetscMalloc5()
900: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5()
902: Concepts: memory allocation
904: M*/
905: #if defined(PETSC_USE_DEBUG)
906: #define PetscFree5(m1,m2,m3,m4,m5) (PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
907: #else
908: #define PetscFree5(m1,m2,m3,m4,m5) (PetscFree(m1))
909: #endif
912: /*MC
913: PetscFree6 - Frees 6 chunks of memory obtained with PetscMalloc6()
915: Input Parameter:
916: + m1 - memory to free
917: . m2 - 2nd memory to free
918: . m3 - 3rd memory to free
919: . m4 - 4th memory to free
920: . m5 - 5th memory to free
921: - m6 - 6th memory to free
924: Synopsis:
925: PetscErrorCode PetscFree6(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6)
927: Level: developer
929: Notes: Memory must have been obtained with PetscMalloc6()
931: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6()
933: Concepts: memory allocation
935: M*/
936: #if defined(PETSC_USE_DEBUG)
937: #define PetscFree6(m1,m2,m3,m4,m5,m6) (PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
938: #else
939: #define PetscFree6(m1,m2,m3,m4,m5,m6) (PetscFree(m1))
940: #endif
942: /*MC
943: PetscFree7 - Frees 7 chunks of memory obtained with PetscMalloc7()
945: Input Parameter:
946: + m1 - memory to free
947: . m2 - 2nd memory to free
948: . m3 - 3rd memory to free
949: . m4 - 4th memory to free
950: . m5 - 5th memory to free
951: . m6 - 6th memory to free
952: - m7 - 7th memory to free
955: Synopsis:
956: PetscErrorCode PetscFree7(void *m1,void *m2,void *m3,void *m4,void *m5,void *m6,void *m7)
958: Level: developer
960: Notes: Memory must have been obtained with PetscMalloc7()
962: .seealso: PetscNew(), PetscMalloc(), PetscMalloc2(), PetscFree(), PetscMalloc3(), PetscMalloc4(), PetscMalloc5(), PetscMalloc6(),
963: PetscMalloc7()
965: Concepts: memory allocation
967: M*/
968: #if defined(PETSC_USE_DEBUG)
969: #define PetscFree7(m1,m2,m3,m4,m5,m6,m7) (PetscFree(m7) || PetscFree(m6) || PetscFree(m5) || PetscFree(m4) || PetscFree(m3) || PetscFree(m2) || PetscFree(m1))
970: #else
971: #define PetscFree7(m1,m2,m3,m4,m5,m6,m7) (PetscFree(m1))
972: #endif
974: EXTERN PetscErrorCode (*PetscTrMalloc)(size_t,int,const char[],const char[],const char[],void**);
975: EXTERN PetscErrorCode (*PetscTrFree)(void*,int,const char[],const char[],const char[]);
976: EXTERN PetscErrorCode PetscSetMalloc(PetscErrorCode (*)(size_t,int,const char[],const char[],const char[],void**),PetscErrorCode (*)(void*,int,const char[],const char[],const char[]));
977: EXTERN PetscErrorCode PetscClearMalloc(void);
979: /*
980: Routines for tracing memory corruption/bleeding with default PETSc
981: memory allocation
982: */
983: EXTERN PetscErrorCode PetscMallocDump(FILE *);
984: EXTERN PetscErrorCode PetscMallocDumpLog(FILE *);
985: EXTERN PetscErrorCode PetscMallocGetCurrentUsage(PetscLogDouble *);
986: EXTERN PetscErrorCode PetscMallocGetMaximumUsage(PetscLogDouble *);
987: EXTERN PetscErrorCode PetscMallocDebug(PetscTruth);
988: EXTERN PetscErrorCode PetscMallocValidate(int,const char[],const char[],const char[]);
989: EXTERN PetscErrorCode PetscMallocSetDumpLog(void);
992: /*
993: Variable type where we stash PETSc object pointers in Fortran.
994: On most machines size(pointer) == sizeof(long) - except windows
995: where its sizeof(long long)
996: */
998: #if (PETSC_SIZEOF_VOID_P) == (PETSC_SIZEOF_LONG)
999: #define PetscFortranAddr long
1000: #elif (PETSC_SIZEOF_VOID_P) == (PETSC_SIZEOF_LONG_LONG)
1001: #define PetscFortranAddr long long
1002: #else
1003: #error "Unknown size for PetscFortranAddr! Send us a bugreport at petsc-maint@mcs.anl.gov"
1004: #endif
1006: /*E
1007: PetscDataType - Used for handling different basic data types.
1009: Level: beginner
1011: .seealso: PetscBinaryRead(), PetscBinaryWrite(), PetscDataTypeToMPIDataType(),
1012: PetscDataTypeGetSize()
1014: E*/
1015: typedef enum {PETSC_INT = 0,PETSC_DOUBLE = 1,PETSC_COMPLEX = 2, PETSC_LONG = 3 ,PETSC_SHORT = 4,PETSC_FLOAT = 5,
1016: PETSC_CHAR = 6,PETSC_LOGICAL = 7,PETSC_ENUM = 8,PETSC_TRUTH=9, PETSC_LONG_DOUBLE = 10} PetscDataType;
1019: #if defined(PETSC_USE_COMPLEX)
1020: #define PETSC_SCALAR PETSC_COMPLEX
1021: #else
1022: #if defined(PETSC_USE_SINGLE)
1023: #define PETSC_SCALAR PETSC_FLOAT
1024: #elif defined(PETSC_USE_LONG_DOUBLE)
1025: #define PETSC_SCALAR PETSC_LONG_DOUBLE
1026: #elif defined(PETSC_USE_INT)
1027: #define PETSC_SCALAR PETSC_INT
1028: #else
1029: #define PETSC_SCALAR PETSC_DOUBLE
1030: #endif
1031: #endif
1032: #if defined(PETSC_USE_SINGLE)
1033: #define PETSC_REAL PETSC_FLOAT
1034: #elif defined(PETSC_USE_LONG_DOUBLE)
1035: #define PETSC_REAL PETSC_LONG_DOUBLE
1036: #elif defined(PETSC_USE_INT)
1037: #define PETSC_REAL PETSC_INT
1038: #else
1039: #define PETSC_REAL PETSC_DOUBLE
1040: #endif
1041: #define PETSC_FORTRANADDR PETSC_LONG
1043: EXTERN PetscErrorCode PetscDataTypeToMPIDataType(PetscDataType,MPI_Datatype*);
1044: EXTERN PetscErrorCode PetscDataTypeGetSize(PetscDataType,size_t*);
1046: /*
1047: Basic memory and string operations. These are usually simple wrappers
1048: around the basic Unix system calls, but a few of them have additional
1049: functionality and/or error checking.
1050: */
1051: EXTERN PetscErrorCode PetscMemcpy(void*,const void *,size_t);
1052: EXTERN PetscErrorCode PetscBitMemcpy(void*,PetscInt,const void*,PetscInt,PetscInt,PetscDataType);
1053: EXTERN PetscErrorCode PetscMemmove(void*,void *,size_t);
1054: EXTERN PetscErrorCode PetscMemzero(void*,size_t);
1055: EXTERN PetscErrorCode PetscMemcmp(const void*,const void*,size_t,PetscTruth *);
1056: EXTERN PetscErrorCode PetscStrlen(const char[],size_t*);
1057: EXTERN PetscErrorCode PetscStrcmp(const char[],const char[],PetscTruth *);
1058: EXTERN PetscErrorCode PetscStrgrt(const char[],const char[],PetscTruth *);
1059: EXTERN PetscErrorCode PetscStrcasecmp(const char[],const char[],PetscTruth*);
1060: EXTERN PetscErrorCode PetscStrncmp(const char[],const char[],size_t,PetscTruth*);
1061: EXTERN PetscErrorCode PetscStrcpy(char[],const char[]);
1062: EXTERN PetscErrorCode PetscStrcat(char[],const char[]);
1063: EXTERN PetscErrorCode PetscStrncat(char[],const char[],size_t);
1064: EXTERN PetscErrorCode PetscStrncpy(char[],const char[],size_t);
1065: EXTERN PetscErrorCode PetscStrchr(const char[],char,char *[]);
1066: EXTERN PetscErrorCode PetscStrtolower(char[]);
1067: EXTERN PetscErrorCode PetscStrrchr(const char[],char,char *[]);
1068: EXTERN PetscErrorCode PetscStrstr(const char[],const char[],char *[]);
1069: EXTERN PetscErrorCode PetscStrrstr(const char[],const char[],char *[]);
1070: EXTERN PetscErrorCode PetscStrallocpy(const char[],char *[]);
1071: EXTERN PetscErrorCode PetscStrreplace(MPI_Comm,const char[],char[],size_t);
1072: #define PetscStrfree(a) ((a) ? PetscFree(a) : 0)
1074: /*S
1075: PetscToken - 'Token' used for managing tokenizing strings
1077: Level: intermediate
1079: .seealso: PetscTokenCreate(), PetscTokenFind(), PetscTokenDestroy()
1080: S*/
1081: typedef struct {char token;char *array;char *current;} PetscToken;
1083: EXTERN PetscErrorCode PetscTokenCreate(const char[],const char,PetscToken**);
1084: EXTERN PetscErrorCode PetscTokenFind(PetscToken*,char *[]);
1085: EXTERN PetscErrorCode PetscTokenDestroy(PetscToken*);
1087: /*
1088: These are MPI operations for MPI_Allreduce() etc
1089: */
1090: EXTERN MPI_Op PetscMaxSum_Op;
1091: #if defined(PETSC_USE_COMPLEX)
1092: EXTERN MPI_Op PetscSum_Op;
1093: #else
1094: #define PetscSum_Op MPI_SUM
1095: #endif
1096: EXTERN PetscErrorCode PetscMaxSum(MPI_Comm,const PetscInt[],PetscInt*,PetscInt*);
1098: /*S
1099: PetscObject - any PETSc object, PetscViewer, Mat, Vec, KSP etc
1101: Level: beginner
1103: Note: This is the base class from which all objects appear.
1105: .seealso: PetscObjectDestroy(), PetscObjectView(), PetscObjectGetName(), PetscObjectSetName()
1106: S*/
1107: typedef struct _p_PetscObject* PetscObject;
1109: /*S
1110: PetscFList - Linked list of functions, possibly stored in dynamic libraries, accessed
1111: by string name
1113: Level: advanced
1115: .seealso: PetscFListAdd(), PetscFListDestroy()
1116: S*/
1117: typedef struct _n_PetscFList *PetscFList;
1119: /*E
1120: PetscFileMode - Access mode for a file.
1122: Level: beginner
1124: FILE_MODE_READ - open a file at its beginning for reading
1126: FILE_MODE_WRITE - open a file at its beginning for writing (will create if the file does not exist)
1128: FILE_MODE_APPEND - open a file at end for writing
1130: FILE_MODE_UPDATE - open a file for updating, meaning for reading and writing
1132: FILE_MODE_APPEND_UPDATE - open a file for updating, meaning for reading and writing, at the end
1134: .seealso: PetscViewerFileSetMode()
1135: E*/
1136: typedef enum {FILE_MODE_READ, FILE_MODE_WRITE, FILE_MODE_APPEND, FILE_MODE_UPDATE, FILE_MODE_APPEND_UPDATE} PetscFileMode;
1138: #include petscviewer.h
1139: #include petscoptions.h
1141: #define PETSC_SMALLEST_COOKIE 1211211
1144: EXTERN PetscErrorCode PetscCookieRegister(PetscCookie *);
1146: /*
1147: Routines that get memory usage information from the OS
1148: */
1149: EXTERN PetscErrorCode PetscMemoryGetCurrentUsage(PetscLogDouble *);
1150: EXTERN PetscErrorCode PetscMemoryGetMaximumUsage(PetscLogDouble *);
1151: EXTERN PetscErrorCode PetscMemorySetGetMaximumUsage(void);
1152: EXTERN PetscErrorCode PetscMemoryShowUsage(PetscViewer,const char[]);
1154: EXTERN PetscErrorCode PetscInfoAllow(PetscTruth,const char []);
1155: EXTERN PetscErrorCode PetscGetTime(PetscLogDouble*);
1156: EXTERN PetscErrorCode PetscGetCPUTime(PetscLogDouble*);
1157: EXTERN PetscErrorCode PetscSleep(int);
1159: /*
1160: Initialization of PETSc
1161: */
1162: EXTERN PetscErrorCode PetscInitialize(int*,char***,const char[],const char[]);
1163: PetscPolymorphicSubroutine(PetscInitialize,(int *argc,char ***args),(argc,args,PETSC_NULL,PETSC_NULL))
1164: EXTERN PetscErrorCode PetscInitializeNoArguments(void);
1165: EXTERN PetscErrorCode PetscInitialized(PetscTruth *);
1166: EXTERN PetscErrorCode PetscFinalized(PetscTruth *);
1167: EXTERN PetscErrorCode PetscFinalize(void);
1168: EXTERN PetscErrorCode PetscInitializeFortran(void);
1169: EXTERN PetscErrorCode PetscGetArgs(int*,char ***);
1170: EXTERN PetscErrorCode PetscGetArguments(char ***args);
1171: EXTERN PetscErrorCode PetscFreeArguments(char **args);
1173: EXTERN PetscErrorCode PetscEnd(void);
1174: EXTERN PetscErrorCode PetscInitializePackage(const char[]);
1176: EXTERN PetscErrorCode PetscOpenMPMerge(PetscMPIInt);
1177: EXTERN PetscErrorCode PetscOpenMPSpawn(PetscMPIInt);
1178: EXTERN PetscErrorCode PetscOpenMPFinalize(void);
1179: EXTERN PetscErrorCode PetscOpenMPRun(MPI_Comm,PetscErrorCode (*)(MPI_Comm,void *),void*);
1180: EXTERN PetscErrorCode PetscOpenMPFree(MPI_Comm,void*);
1181: EXTERN PetscErrorCode PetscOpenMPNew(MPI_Comm,PetscInt,void**);
1183: /*
1185: function pointers. Since the regular C++ code expects its function pointers to be
1186: C++.
1187: */
1188: typedef void (**PetscVoidStarFunction)(void);
1189: typedef void (*PetscVoidFunction)(void);
1190: typedef PetscErrorCode (*PetscErrorCodeFunction)(void);
1192: /*
1193: PetscTryMethod - Queries an object for a method, if it exists then calls it.
1194: These are intended to be used only inside PETSc functions.
1195: */
1196: #define PetscTryMethod(obj,A,B,C) \
1197: 0;{ PetscErrorCode (*f)B, __ierr; \
1198: __PetscObjectQueryFunction((PetscObject)obj,A,(PetscVoidStarFunction)&f);CHKERRQ(__ierr); \
1199: if (f) {__(*f)C;CHKERRQ(__ierr);}\
1200: }
1201: #define PetscUseMethod(obj,A,B,C) \
1202: 0;{ PetscErrorCode (*f)B, __ierr; \
1203: __PetscObjectQueryFunction((PetscObject)obj,A,(PetscVoidStarFunction)&f);CHKERRQ(__ierr); \
1204: if (f) {__(*f)C;CHKERRQ(__ierr);}\
1205: else {SETERRQ1(PETSC_ERR_SUP,"Cannot locate function %s in object",A);} \
1206: }
1207: /*
1208: Functions that can act on any PETSc object.
1209: */
1210: EXTERN PetscErrorCode PetscObjectCreate(MPI_Comm,PetscObject*);
1211: EXTERN PetscErrorCode PetscObjectCreateGeneric(MPI_Comm, PetscCookie, const char [], PetscObject *);
1212: EXTERN PetscErrorCode PetscObjectDestroy(PetscObject);
1213: EXTERN PetscErrorCode PetscObjectExists(PetscObject,PetscTruth*);
1214: EXTERN PetscErrorCode PetscObjectGetComm(PetscObject,MPI_Comm *);
1215: EXTERN PetscErrorCode PetscObjectGetCookie(PetscObject,PetscCookie *);
1216: EXTERN PetscErrorCode PetscObjectSetType(PetscObject,const char []);
1217: EXTERN PetscErrorCode PetscObjectGetType(PetscObject,const char *[]);
1218: EXTERN PetscErrorCode PetscObjectSetName(PetscObject,const char[]);
1219: EXTERN PetscErrorCode PetscObjectGetName(PetscObject,const char*[]);
1220: EXTERN PetscErrorCode PetscObjectReference(PetscObject);
1221: EXTERN PetscErrorCode PetscObjectGetReference(PetscObject,PetscInt*);
1222: EXTERN PetscErrorCode PetscObjectDereference(PetscObject);
1223: EXTERN PetscErrorCode PetscObjectGetNewTag(PetscObject,PetscMPIInt *);
1224: EXTERN PetscErrorCode PetscObjectView(PetscObject,PetscViewer);
1225: EXTERN PetscErrorCode PetscObjectCompose(PetscObject,const char[],PetscObject);
1226: EXTERN PetscErrorCode PetscObjectQuery(PetscObject,const char[],PetscObject *);
1227: EXTERN PetscErrorCode PetscObjectComposeFunction(PetscObject,const char[],const char[],void (*)(void));
1228: EXTERN PetscErrorCode PetscObjectSetFromOptions(PetscObject);
1229: EXTERN PetscErrorCode PetscObjectSetUp(PetscObject);
1230: EXTERN PetscErrorCode PetscCommGetNewTag(MPI_Comm,PetscMPIInt *);
1232: /*MC
1233: PetscObjectComposeFunctionDynamic - Associates a function with a given PETSc object.
1234:
1235: Collective on PetscObject
1237: Input Parameters:
1238: + obj - the PETSc object; this must be cast with a (PetscObject), for example,
1239: PetscObjectCompose((PetscObject)mat,...);
1240: . name - name associated with the child function
1241: . fname - name of the function
1242: - ptr - function pointer (or PETSC_NULL if using dynamic libraries)
1244: Level: advanced
1246: Synopsis:
1247: PetscErrorCode PetscObjectComposeFunctionDynamic(PetscObject obj,const char name[],const char fname[],void *ptr)
1249: Notes:
1250: To remove a registered routine, pass in a PETSC_NULL rname and fnc().
1252: PetscObjectComposeFunctionDynamic() can be used with any PETSc object (such as
1253: Mat, Vec, KSP, SNES, etc.) or any user-provided object.
1256: work in C++/complex with dynamic link libraries (config/configure.py options --with-shared --with-dynamic)
1257: enabled.
1259: Concepts: objects^composing functions
1260: Concepts: composing functions
1261: Concepts: functions^querying
1262: Concepts: objects^querying
1263: Concepts: querying objects
1265: .seealso: PetscObjectQueryFunction()
1266: M*/
1267: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1268: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,0)
1269: #else
1270: #define PetscObjectComposeFunctionDynamic(a,b,c,d) PetscObjectComposeFunction(a,b,c,(PetscVoidFunction)(d))
1271: #endif
1273: EXTERN PetscErrorCode PetscObjectQueryFunction(PetscObject,const char[],void (**)(void));
1274: EXTERN PetscErrorCode PetscObjectSetOptionsPrefix(PetscObject,const char[]);
1275: EXTERN PetscErrorCode PetscObjectAppendOptionsPrefix(PetscObject,const char[]);
1276: EXTERN PetscErrorCode PetscObjectPrependOptionsPrefix(PetscObject,const char[]);
1277: EXTERN PetscErrorCode PetscObjectGetOptionsPrefix(PetscObject,const char*[]);
1278: EXTERN PetscErrorCode PetscObjectPublish(PetscObject);
1279: EXTERN PetscErrorCode PetscObjectChangeTypeName(PetscObject,const char[]);
1280: EXTERN PetscErrorCode PetscObjectRegisterDestroy(PetscObject);
1281: EXTERN PetscErrorCode PetscObjectRegisterDestroyAll(void);
1282: EXTERN PetscErrorCode PetscObjectName(PetscObject);
1283: EXTERN PetscErrorCode PetscTypeCompare(PetscObject,const char[],PetscTruth*);
1284: EXTERN PetscErrorCode PetscRegisterFinalize(PetscErrorCode (*)(void));
1285: EXTERN PetscErrorCode PetscRegisterFinalizeAll(void);
1287: /*
1288: Defines PETSc error handling.
1289: */
1290: #include petscerror.h
1292: /*S
1293: PetscOList - Linked list of PETSc objects, accessable by string name
1295: Level: advanced
1297: .seealso: PetscOListAdd(), PetscOListDestroy(), PetscOListFind()
1298: S*/
1299: typedef struct _n_PetscOList *PetscOList;
1301: EXTERN PetscErrorCode PetscOListDestroy(PetscOList);
1302: EXTERN PetscErrorCode PetscOListFind(PetscOList,const char[],PetscObject*);
1303: EXTERN PetscErrorCode PetscOListReverseFind(PetscOList,PetscObject,char**);
1304: EXTERN PetscErrorCode PetscOListAdd(PetscOList *,const char[],PetscObject);
1305: EXTERN PetscErrorCode PetscOListDuplicate(PetscOList,PetscOList *);
1307: /*
1308: Dynamic library lists. Lists of names of routines in dynamic
1309: link libraries that will be loaded as needed.
1310: */
1311: EXTERN PetscErrorCode PetscFListAdd(PetscFList*,const char[],const char[],void (*)(void));
1312: EXTERN PetscErrorCode PetscFListDestroy(PetscFList*);
1313: EXTERN PetscErrorCode PetscFListFind(PetscFList,MPI_Comm,const char[],void (**)(void));
1314: EXTERN PetscErrorCode PetscFListPrintTypes(PetscFList,MPI_Comm,FILE*,const char[],const char[],const char[],const char[]);
1315: #if defined(PETSC_USE_DYNAMIC_LIBRARIES)
1316: #define PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,0)
1317: #else
1318: #define PetscFListAddDynamic(a,b,p,c) PetscFListAdd(a,b,p,(void (*)(void))c)
1319: #endif
1320: EXTERN PetscErrorCode PetscFListDuplicate(PetscFList,PetscFList *);
1321: EXTERN PetscErrorCode PetscFListView(PetscFList,PetscViewer);
1322: EXTERN PetscErrorCode PetscFListConcat(const char [],const char [],char []);
1323: EXTERN PetscErrorCode PetscFListGet(PetscFList,char ***,int*);
1325: /*S
1326: PetscDLLibrary - Linked list of dynamics libraries to search for functions
1328: Level: advanced
1330: --with-shared --with-dynamic must be used with config/configure.py to use dynamic libraries
1332: .seealso: PetscDLLibraryOpen()
1333: S*/
1334: typedef struct _n_PetscDLLibrary *PetscDLLibrary;
1336: EXTERN PetscErrorCode PetscDLLibraryRetrieve(MPI_Comm,const char[],char *,int,PetscTruth *);
1337: EXTERN PetscErrorCode PetscDLLibraryOpen(MPI_Comm,const char[],void **);
1338: EXTERN PetscErrorCode PetscDLLibrarySym(MPI_Comm,PetscDLLibrary *,const char[],const char[],void **);
1339: EXTERN PetscErrorCode PetscDLLibraryAppend(MPI_Comm,PetscDLLibrary *,const char[]);
1340: EXTERN PetscErrorCode PetscDLLibraryPrepend(MPI_Comm,PetscDLLibrary *,const char[]);
1341: EXTERN PetscErrorCode PetscDLLibraryClose(PetscDLLibrary);
1342: EXTERN PetscErrorCode PetscDLLibraryPrintPath(void);
1343: EXTERN PetscErrorCode PetscDLLibraryGetInfo(void*,const char[],const char *[]);
1344: EXTERN PetscErrorCode PetscDLLibraryCCAAppend(MPI_Comm,PetscDLLibrary *,const char[]);
1346: /*
1347: Useful utility routines
1348: */
1349: EXTERN PetscErrorCode PetscSplitOwnership(MPI_Comm,PetscInt*,PetscInt*);
1350: EXTERN PetscErrorCode PetscSplitOwnershipBlock(MPI_Comm,PetscInt,PetscInt*,PetscInt*);
1351: EXTERN PetscErrorCode PetscSequentialPhaseBegin(MPI_Comm,PetscMPIInt);
1352: PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(MPI_Comm comm),(comm,1))
1353: PetscPolymorphicSubroutine(PetscSequentialPhaseBegin,(void),(PETSC_COMM_WORLD,1))
1354: EXTERN PetscErrorCode PetscSequentialPhaseEnd(MPI_Comm,PetscMPIInt);
1355: PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(MPI_Comm comm),(comm,1))
1356: PetscPolymorphicSubroutine(PetscSequentialPhaseEnd,(void),(PETSC_COMM_WORLD,1))
1357: EXTERN PetscErrorCode PetscBarrier(PetscObject);
1358: EXTERN PetscErrorCode PetscMPIDump(FILE*);
1360: #define PetscNot(a) ((a) ? PETSC_FALSE : PETSC_TRUE)
1361: /*
1362: Defines basic graphics available from PETSc.
1363: */
1364: #include petscdraw.h
1366: /*
1367: Defines the base data structures for all PETSc objects
1368: */
1369: #include private/petscimpl.h
1370: /*
1371: Defines PETSc profiling.
1372: */
1373: #include petsclog.h
1375: /*
1376: For locking, unlocking and destroying AMS memories associated with
1377: PETSc objects. Not currently used.
1378: */
1379: #define PetscPublishAll(v) 0
1380: #define PetscObjectTakeAccess(obj) 0
1381: #define PetscObjectGrantAccess(obj) 0
1382: #define PetscObjectDepublish(obj) 0
1384: /*
1385: This code allows one to pass a MPI communicator between
1386: C and Fortran. MPI 2.0 defines a standard API for doing this.
1387: The code here is provided to allow PETSc to work with MPI 1.1
1388: standard MPI libraries.
1389: */
1390: EXTERN PetscErrorCode MPICCommToFortranComm(MPI_Comm,int *);
1391: EXTERN PetscErrorCode MPIFortranCommToCComm(int,MPI_Comm*);
1393: /*
1394: Simple PETSc parallel IO for ASCII printing
1395: */
1396: EXTERN PetscErrorCode PetscFixFilename(const char[],char[]);
1397: EXTERN PetscErrorCode PetscFOpen(MPI_Comm,const char[],const char[],FILE**);
1398: EXTERN PetscErrorCode PetscFClose(MPI_Comm,FILE*);
1399: EXTERN PetscErrorCode PetscFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1400: EXTERN PetscErrorCode PetscPrintf(MPI_Comm,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
1401: EXTERN PetscErrorCode PetscSNPrintf(char*,size_t,const char [],...);
1403: /* These are used internally by PETSc ASCII IO routines*/
1404: #include <stdarg.h>
1405: EXTERN PetscErrorCode PetscVSNPrintf(char*,size_t,const char[],va_list);
1406: EXTERN PetscErrorCode (*PetscVFPrintf)(FILE*,const char[],va_list);
1407: EXTERN PetscErrorCode PetscVFPrintfDefault(FILE*,const char[],va_list);
1409: /*MC
1410: PetscErrorPrintf - Prints error messages.
1412: Not Collective
1414: Synopsis:
1415: PetscErrorCode (*PetscErrorPrintf)(const char format[],...);
1417: Input Parameters:
1418: . format - the usual printf() format string
1420: Options Database Keys:
1421: + -error_output_stdout - cause error messages to be printed to stdout instead of the
1422: (default) stderr
1423: - -error_output_none to turn off all printing of error messages (does not change the way the
1424: error is handled.)
1426: Notes: Use
1427: $ PetscErrorPrintf = PetscErrorPrintfNone; to turn off all printing of error messages (does not change the way the
1428: $ error is handled.) and
1429: $ PetscErrorPrintf = PetscErrorPrintfDefault; to turn it back on
1431: Use
1432: PETSC_STDERR = FILE* obtained from a file open etc. to have stderr printed to the file.
1433: PETSC_STDOUT = FILE* obtained from a file open etc. to have stdout printed to the file.
1435: Use
1436: PetscPushErrorHandler() to provide your own error handler that determines what kind of messages to print
1438: Level: developer
1440: Fortran Note:
1441: This routine is not supported in Fortran.
1443: Concepts: error messages^printing
1444: Concepts: printing^error messages
1446: .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscHelpPrintf(), PetscPrintf(), PetscErrorHandlerPush()
1447: M*/
1448: EXTERN PetscErrorCode (*PetscErrorPrintf)(const char[],...);
1450: /*MC
1451: PetscHelpPrintf - Prints help messages.
1453: Not Collective
1455: Synopsis:
1456: PetscErrorCode (*PetscHelpPrintf)(const char format[],...);
1458: Input Parameters:
1459: . format - the usual printf() format string
1461: Level: developer
1463: Fortran Note:
1464: This routine is not supported in Fortran.
1466: Concepts: help messages^printing
1467: Concepts: printing^help messages
1469: .seealso: PetscFPrintf(), PetscSynchronizedPrintf(), PetscErrorPrintf()
1470: M*/
1471: EXTERN PetscErrorCode (*PetscHelpPrintf)(MPI_Comm,const char[],...);
1473: EXTERN PetscErrorCode PetscErrorPrintfDefault(const char [],...);
1474: EXTERN PetscErrorCode PetscErrorPrintfNone(const char [],...);
1475: EXTERN PetscErrorCode PetscHelpPrintfDefault(MPI_Comm,const char [],...);
1477: EXTERN PetscErrorCode PetscPOpen(MPI_Comm,const char[],const char[],const char[],FILE **);
1478: EXTERN PetscErrorCode PetscPClose(MPI_Comm,FILE*);
1479: EXTERN PetscErrorCode PetscSynchronizedPrintf(MPI_Comm,const char[],...) PETSC_PRINTF_FORMAT_CHECK(2,3);
1480: EXTERN PetscErrorCode PetscSynchronizedFPrintf(MPI_Comm,FILE*,const char[],...) PETSC_PRINTF_FORMAT_CHECK(3,4);
1481: EXTERN PetscErrorCode PetscSynchronizedFlush(MPI_Comm);
1482: EXTERN PetscErrorCode PetscSynchronizedFGets(MPI_Comm,FILE*,size_t,char[]);
1483: EXTERN PetscErrorCode PetscStartMatlab(MPI_Comm,const char[],const char[],FILE**);
1484: EXTERN PetscErrorCode PetscStartJava(MPI_Comm,const char[],const char[],FILE**);
1485: EXTERN PetscErrorCode PetscGetPetscDir(const char*[]);
1487: EXTERN PetscErrorCode PetscPopUpSelect(MPI_Comm,char*,char*,int,char**,int*);
1489: /*S
1490: PetscContainer - Simple PETSc object that contains a pointer to any required data
1492: Level: advanced
1494: .seealso: PetscObject, PetscContainerCreate()
1495: S*/
1497: typedef struct _p_PetscContainer* PetscContainer;
1498: EXTERN PetscErrorCode PetscContainerGetPointer(PetscContainer,void **);
1499: EXTERN PetscErrorCode PetscContainerSetPointer(PetscContainer,void *);
1500: EXTERN PetscErrorCode PetscContainerDestroy(PetscContainer);
1501: EXTERN PetscErrorCode PetscContainerCreate(MPI_Comm,PetscContainer *);
1502: EXTERN PetscErrorCode PetscContainerSetUserDestroy(PetscContainer, PetscErrorCode (*)(void*));
1504: /*
1505: For use in debuggers
1506: */
1510: EXTERN PetscErrorCode PetscIntView(PetscInt,PetscInt[],PetscViewer);
1511: EXTERN PetscErrorCode PetscRealView(PetscInt,PetscReal[],PetscViewer);
1512: EXTERN PetscErrorCode PetscScalarView(PetscInt,PetscScalar[],PetscViewer);
1514: /*
1515: Allows accessing Matlab Engine
1516: */
1517: #include petscmatlab.h
1519: /*
1520: Determine if some of the kernel computation routines use
1521: Fortran (rather than C) for the numerical calculations. On some machines
1522: and compilers (like complex numbers) the Fortran version of the routines
1523: is faster than the C/C++ versions. The flag --with-fortran-kernels
1524: should be used with config/configure.py to turn these on.
1525: */
1526: #if defined(PETSC_USE_FORTRAN_KERNELS)
1528: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCRL)
1529: #define PETSC_USE_FORTRAN_KERNEL_MULTCRL
1530: #endif
1532: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM)
1533: #define PETSC_USE_FORTRAN_KERNEL_MULTCSRPERM
1534: #endif
1536: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTAIJ)
1537: #define PETSC_USE_FORTRAN_KERNEL_MULTAIJ
1538: #endif
1540: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ)
1541: #define PETSC_USE_FORTRAN_KERNEL_MULTTRANSPOSEAIJ
1542: #endif
1544: #if !defined(PETSC_USE_FORTRAN_KERNEL_NORM)
1545: #define PETSC_USE_FORTRAN_KERNEL_NORM
1546: #endif
1548: #if !defined(PETSC_USE_FORTRAN_KERNEL_MAXPY)
1549: #define PETSC_USE_FORTRAN_KERNEL_MAXPY
1550: #endif
1552: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ)
1553: #define PETSC_USE_FORTRAN_KERNEL_SOLVEAIJ
1554: #endif
1556: #if !defined(PETSC_USE_FORTRAN_KERNEL_RELAXAIJ)
1557: #define PETSC_USE_FORTRAN_KERNEL_RELAXAIJ
1558: #endif
1560: #if !defined(PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ)
1561: #define PETSC_USE_FORTRAN_KERNEL_SOLVEBAIJ
1562: #endif
1564: #if !defined(PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ)
1565: #define PETSC_USE_FORTRAN_KERNEL_MULTADDAIJ
1566: #endif
1568: #if !defined(PETSC_USE_FORTRAN_KERNEL_MDOT)
1569: #define PETSC_USE_FORTRAN_KERNEL_MDOT
1570: #endif
1572: #if !defined(PETSC_USE_FORTRAN_KERNEL_XTIMESY)
1573: #define PETSC_USE_FORTRAN_KERNEL_XTIMESY
1574: #endif
1576: #if !defined(PETSC_USE_FORTRAN_KERNEL_AYPX)
1577: #define PETSC_USE_FORTRAN_KERNEL_AYPX
1578: #endif
1580: #if !defined(PETSC_USE_FORTRAN_KERNEL_WAXPY)
1581: #define PETSC_USE_FORTRAN_KERNEL_WAXPY
1582: #endif
1584: #endif
1586: /*
1587: Macros for indicating code that should be compiled with a C interface,
1588: rather than a C++ interface. Any routines that are dynamically loaded
1589: (such as the PCCreate_XXX() routines) must be wrapped so that the name
1590: mangler does not change the functions symbol name. This just hides the
1592: */
1593: #if defined(__cplusplus)
1596: #else
1599: #endif
1601: /* --------------------------------------------------------------------*/
1603: /*MC
1604: size - integer variable used to contain the number of processors in
1605: the relevent MPI_Comm
1607: Level: beginner
1609: .seealso: rank, comm
1610: M*/
1612: /*MC
1613: rank - integer variable used to contain the number of this processor relative
1614: to all in the relevent MPI_Comm
1616: Level: beginner
1618: .seealso: size, comm
1619: M*/
1621: /*MC
1622: comm - MPI_Comm used in the current routine or object
1624: Level: beginner
1626: .seealso: size, rank
1627: M*/
1629: /*MC
1630: MPI_Comm - the basic object used by MPI to determine which processes are involved in a
1631: communication
1633: Level: beginner
1635: Note: This manual page is a place-holder because MPICH does not have a manual page for MPI_Comm
1637: .seealso: size, rank, comm, PETSC_COMM_WORLD, PETSC_COMM_SELF
1638: M*/
1640: /*MC
1641: PetscScalar - PETSc type that represents either a double precision real number, a double precision
1642: complex number, a single precision real number, a long double or an int - if the code is configured
1643: with --with-scalar-type=real,complex --with-precision=single,double,longdouble,int,matsingle
1646: Level: beginner
1648: .seealso: PetscReal, PassiveReal, PassiveScalar
1649: M*/
1651: /*MC
1652: PetscReal - PETSc type that represents a real number version of PetscScalar
1654: Level: beginner
1656: .seealso: PetscScalar, PassiveReal, PassiveScalar
1657: M*/
1659: /*MC
1660: PassiveScalar - PETSc type that represents a PetscScalar
1661: Level: beginner
1663: This is the same as a PetscScalar except in code that is automatically differentiated it is
1664: treated as a constant (not an indendent or dependent variable)
1666: .seealso: PetscReal, PassiveReal, PetscScalar
1667: M*/
1669: /*MC
1670: PassiveReal - PETSc type that represents a PetscReal
1672: Level: beginner
1674: This is the same as a PetscReal except in code that is automatically differentiated it is
1675: treated as a constant (not an indendent or dependent variable)
1677: .seealso: PetscScalar, PetscReal, PassiveScalar
1678: M*/
1680: /*MC
1681: MPIU_SCALAR - MPI datatype corresponding to PetscScalar
1683: Level: beginner
1685: Note: In MPI calls that require an MPI datatype that matches a PetscScalar or array of PetscScalars
1686: pass this value
1688: .seealso: PetscReal, PassiveReal, PassiveScalar, PetscScalar
1689: M*/
1691: /*
1692: The IBM include files define hz, here we hide it so that it may be used
1693: as a regular user variable.
1694: */
1695: #if defined(hz)
1696: #undef hz
1697: #endif
1699: /* For arrays that contain filenames or paths */
1702: #if defined(PETSC_HAVE_LIMITS_H)
1703: #include <limits.h>
1704: #endif
1705: #if defined(PETSC_HAVE_SYS_PARAM_H)
1706: #include <sys/param.h>
1707: #endif
1708: #if defined(PETSC_HAVE_SYS_TYPES_H)
1709: #include <sys/types.h>
1710: #endif
1711: #if defined(MAXPATHLEN)
1712: # define PETSC_MAX_PATH_LEN MAXPATHLEN
1713: #elif defined(MAX_PATH)
1714: # define PETSC_MAX_PATH_LEN MAX_PATH
1715: #elif defined(_MAX_PATH)
1716: # define PETSC_MAX_PATH_LEN _MAX_PATH
1717: #else
1718: # define PETSC_MAX_PATH_LEN 4096
1719: #endif
1722: #endif