-
Notifications
You must be signed in to change notification settings - Fork 3
/
Cell2D.cpp
109 lines (82 loc) · 1.89 KB
/
Cell2D.cpp
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#include "Cell2D.h"
unsigned Cell2D::getIdent() {
return this->ident;
}
Point Cell2D::getVertex1() {
return this->vertex[0];
}
Point Cell2D::getVertex2() {
return this->vertex[1];
}
Point Cell2D::getVertex3() {
return this->vertex[2];
}
Point Cell2D::getVertex4() {
return this->vertex[3];
}
Face Cell2D::getFace1() {
return this->faces[0];
}
Face Cell2D::getFace2() {
return this->faces[1];
}
Face Cell2D::getFace3() {
return this->faces[2];
}
Face Cell2D::getFace4() {
return this->faces[3];
}
Cell2D* Cell2D::getNeighbor1() {
return neighbor1;
}
Cell2D* Cell2D::getNeighbor2() {
return neighbor2;
}
Cell2D* Cell2D::getNeighbor3() {
return neighbor3;
}
Cell2D* Cell2D::getNeighbor4() {
return neighbor4;
}
double Cell2D::getVol() {
double x1 = this->vertex[0].getX();
double x2 = this->vertex[1].getX();
double x3 = this->vertex[2].getX();
double x4 = this->vertex[3].getX();
double y1 = this->vertex[0].getY();
double y2 = this->vertex[1].getY();
double y3 = this->vertex[2].getY();
double y4 = this->vertex[3].getY();
double vol = 0.5 * ((x1 - x3)*(y2 - y4) + (x4 - x2)*(y1 - y3));
return vol;
}
void Cell2D::setIdent(unsigned ident) {
this->ident = ident;
}
void Cell2D::setVertex1(Point p) {
this->vertex[0] = p;
}
void Cell2D::setVertex2(Point p) {
this->vertex[1] = p;
}
void Cell2D::setVertex3(Point p) {
this->vertex[2] = p;
}
void Cell2D::setVertex4(Point p) {
this->vertex[3] = p;
}
void Cell2D::setNeighbor1(Cell2D* currentCell) {
this->neighbor1 = currentCell;
}
void Cell2D::setNeighbor2(Cell2D* currentCell) {
this->neighbor2 = currentCell;
}
void Cell2D::setNeighbor3(Cell2D* currentCell) {
this->neighbor3 = currentCell;
}
void Cell2D::setNeighbor4(Cell2D* currentCell) {
this->neighbor4 = currentCell;
}
void Cell2D::setVol(double vol) {
this->vol = vol;
}