-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathElement.cpp
More file actions
109 lines (85 loc) · 2.22 KB
/
Element.cpp
File metadata and controls
109 lines (85 loc) · 2.22 KB
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
// Element.cpp: Implementierung der Klasse Element.
//
//////////////////////////////////////////////////////////////////////
#include "Element.h"
#include <cmath> //sqrt
#include <cstddef> //size_t
#include <iomanip>
namespace fesolv {
Element::Element(Model* model, FEint number)
{
_model = model;
_number = number;
}
Element::~Element()
{
}
void Element::NumberToInsertPosition(IntVector* vec)
{
nodes* node = _model->GetNodes();
FEint pos;
FEint nodeidx = 0;
const_node_iterator iter;
for(FEint i = 0; i < static_cast<FEint>(vec->size()); i++){
pos = 0;
iter = node->begin();
for ( ; iter != node->end(); iter++ )
{
if((*iter)->GetNumber() == (*vec)[i]){
if(nodeidx == (*vec)[i]){
pos++;
//3D not supported yet
/*if(i > 1 && (*vec)[i-2] == (*vec)[i])
pos++;*/
}
nodeidx = (*vec)[i];
(*vec)[i] = pos;
pos++;
break;
} else {
pos+=GetDimension();
}
}
}
}
std::ostream& operator<<(std::ostream& fout, Element* element)
{
Matrix<FEdouble>* stiffnessmatrix = new Matrix<FEdouble>(0);
element->GetStiffnessMatrix(stiffnessmatrix);
fout << "Element Stiffnessmatrix: " << element->GetNumber() << std::endl;
fout << stiffnessmatrix << std::endl;
delete stiffnessmatrix;
return fout;
}
std::ostream& operator<<(std::ostream& fout, DoubleVector* vec)
{
for(FEint i=0;i< static_cast<FEint>(vec->size());i++) {
fout << std::setprecision(4) << std::right << std::scientific << std::setw(12) << (*vec)[i] << std::endl;
}
return fout;
}
std::ostream& operator<<(std::ostream& fout, Matrix<FEdouble>* mat)
{
FEint rows = mat->GetNumberOfRows();
FEint columns = mat->GetNumberOfColumns();
for(FEint i=0;i<rows;i++) {
for(FEint j=0;j<columns;j++) {
fout << std::setprecision(4) << std::right << std::scientific << std::setw(12) << (*mat)(i,j) << " ";
}
fout << std::endl;
}
return fout;
}
std::ostream& operator<<(std::ostream& fout, Matrix<FEdouble> mat)
{
FEint rows = mat.GetNumberOfRows();
FEint columns = mat.GetNumberOfColumns();
for(FEint i=0;i<rows;i++) {
for(FEint j=0;j<columns;j++) {
fout << std::setprecision(4) << std::right << std::scientific << std::setw(12) << mat(i,j) << " ";
}
fout << std::endl;
}
return fout;
}
} //end namespace