Actual source code: petscsys.h
1: /*
2: Provides access to system related and general utility routines.
3: */
6: #include petsc.h
9: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetArchType(char[],size_t);
10: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetHostName(char[],size_t);
11: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetUserName(char[],size_t);
12: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetProgramName(char[],size_t);
13: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetProgramName(const char[]);
14: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetDate(char[],size_t);
16: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortInt(PetscInt,PetscInt[]);
17: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortIntWithPermutation(PetscInt,const PetscInt[],PetscInt[]);
18: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortStrWithPermutation(PetscInt,const char*[],PetscInt[]);
19: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortIntWithArray(PetscInt,PetscInt[],PetscInt[]);
20: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortIntWithScalarArray(PetscInt,PetscInt[],PetscScalar[]);
21: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortReal(PetscInt,PetscReal[]);
22: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSortRealWithPermutation(PetscInt,const PetscReal[],PetscInt[]);
24: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetDisplay(void);
25: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetDisplay(char[],size_t);
29: typedef enum {RANDOM_DEFAULT,RANDOM_DEFAULT_REAL,RANDOM_DEFAULT_IMAGINARY} PetscRandomType;
31: /*S
32: PetscRandom - Abstract PETSc object that manages generating random numbers
34: Level: intermediate
36: Concepts: random numbers
38: .seealso: PetscRandomCreate(), PetscRandomGetValue()
39: S*/
40: typedef struct _p_PetscRandom* PetscRandom;
42: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomCreate(MPI_Comm,PetscRandomType,PetscRandom*);
43: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomGetValue(PetscRandom,PetscScalar*);
44: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomGetInterval(PetscRandom,PetscScalar*,PetscScalar*);
45: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomSetInterval(PetscRandom,PetscScalar,PetscScalar);
46: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomSetSeed(PetscRandom,unsigned long);
47: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomGetSeed(PetscRandom,unsigned long *);
48: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomSeed(PetscRandom);
49: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscRandomDestroy(PetscRandom);
51: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetFullPath(const char[],char[],size_t);
52: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetRelativePath(const char[],char[],size_t);
53: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetWorkingDirectory(char[],size_t);
54: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetRealPath(char[],char[]);
55: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetHomeDirectory(char[],size_t);
56: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscTestFile(const char[],char,PetscTruth*);
57: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscTestDirectory(const char[],char,PetscTruth*);
59: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBinaryRead(int,void*,PetscInt,PetscDataType);
60: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSynchronizedBinaryRead(MPI_Comm,int,void*,PetscInt,PetscDataType);
61: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSynchronizedBinaryWrite(MPI_Comm,int,void*,PetscInt,PetscDataType,PetscTruth);
62: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBinaryWrite(int,void*,PetscInt,PetscDataType,PetscTruth);
63: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBinaryOpen(const char[],PetscFileMode,int *);
64: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBinaryClose(int);
65: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSharedTmp(MPI_Comm,PetscTruth *);
66: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSharedWorkingDirectory(MPI_Comm,PetscTruth *);
67: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGetTmp(MPI_Comm,char *,size_t);
68: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscFileRetrieve(MPI_Comm,const char *,char *,size_t,PetscTruth*);
69: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscLs(MPI_Comm,const char[],char*,size_t,PetscTruth*);
71: /*
72: In binary files variables are stored using the following lengths,
73: regardless of how they are stored in memory on any one particular
74: machine. Use these rather then sizeof() in computing sizes for
75: PetscBinarySeek().
76: */
77: #define PETSC_BINARY_INT_SIZE (32/8)
78: #define PETSC_BINARY_FLOAT_SIZE (32/8)
79: #define PETSC_BINARY_CHAR_SIZE (8/8)
80: #define PETSC_BINARY_SHORT_SIZE (16/8)
81: #define PETSC_BINARY_DOUBLE_SIZE (64/8)
82: #define PETSC_BINARY_SCALAR_SIZE sizeof(PetscScalar)
84: /*E
85: PetscBinarySeekType - argument to PetscBinarySeek()
87: Level: advanced
89: .seealso: PetscBinarySeek(), PetscSynchronizedBinarySeek()
90: E*/
91: typedef enum {PETSC_BINARY_SEEK_SET = 0,PETSC_BINARY_SEEK_CUR = 1,PETSC_BINARY_SEEK_END = 2} PetscBinarySeekType;
92: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscBinarySeek(int,off_t,PetscBinarySeekType,off_t*);
93: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSynchronizedBinarySeek(MPI_Comm,int,off_t,PetscBinarySeekType,off_t*);
95: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetDebugger(const char[],PetscTruth);
96: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetDefaultDebugger(void);
97: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSetDebuggerFromString(char*);
98: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscAttachDebugger(void);
99: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscStopForDebugger(void);
101: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGatherNumberOfMessages(MPI_Comm,PetscMPIInt*,PetscMPIInt*,PetscMPIInt*);
102: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGatherMessageLengths(MPI_Comm,PetscMPIInt,PetscMPIInt,PetscMPIInt*,PetscMPIInt**,PetscMPIInt**);
103: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscGatherMessageLengths2(MPI_Comm,PetscMPIInt,PetscMPIInt,PetscMPIInt*,PetscMPIInt*,PetscMPIInt**,PetscMPIInt**,PetscMPIInt**);
104: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPostIrecvInt(MPI_Comm,PetscMPIInt,PetscMPIInt,PetscMPIInt*,PetscMPIInt*,PetscInt***,MPI_Request**);
105: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscPostIrecvScalar(MPI_Comm,PetscMPIInt,PetscMPIInt,PetscMPIInt*,PetscMPIInt*,PetscScalar***,MPI_Request**);
107: EXTERN PetscErrorCode PETSC_DLLEXPORT PetscSSEIsEnabled(MPI_Comm,PetscTruth *,PetscTruth *);
109: /*E
110: InsertMode - Whether entries are inserted or added into vectors or matrices
112: Level: beginner
114: .seealso: VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
115: VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(),
116: MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd()
117: E*/
118: typedef enum {NOT_SET_VALUES, INSERT_VALUES, ADD_VALUES, MAX_VALUES} InsertMode;
120: /*MC
121: INSERT_VALUES - Put a value into a vector or matrix, overwrites any previous value
123: Level: beginner
125: .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
126: VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), ADD_VALUES, INSERT_VALUES,
127: MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd()
129: M*/
131: /*MC
132: ADD_VALUES - Adds a value into a vector or matrix, if there previously was no value, just puts the
133: value into that location
135: Level: beginner
137: .seealso: InsertMode, VecSetValues(), MatSetValues(), VecSetValue(), VecSetValuesBlocked(),
138: VecSetValuesLocal(), VecSetValuesBlockedLocal(), MatSetValuesBlocked(), ADD_VALUES, INSERT_VALUES,
139: MatSetValuesBlockedLocal(), MatSetValuesLocal(), VecScatterBegin(), VecScatterEnd()
141: M*/
143: /*MC
144: MAX_VALUES - Puts the maximum of the scattered/gathered value and the current value into each location
146: Level: beginner
148: .seealso: InsertMode, VecScatterBegin(), VecScatterEnd(), ADD_VALUES, INSERT_VALUES
150: M*/
152: /*E
153: ScatterMode - Determines the direction of a scatter
155: Level: beginner
157: .seealso: VecScatter, VecScatterBegin(), VecScatterEnd()
158: E*/
159: typedef enum {SCATTER_FORWARD=0, SCATTER_REVERSE=1, SCATTER_FORWARD_LOCAL=2, SCATTER_REVERSE_LOCAL=3, SCATTER_LOCAL=2} ScatterMode;
161: /*MC
162: SCATTER_FORWARD - Scatters the values as dictated by the VecScatterCreate() call
164: Level: beginner
166: .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD_LOCAL,
167: SCATTER_REVERSE_LOCAL
169: M*/
171: /*MC
172: SCATTER_REVERSE - Moves the values in the opposite direction then the directions indicated in
173: in the VecScatterCreate()
175: Level: beginner
177: .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL,
178: SCATTER_REVERSE_LOCAL
180: M*/
182: /*MC
183: SCATTER_FORWARD_LOCAL - Scatters the values as dictated by the VecScatterCreate() call except NO parallel communication
184: is done. Any variables that have be moved between processes are ignored
186: Level: developer
188: .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_REVERSE, SCATTER_FORWARD,
189: SCATTER_REVERSE_LOCAL
191: M*/
193: /*MC
194: SCATTER_REVERSE_LOCAL - Moves the values in the opposite direction then the directions indicated in
195: in the VecScatterCreate() except NO parallel communication
196: is done. Any variables that have be moved between processes are ignored
198: Level: developer
200: .seealso: VecScatter, ScatterMode, VecScatterCreate(), VecScatterBegin(), VecScatterEnd(), SCATTER_FORWARD, SCATTER_FORWARD_LOCAL,
201: SCATTER_REVERSE
203: M*/
207: #endif /* __PETSCSYS_H */