Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
ElmerCSC
GitHub Repository: ElmerCSC/elmerfem
Path: blob/devel/elmergrid/src/egutils.h
3196 views
1
/* nrutil.h + common.h -> egutils.h */
2
3
4
#ifndef _EGUTILS_H_
5
#define _EGUTILS_H_
6
7
8
typedef double Real;
9
#define Rvector dvector
10
#define Ivector ivector
11
#define Cvector cvector
12
#define Rmatrix dmatrix
13
#define Imatrix imatrix
14
#define free_Rvector free_dvector
15
#define free_Ivector free_ivector
16
#define free_Cvector free_cvector
17
#define free_Rmatrix free_dmatrix
18
#define free_Imatrix free_imatrix
19
#define TRUE 1
20
#define FALSE 0
21
22
/* Numerical Recipes' uncopyrighted vector and matrix allocation
23
and deallocation routines. */
24
int MemoryUsage();
25
26
void nrerror(const char error_text[]);
27
28
float *vector(int,int);
29
int *ivector(int,int);
30
char *cvector(int,int);
31
unsigned long *lvector(int,int);
32
double *dvector(int,int);
33
34
float **matrix(int,int,int,int);
35
double **dmatrix(int,int,int,int);
36
int **imatrix(int,int,int,int);
37
float **submatrix(float **,int,int,int,int,int,int);
38
double ***f3tensor(int nrl,int nrh,int ncl,int nch,int ndl,int ndh);
39
40
void free_vector(float *,int,int);
41
void free_ivector(int *,int,int);
42
void free_cvector(char *,int,int);
43
void free_lvector(unsigned long *,int,int);
44
void free_dvector(double *,int,int);
45
46
void free_matrix(float **,int,int,int,int);
47
void free_dmatrix(double **,int,int,int,int);
48
void free_imatrix(int **,int,int,int,int);
49
void free_submatrix(float **,int,int,int,int);
50
void free_f3tensor(double ***t,int nrl,int nrh,int ncl,int nch,int ndl,int ndh);
51
52
/* Common subroutines that operate on vectors, matrices and other basic
53
data types: Find the minimum or maximum place or value, find
54
the mean, calculate the mean difference, save to or load from
55
an external file etc. */
56
57
void timer_init();
58
void timer_activate(const char *prefix);
59
void timer_show();
60
61
void bigerror(const char error_text[]);
62
void smallerror(const char error_text[]);
63
int FileExists(char *filename);
64
Real Minimum(Real *vector,int first,int last);
65
int Minimi(Real *vector,int first,int last);
66
Real Maximum(Real *vector,int first,int last);
67
int Maximi(Real *vector,int first,int last);
68
void AddExtension(const char *fname1,char *fname2,const char *newext);
69
int StringToStrings(const char *buf,char argv[10][15],int argc,char separator);
70
int StringToReal(const char *buf,Real *dest,int maxcnt,char separator);
71
int StringToInteger(const char *buf,int *dest,int maxcnt,char separator);
72
int StringToIntegerNoZero(const char *buf,int *dest,int maxcnt,char separator);
73
int next_int(char **start);
74
int next_int_n(char **start, int n);
75
Real next_real(char **start);
76
void SortIndex( int N, double *Key, int *Ord );
77
#endif
78
79