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