forked from li12242/AdvectionDiffusionSolver_FDM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.h
47 lines (32 loc) · 975 Bytes
/
utils.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//
// Created by li12242 on 15-9-14.
//
#ifndef PROGRAM_UTILS_H
#define PROGRAM_UTILS_H
double *BuildVector(int Nrows);
double *DestroyVector(double *v);
int *BuildIntVector(int Nrows);
int *DestroyIntVector(int *v);
int **BuildIntMatrix(int Nrows, int Ncols);
int **DestroyIntMatrix(int **A);
double **BuildMatrix(int Nrows, int Ncols);
double **DestroyMatrix(double **A);
void PrintMatrix(char *message, double **A, int Nrows, int Ncols);
void SaveMatrix(char *filename, double **A, int Nrows, int Ncols);
typedef struct{
int nx; // num of points along x axis
int ny; // num of points along y axis
double dx; // distance between x points
double dy; // distance between y points
double *x; // x coordinate
double *y; // y coordinate
} structMesh;
typedef struct{
double u;
double v;
double Dx;
double Dy;
} physics;
#define signf(a) ( (a>0)?1:-1 )
#define minf(a, b) ( (a>b)?b:a )
#endif //PROGRAM_UTILS_H