MySources/beam.hpp

45 lines
1.4 KiB
C++
Raw Normal View History

2020-11-27 11:47:21 +01:00
#ifndef BEAM_HPP
#define BEAM_HPP
#include <assert.h>
#include <cmath>
#include <iostream>
struct RectangularBeamDimensions {
inline static std::string name{"Rectangular"};
2020-11-27 11:47:21 +01:00
float b;
float h;
RectangularBeamDimensions(const float &width, const float &height)
: b(width), h(height) {
assert(width > 0 && height > 0);
}
2021-01-12 13:40:25 +01:00
RectangularBeamDimensions() : b(0.002), h(0.002) {}
2020-11-27 11:47:21 +01:00
};
2020-12-09 16:59:18 +01:00
struct CylindricalBeamDimensions {
inline static std::string name{"Cylindrical"};
2020-11-27 11:47:21 +01:00
float od; // Cylinder outside diameter
float
id; // Cylinder inside diameter
// https://www.engineeringtoolbox.com/area-moment-inertia-d_1328.html
2020-12-09 16:59:18 +01:00
CylindricalBeamDimensions(const float &outsideDiameter,
const float &insideDiameter)
2020-11-27 11:47:21 +01:00
: od(outsideDiameter), id(insideDiameter) {
assert(outsideDiameter > 0 && insideDiameter > 0 &&
outsideDiameter > insideDiameter);
}
2020-12-09 16:59:18 +01:00
CylindricalBeamDimensions() : od(0.03), id(0.026) {}
2020-11-27 11:47:21 +01:00
};
struct ElementMaterial {
float poissonsRatio; // NOTE: if I make this double the unit
// tests produced different results and thus fail
double youngsModulus;
ElementMaterial(const float &poissonsRatio, const double &youngsModulus)
: poissonsRatio(poissonsRatio), youngsModulus(youngsModulus) {
2020-11-27 11:47:21 +01:00
assert(poissonsRatio <= 0.5 && poissonsRatio >= -1);
}
ElementMaterial() : poissonsRatio(0.3), youngsModulus(200) {}
2020-11-27 11:47:21 +01:00
};
#endif // BEAM_HPP