-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathBeam2.cpp
59 lines (43 loc) · 1.37 KB
/
Beam2.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
// Beam2.cpp: Implementierung der Klasse Beam2.
//
//////////////////////////////////////////////////////////////////////
#include "Beam2.h"
#include <cmath>
namespace fesolv {
Beam2::Beam2(Model* model, FEint number, FEint node1, FEint node2, FEdouble area, FEint mat):Element(model,number)
{
_node1 = node1;
_node2 = node2;
_mat = mat;
_area = area;
}
Beam2::~Beam2()
{
}
void Beam2::GetStiffnessMatrix(Matrix<FEdouble>* S)
{
Node* node1 = _model->GetNode(_node1);
Node* node2 = _model->GetNode(_node2);
Material* mat = _model->GetMaterial(_mat);
FEdouble l = sqrt((node2->GetY()-node1->GetY())*(node2->GetY()-node1->GetY())+(node2->GetX()-node1->GetX())*(node2->GetX()-node1->GetX()));
FEdouble c = (node2->GetX()-node1->GetX())/sqrt((node2->GetX()-node1->GetX())*(node2->GetX()-node1->GetX())+(node2->GetY()-node1->GetY())*(node2->GetY()-node1->GetY()));
FEdouble s = sin(acos(c));
S->SetDimension(4,4);
(*S)(0,0) = (*S)(2,2) = c*c;
(*S)(1,0) = (*S)(0,1) = (*S)(2,3) = (*S)(3,2) =c*s;
(*S)(0,3) = (*S)(3,0) = (*S)(1,2) = (*S)(2,1) = -c*s;
(*S)(1,1) = (*S)(3,3) = s*s;
(*S)(0,2) = (*S)(2,0) = -s*s;
(*S)(1,3) = (*S)(3,1) = -c*c;
(*S)*=(mat->GetEmodul()*_area)/l;
}
void Beam2::GetStiffnessNumberVector(IntVector* vec)
{
vec->resize(4,0);
(*vec)[0]=_node1;
(*vec)[1]=_node1;
(*vec)[2]=_node2;
(*vec)[3]=_node2;
NumberToInsertPosition(vec);
}
}//end namespace