HydroCODE_1D 0.1
This is a implementation of fully explict forward Euler scheme for 1-D Euler equations of motion on Lagrangian/Eulerian coordinate
tools.h
浏览该文件的文档.
1
7#ifndef TOOLS_H
8#define TOOLS_H
9
10#define MAX(a,b) (((a) > (b)) ? (a) : (b))
11
12/* minmod function */
13#ifdef _WIN32
14inline double minmod2(const double s_L, const double s_R);
15inline double minmod3(const double s_L, const double s_R, const double s_m);
16#elif __linux__
17inline double minmod2(const double s_L, const double s_R) __attribute__((always_inline));
18inline double minmod3(const double s_L, const double s_R, const double s_m) __attribute__((always_inline));
19#endif
20
22// sys_pro.c
24void DispPro(const double pro, const int step);
25
26int CreateDir(const char* pPath);
27
28void init_mem (double * p[], const int n, int ** cell_pt);
29void init_mem_int(int * p[], const int n, int ** cell_pt);
30
32// mat_algo.c
34void mat_mul(const double A[], const double B[], double C[], const int m, const int p, const int n);
35void mat_add(const double A[], const double B[], double C[], const int m, const int n);
36void mat_sub(const double A[], const double B[], double C[], const int m, const int n);
37
38int rinv(double a[], const int n);
39
40
44inline double minmod2(const double s_L, const double s_R)
45{
46 if(s_L * s_R <= 0.0)
47 return 0.0;
48 else if(s_R > 0.0 && s_R < s_L)
49 return s_R;
50 else if(s_R <= 0.0 && s_R > s_L)
51 return s_R;
52 else // fabs(s_R) > fabs(s_L)
53 return s_L;
54}
55
59inline double minmod3(const double s_L, const double s_R, const double s_m)
60{
61 if(s_L * s_m <= 0.0 || s_R * s_m <= 0.0)
62 return 0.0;
63 else if(s_m > 0.0 && s_m < s_L && s_m < s_R)
64 return s_m;
65 else if(s_m <= 0.0 && s_m > s_L && s_m > s_R)
66 return s_m;
67 else if(s_R > 0.0 && s_R < s_L)
68 return s_R;
69 else if(s_R <= 0.0 && s_R > s_L)
70 return s_R;
71 else
72 return s_L;
73}
74
75#endif
int rinv(double a[], const int n)
void init_mem_int(int *p[], const int n, int **cell_pt)
This is a function that initializes memory for integer data.
Definition: sys_pro.c:132
int CreateDir(const char *pPath)
This is a function that recursively creates folders.
Definition: sys_pro.c:72
void mat_add(const double A[], const double B[], double C[], const int m, const int n)
double minmod2(const double s_L, const double s_R)
Minmod limiter function of two variables.
Definition: tools.h:44
void init_mem(double *p[], const int n, int **cell_pt)
This is a function that initializes memory for double-precision floating-point data.
Definition: sys_pro.c:107
double minmod3(const double s_L, const double s_R, const double s_m)
Minmod limiter function of three variables.
Definition: tools.h:59
void mat_sub(const double A[], const double B[], double C[], const int m, const int n)
void DispPro(const double pro, const int step)
This function print a progress bar on one line of standard output.
Definition: sys_pro.c:37
void mat_mul(const double A[], const double B[], double C[], const int m, const int p, const int n)