Refactoring

This commit is contained in:
iasonmanolas 2022-07-12 13:12:33 +03:00
parent ba52c4215e
commit 395bf92486
2 changed files with 38 additions and 12 deletions

View File

@ -253,6 +253,23 @@ void SimulationMesh::updateElementalFrames() {
} }
} }
#ifdef POLYSCOPE_DEFINED
polyscope::CurveNetwork *SimulationMesh::registerForDrawing(
const std::optional<std::array<double, 3>> &desiredColor, const bool &shouldEnable)
{
const double drawingRadius = getBeamDimensions()[0].b
/ (std::sqrt(
2.0)); //polyscope can only draw a circular cross section
// std::cout << __FUNCTION__ << " revert this" << std::endl;
return VCGEdgeMesh::registerForDrawing(desiredColor, /*0.08*/ drawingRadius, shouldEnable);
}
void SimulationMesh::unregister() const
{
VCGEdgeMesh::unregister();
}
#endif
void SimulationMesh::setBeamCrossSection( void SimulationMesh::setBeamCrossSection(
const CrossSectionType &beamDimensions) { const CrossSectionType &beamDimensions) {
for (size_t ei = 0; ei < EN(); ei++) { for (size_t ei = 0; ei < EN(); ei++) {
@ -268,20 +285,22 @@ void SimulationMesh::setBeamMaterial(const double &pr, const double &ym) {
} }
} }
std::vector<CrossSectionType> SimulationMesh::getBeamDimensions() { std::vector<CrossSectionType> SimulationMesh::getBeamDimensions()
std::vector<CrossSectionType> beamDimensions(EN()); {
for (size_t ei = 0; ei < EN(); ei++) { std::vector<CrossSectionType> beamDimensions(EN());
beamDimensions[ei] = elements[ei].dimensions; for (size_t ei = 0; ei < EN(); ei++) {
} beamDimensions[ei] = elements[ei].dimensions;
return beamDimensions; }
return beamDimensions;
} }
std::vector<ElementMaterial> SimulationMesh::getBeamMaterial() { std::vector<ElementMaterial> SimulationMesh::getBeamMaterial()
std::vector<ElementMaterial> beamMaterial(EN()); {
for (size_t ei = 0; ei < EN(); ei++) { std::vector<ElementMaterial> beamMaterial(EN());
beamMaterial[ei] = elements[ei].material; for (size_t ei = 0; ei < EN(); ei++) {
} beamMaterial[ei] = elements[ei].material;
return beamMaterial; }
return beamMaterial;
} }
bool SimulationMesh::load(const std::string &plyFilename) bool SimulationMesh::load(const std::string &plyFilename)

View File

@ -59,6 +59,13 @@ public:
void reset(); void reset();
SimulationMesh(); SimulationMesh();
void updateElementalFrames(); void updateElementalFrames();
#ifdef POLYSCOPE_DEFINED
polyscope::CurveNetwork *registerForDrawing(
const std::optional<std::array<double, 3>> &desiredColor = std::nullopt,
const bool &shouldEnable = true);
void unregister() const;
#endif
}; };
struct Element { struct Element {