MySources/beam.hpp

45 lines
1.3 KiB
C++

#ifndef BEAM_HPP
#define BEAM_HPP
#include <assert.h>
#include <cmath>
#include <iostream>
struct RectangularBeamDimensions {
inline static std::string name{"Rectangular"};
float b;
float h;
RectangularBeamDimensions(const float &width, const float &height)
: b(width), h(height) {
assert(width > 0 && height > 0);
}
RectangularBeamDimensions() : b(0.002), h(0.002) {}
};
struct CylindricalBeamDimensions {
inline static std::string name{"Cylindrical"};
float od; // Cylinder outside diameter
float
id; // Cylinder inside diameter
// https://www.engineeringtoolbox.com/area-moment-inertia-d_1328.html
CylindricalBeamDimensions(const float &outsideDiameter,
const float &insideDiameter)
: od(outsideDiameter), id(insideDiameter) {
assert(outsideDiameter > 0 && insideDiameter > 0 &&
outsideDiameter > insideDiameter);
}
CylindricalBeamDimensions() : od(0.03), id(0.026) {}
};
struct ElementMaterial {
float poissonsRatio;
float youngsModulusGPascal;
ElementMaterial(const float &poissonsRatio, const float &youngsModulusGPascal)
: poissonsRatio(poissonsRatio),
youngsModulusGPascal(youngsModulusGPascal) {
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
}
ElementMaterial() : poissonsRatio(0.3), youngsModulusGPascal(200) {}
};
#endif // BEAM_HPP