Skip to content

Commit

Permalink
Clean up recording
Browse files Browse the repository at this point in the history
  • Loading branch information
TLCFEM committed Oct 31, 2023
1 parent 5587cd0 commit c27c945
Show file tree
Hide file tree
Showing 65 changed files with 336 additions and 418 deletions.
6 changes: 3 additions & 3 deletions Element/Beam/B21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ int B21::reset_status() {
}

vector<vec> B21::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void B21::print() {
Expand Down
14 changes: 7 additions & 7 deletions Element/Beam/B21H.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ int B21H::reset_status() {
}

vector<vec> B21H::record(const OutputType P) {
vector<vec> output;
append_to(output, int_pt[0].b_section->record(P));
append_to(output, int_pt[1].b_section->record(P));
for(const auto& I : elastic_int_pt) append_to(output, I.b_section->record(P));
append_to(output, int_pt[2].b_section->record(P));
append_to(output, int_pt[3].b_section->record(P));
return output;
vector<vec> data;
append_to(data, int_pt[0].b_section->record(P));
append_to(data, int_pt[1].b_section->record(P));
for(const auto& I : elastic_int_pt) append_to(data, I.b_section->record(P));
append_to(data, int_pt[2].b_section->record(P));
append_to(data, int_pt[3].b_section->record(P));
return data;
}

void B21H::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Beam/B31.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,9 @@ int B31::reset_status() {
}

vector<vec> B31::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void B31::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Beam/B31OS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,9 @@ int B31OS::reset_status() {
}

vector<vec> B31OS::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void B31OS::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Beam/F21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ vector<vec> F21::record(const OutputType P) {
if(P == OutputType::BEAME) return {current_local_deformation};
if(P == OutputType::BEAMS) return {current_local_resistance};

vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void F21::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Beam/F21H.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,9 @@ vector<vec> F21H::record(const OutputType P) {
if(P == OutputType::BEAME) return {current_local_deformation};
if(P == OutputType::BEAMS) return {current_local_resistance};

vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void F21H::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Beam/F31.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ vector<vec> F31::record(const OutputType P) {
if(P == OutputType::BEAME) return {current_local_deformation};
if(P == OutputType::BEAMS) return {current_local_resistance};

vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.b_section->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.b_section->record(P));
return data;
}

void F31::print() {
Expand Down
2 changes: 0 additions & 2 deletions Element/Beam/MVLEM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,12 +206,10 @@ int MVLEM::reset_status() {

vector<vec> MVLEM::record(const OutputType P) {
vector<vec> data;

for(const auto& I : axial_spring) {
append_to(data, I.c_material->record(P));
append_to(data, I.s_material->record(P));
}

return data;
}

Expand Down
2 changes: 1 addition & 1 deletion Element/Beam/NMB21.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ int NMB21::reset_status() {
}

vector<vec> NMB21::record(const OutputType P) {
if(P == OutputType::BEAME) return {b_trans->to_local_vec(get_current_displacement())};
if(P == OutputType::BEAME) return {b_section->get_current_deformation() * length};
if(P == OutputType::BEAMS) return {b_section->get_current_resistance()};

return b_section->record(P);
Expand Down
2 changes: 1 addition & 1 deletion Element/Beam/NMB31.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int NMB31::reset_status() {
}

vector<vec> NMB31::record(const OutputType P) {
if(P == OutputType::BEAME) return {b_trans->to_local_vec(get_current_displacement())};
if(P == OutputType::BEAME) return {b_section->get_current_deformation() * length};
if(P == OutputType::BEAMS) return {b_section->get_current_resistance()};

return b_section->record(P);
Expand Down
4 changes: 2 additions & 2 deletions Element/Cube/C3D20.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,9 +178,9 @@ int C3D20::reset_status() {

mat C3D20::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::cube(coordinate, order, c_node); }

vector<vec> C3D20::record(const OutputType T) {
vector<vec> C3D20::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.c_material->record(T));
for(const auto& I : int_pt) append_to(data, I.c_material->record(P));
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion Element/Cube/C3D4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ int C3D4::clear_status() { return c_material->clear_status(); }

int C3D4::reset_status() { return c_material->reset_status(); }

vector<vec> C3D4::record(const OutputType T) { return c_material->record(T); }
vector<vec> C3D4::record(const OutputType P) { return c_material->record(P); }

void C3D4::print() {
suanpan_info("C3D4 element connects:", node_encoding);
Expand Down
11 changes: 3 additions & 8 deletions Element/Cube/C3D8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,19 +198,14 @@ int C3D8::reset_status() {

mat C3D8::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::cube(coordinate, order, c_node); }

vector<vec> C3D8::record(const OutputType T) {
vector<vec> C3D8::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.c_material->record(T));
for(const auto& I : int_pt) append_to(data, I.c_material->record(P));
return data;
}

void C3D8::print() {
suanpan_info("A C3D8 element{}{}.\n", int_scheme == 'R'
? " reduced integration"
: int_scheme == 'I'
? " Iron's integration"
: " full integration",
nlgeom ? " nonlinear geometry" : "");
suanpan_info("A C3D8 element{}{}.\n", int_scheme == 'R' ? " reduced integration" : int_scheme == 'I' ? " Iron's integration" : " full integration", nlgeom ? " nonlinear geometry" : "");
suanpan_info("The element connects nodes:", node_encoding);
if(!is_initialized()) return;
suanpan_info("Material:\n");
Expand Down
4 changes: 2 additions & 2 deletions Element/Cube/C3D8I.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,9 @@ int C3D8I::reset_status() {

mat C3D8I::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::cube(coordinate, order, c_node); }

vector<vec> C3D8I::record(const OutputType T) {
vector<vec> C3D8I::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.c_material->record(T));
for(const auto& I : int_pt) append_to(data, I.c_material->record(P));
return data;
}

Expand Down
4 changes: 2 additions & 2 deletions Element/Cube/CIN3D8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,9 +227,9 @@ int CIN3D8::reset_status() {
return code;
}

vector<vec> CIN3D8::record(const OutputType T) {
vector<vec> CIN3D8::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.c_material->record(T));
for(const auto& I : int_pt) append_to(data, I.c_material->record(P));
return data;
}

Expand Down
6 changes: 3 additions & 3 deletions Element/Cube/DC3D4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ int DC3D4::clear_status() {

int DC3D4::reset_status() { return c_material->reset_status(); }

vector<vec> DC3D4::record(const OutputType T) {
if(T == OutputType::DAMAGE) return {get_current_displacement()(d_dof)};
vector<vec> DC3D4::record(const OutputType P) {
if(P == OutputType::DAMAGE) return {get_current_displacement()(d_dof)};

return c_material->record(T);
return c_material->record(P);
}

void DC3D4::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Cube/DC3D8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ int DC3D8::reset_status() {
return code;
}

vector<vec> DC3D8::record(const OutputType T) {
if(T == OutputType::DAMAGE) return {get_current_displacement()(d_dof)};
vector<vec> DC3D8::record(const OutputType P) {
if(P == OutputType::DAMAGE) return {get_current_displacement()(d_dof)};

vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.c_material->record(T));
for(const auto& I : int_pt) append_to(data, I.c_material->record(P));
return data;
}

Expand Down
2 changes: 1 addition & 1 deletion Element/Membrane/Axisymmetric/CAX3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ int CAX3::clear_status() { return m_material->clear_status(); }

int CAX3::reset_status() { return m_material->reset_status(); }

vector<vec> CAX3::record(const OutputType T) { return m_material->record(T); }
vector<vec> CAX3::record(const OutputType P) { return m_material->record(P); }

void CAX3::print() {
suanpan_info("CAX3 element connects:", node_encoding);
Expand Down
6 changes: 3 additions & 3 deletions Element/Membrane/Axisymmetric/CAX4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,9 @@ int CAX4::reset_status() {
}

vector<vec> CAX4::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.m_material->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

void CAX4::print() {
Expand Down
4 changes: 2 additions & 2 deletions Element/Membrane/Axisymmetric/CAX8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -135,9 +135,9 @@ int CAX8::reset_status() {
return code;
}

vector<vec> CAX8::record(const OutputType T) {
vector<vec> CAX8::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(T));
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

Expand Down
6 changes: 3 additions & 3 deletions Element/Membrane/CSM/CSMQ.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ int CSMQ::reset_status() {
mat CSMQ::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::quad(coordinate, order, m_node); }

vector<vec> CSMQ::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.m_material->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

void CSMQ::print() {
Expand Down
24 changes: 3 additions & 21 deletions Element/Membrane/CSM/CSMQ4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,27 +187,9 @@ int CSMQ4::reset_status() {
mat CSMQ4::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::quad(coordinate, order, m_node); }

vector<vec> CSMQ4::record(const OutputType P) {
vector<vec> output;

if(P == OutputType::NMISES) {
mat A(int_pt.size(), 4);
vec B(int_pt.size(), fill::zeros);

for(size_t I = 0; I < int_pt.size(); ++I) {
if(const auto C = int_pt[I].m_material->record(OutputType::MISES); !C.empty()) B(I) = C.cbegin()->at(0);
A.row(I) = interpolation::linear(int_pt[I].coor);
}

const vec X = solve(A, B);

output.emplace_back(vec{dot(interpolation::linear(-1., -1.), X)});
output.emplace_back(vec{dot(interpolation::linear(1., -1.), X)});
output.emplace_back(vec{dot(interpolation::linear(1., 1.), X)});
output.emplace_back(vec{dot(interpolation::linear(-1., 1.), X)});
}
else for(const auto& I : int_pt) append_to(output, I.m_material->record(P));

return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

void CSMQ4::print() {
Expand Down
6 changes: 3 additions & 3 deletions Element/Membrane/CSM/CSMQ8.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,9 @@ int CSMQ8::reset_status() {
mat CSMQ8::compute_shape_function(const mat& coordinate, const unsigned order) const { return shape::quad(coordinate, order, m_node); }

vector<vec> CSMQ8::record(const OutputType P) {
vector<vec> output;
for(const auto& I : int_pt) append_to(output, I.m_material->record(P));
return output;
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

void CSMQ8::print() {
Expand Down
4 changes: 2 additions & 2 deletions Element/Membrane/CSM/CSMT3.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -195,9 +195,9 @@ int CSMT3::reset_status() {
return code;
}

vector<vec> CSMT3::record(const OutputType T) {
vector<vec> CSMT3::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(T));
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

Expand Down
4 changes: 2 additions & 2 deletions Element/Membrane/Drilling/Allman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,9 +162,9 @@ int Allman::reset_status() {
return code;
}

vector<vec> Allman::record(const OutputType T) {
vector<vec> Allman::record(const OutputType P) {
vector<vec> data;
for(const auto& I : int_pt) append_to(data, I.m_material->record(T));
for(const auto& I : int_pt) append_to(data, I.m_material->record(P));
return data;
}

Expand Down
Loading

0 comments on commit c27c945

Please sign in to comment.