/
matrix.hpp
68 lines (45 loc) · 1.2 KB
/
matrix.hpp
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef _MATRIX_HPP_
#define _MATRIX_HPP_
#include <vector>
#include <ostream>
typedef unsigned int uint;
typedef short int sint;
typedef double dtype;
const dtype DEF_NULL = 1e-8;
#define HYD_VAR 4
#define NUM_OF_GHOST_CELL 2
//first index row
class matrix{
private:
uint r,c;
std::vector<dtype> v;
public:
matrix();
matrix(uint, uint);
matrix(const matrix&);
void resize(uint, uint);
const dtype & at(uint, uint) const;
dtype & at(uint, uint);
uint row()const{return r;}
uint col()const{return c;}
friend std::ostream& operator << (std::ostream&, const matrix&);
};
class hyd
{
private:
uint r, c;
uint nghost;
std::vector<dtype> v;
public:
hyd();
hyd(uint, uint);
hyd(const hyd&);
void resize(uint, uint);
const dtype & at(uint, uint, uint) const;
dtype & at(uint, uint, uint);
uint row()const{return r;}
uint col()const{return c;}
friend std::ostream& operator << (std::ostream&, const hyd&);
};
std::ostream& operator << (std::ostream& o, const std::vector<dtype>& vec);
#endif // _MATRIX_HPP_