forked from alborzgh/StressCalc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsoilmat.cpp
63 lines (54 loc) · 1.15 KB
/
soilmat.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
#include<soilmat.h>
#include<math.h>
int soilLayer::numLayers = 0;
const double pi = atan(1.0) * 4.0;
soilLayer::soilLayer()
{
++numLayers;
layerName = QString("Layer" + QString::number(numLayers));
layerH = 0;
layerC = 0;
layerPhi = 0;
layerG = 0;
layerGamma = 0;
layerColor = QColor(100,100,100,100);
topStrength = 0;
topStress = 0;
botStrength = 0;
botStress = 0;
}
soilLayer::soilLayer(QString lName, double nThick, double lUnitWeight, double lCohesion, double lFA,double lStiffness, QColor color)
{
++numLayers;
layerName = lName;
layerH = nThick;
layerC = lCohesion;
layerPhi = lFA;
layerG = lStiffness;
layerGamma = lUnitWeight;
layerColor = color;
topStrength = 0;
topStress = 0;
botStrength = 0;
botStress = 0;
}
soilLayer::~soilLayer()
{
}
void
soilLayer::update()
{
calcStress();
calcStrength();
}
void
soilLayer::calcStress()
{
botStress = topStress + layerGamma * layerH;
}
void
soilLayer::calcStrength()
{
topStrength = layerC + topStress * tan(layerPhi*pi/180);
botStrength = layerC + botStress * tan(layerPhi*pi/180);
}