forked from vkorchagova/RKDG2D
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMesh2D.h
executable file
·91 lines (57 loc) · 1.94 KB
/
Mesh2D.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#pragma once
#include "numvector.h"
#include <vector>
#include <fstream>
namespace std
{
class Mesh2D
{
private:
ofstream writer;
public:
//- Space step in x direction
double hx;
//- Space step in y direction
double hy;
//- Number of internal cells
int nInternalCells;
//- Number of ghost cells
int nGhostCells;
//- Coordinates of nodes (x,y)
vector<numvector<double, 2>> nodes;
//- Horizontal edges (nodeLeft, nodeRight)
vector<numvector<int, 2>> edgesHor;
//- Vertical edges (nodeDown, nodeUp)
vector<numvector<int, 2>> edgesVer;
//- Mesh cells (edgeDown, edgeUp, edgeLeft, edgeRight)
vector<numvector<int, 4>> cells;
//- Internal mesh cells
vector<numvector<int, 4>> internalCells;
//- Ghost mesh cells (for boundary)
vector<numvector<int, 4>> ghostCells;
//- Cell centers
vector<numvector<double, 2>> cellCenters;
//- Neighbour cells for horizontal edges
vector<numvector<int, 2>> neighbCellsHorEdges;
//- Neighbour cells for vertical edges
vector<numvector<int, 2>> neighbCellsVerEdges;
public:
//- Default constructor
Mesh2D() {}
//- Copy constructor
Mesh2D(const Mesh2D &mesh);
//- operator =
Mesh2D& operator=(const Mesh2D&);
//- construct mesh by number of cells and size of flow domain
Mesh2D(int nx, int ny, double Lx, double Ly);
~Mesh2D();
//- get coordinates of nodes of given mesh cell
numvector<numvector<double,2>,4> getCellCoordinates(int iCell);
//- transform global coordinate system for give cell to local CS
numvector<double, 2> globalToLocal(int iCell, numvector<double, 2> coord);
//- transform global coordinate system for give cell to local CS
numvector<double, 2> localToGlobal(int iCell, numvector<double, 2> coord);
//- export mesh
void exportMesh();
};// end Mesh 2D
} // end namespace std;