Refactoring
This commit is contained in:
parent
e70b4e9863
commit
adaf49627f
6
beam.hpp
6
beam.hpp
|
@ -65,16 +65,16 @@ struct ElementMaterial
|
||||||
: poissonsRatio(poissonsRatio), youngsModulus(youngsModulus)
|
: poissonsRatio(poissonsRatio), youngsModulus(youngsModulus)
|
||||||
{
|
{
|
||||||
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
|
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
|
||||||
updateProperties();
|
updateShearModulus();
|
||||||
}
|
}
|
||||||
ElementMaterial() : poissonsRatio(0.3), youngsModulus(200 * 1e9) { updateProperties(); }
|
ElementMaterial() : poissonsRatio(0.3), youngsModulus(1e9) { updateShearModulus(); }
|
||||||
std::string toString() const
|
std::string toString() const
|
||||||
{
|
{
|
||||||
return std::string("Material:") + std::string("\nPoisson's ratio=")
|
return std::string("Material:") + std::string("\nPoisson's ratio=")
|
||||||
+ std::to_string(poissonsRatio) + std::string("\nYoung's Modulus(GPa)=")
|
+ std::to_string(poissonsRatio) + std::string("\nYoung's Modulus(GPa)=")
|
||||||
+ std::to_string(youngsModulus / 1e9);
|
+ std::to_string(youngsModulus / 1e9);
|
||||||
}
|
}
|
||||||
void updateProperties() { G = youngsModulus / (2 * (1 + poissonsRatio)); }
|
void updateShearModulus() { G = youngsModulus / (2 * (1 + poissonsRatio)); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // BEAM_HPP
|
#endif // BEAM_HPP
|
||||||
|
|
Loading…
Reference in New Issue