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