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