xref: /petsc/include/petscsys.h (revision 0752156a28ac8f8e9dfaef7ce98457a01bf27fb6)
1 /* $Id: sys.h,v 1.30 1997/09/18 14:41:05 bsmith Exp bsmith $ */
2 /*
3     Provides access to system related and general utility routines.
4 */
5 #if !defined(__SYS_PACKAGE)
6 #define __SYS_PACKAGE
7 
8 #include "petsc.h"
9 
10 extern int  PetscGetArchType(char *,int);
11 extern int  PetscGetHostName(char *,int);
12 extern int  PetscGetUserName(char *,int);
13 
14 extern char *PetscGetDate();
15 
16 extern int  PetscSortInt(int,int*);
17 extern int  PetscSortIntWithPermutation(int,int*,int*);
18 extern int  PetscSortDouble(int,double*);
19 extern int  PetscSortDoubleWithPermutation(int,double*,int*);
20 
21 extern int  PetscSetDisplay();
22 extern int  PetscGetDisplay(char *,int);
23 
24 #define PETSCRANDOM_COOKIE PETSC_COOKIE+19
25 
26 typedef enum { RANDOM_DEFAULT, RANDOM_DEFAULT_REAL,
27                RANDOM_DEFAULT_IMAGINARY } PetscRandomType;
28 
29 typedef struct _p_PetscRandom*   PetscRandom;
30 
31 extern int PetscRandomCreate(MPI_Comm,PetscRandomType,PetscRandom*);
32 extern int PetscRandomGetValue(PetscRandom,Scalar*);
33 extern int PetscRandomSetInterval(PetscRandom,Scalar,Scalar);
34 extern int PetscRandomDestroy(PetscRandom);
35 
36 extern int PetscGetFullPath(char*,char*,int);
37 extern int PetscGetRelativePath(char*,char*,int);
38 extern int PetscGetWorkingDirectory(char *, int);
39 extern int PetscGetRealPath(char *,char*);
40 extern int PetscGetHomeDirectory(int,char*);
41 
42 extern int PetscBinaryRead(int,void*,int,PetscDataType);
43 extern int PetscBinaryWrite(int,void*,int,PetscDataType,int);
44 extern int PetscBinaryOpen(char *,int,int *);
45 extern int PetscBinaryClose(int);
46 
47 /*
48    In binary files variables are stored using the following lengths,
49   regardless of how they are stored in memory on any one particular
50   machine. Use these rather then sizeof() in computing sizes for
51   PetscBinarySeek().
52 */
53 #define BINARY_INT_SIZE    32
54 #define BINARY_FLOAT_SIZE  32
55 #define BINARY_CHAR_SIZE    8
56 #define BINARY_SHORT_SIZE  16
57 #define BINARY_DOUBLE_SIZE 64
58 #define BINARY_SCALAR_SIZE sizeof(Scalar)
59 
60 typedef enum {BINARY_SEEK_SET = 0, BINARY_SEEK_CUR = 1, BINARY_SEEK_END = 2} PetscBinarySeekType;
61 extern int PetscBinarySeek(int,int,PetscBinarySeekType);
62 
63 extern int PetscSetDebugger(char *,int,char *);
64 extern int PetscAttachDebugger();
65 
66 #endif
67 
68