Refactoring
This commit is contained in:
parent
28f2d885f3
commit
5c4172a949
|
@ -56,7 +56,8 @@ add_subdirectory(${MATPLOTPLUSPLUS_SOURCE_DIR} ${MATPLOTPLUSPLUS_BINARY_DIR})
|
||||||
##threed-beam-fea
|
##threed-beam-fea
|
||||||
set(threed-beam-fea_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/threed-beam-fea)
|
set(threed-beam-fea_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/threed-beam-fea)
|
||||||
download_project(PROJ threed-beam-fea
|
download_project(PROJ threed-beam-fea
|
||||||
GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git
|
# GIT_REPOSITORY https://github.com/IasonManolas/threed-beam-fea.git
|
||||||
|
GIT_REPOSITORY https://gitea-s2i2s.isti.cnr.it/manolas/threed-beam-fea.git
|
||||||
GIT_TAG master
|
GIT_TAG master
|
||||||
BINARY_DIR ${threed-beam-fea_BINARY_DIR}
|
BINARY_DIR ${threed-beam-fea_BINARY_DIR}
|
||||||
PREFIX ${EXTERNAL_DEPS_DIR}
|
PREFIX ${EXTERNAL_DEPS_DIR}
|
||||||
|
|
|
@ -214,13 +214,13 @@ struct Settings
|
||||||
jsonFile.close();
|
jsonFile.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool load(const std::filesystem::path &jsonFilepath)
|
bool load(const std::filesystem::path &loadFromPath)
|
||||||
{
|
{
|
||||||
assert(std::filesystem::is_directory(loadFromPath));
|
assert(std::filesystem::is_directory(loadFromPath));
|
||||||
//Load optimal X
|
//Load optimal X
|
||||||
nlohmann::json json;
|
nlohmann::json json;
|
||||||
std::filesystem::path jsonFilepath(
|
std::filesystem::path jsonFilepath(
|
||||||
std::filesystem::path(loadFromPath).append(JsonKeys::filename));
|
std::filesystem::path(loadFromPath).append(defaultFilename));
|
||||||
if (!std::filesystem::exists(jsonFilepath)) {
|
if (!std::filesystem::exists(jsonFilepath)) {
|
||||||
std::cerr << "Optimization settings could not be loaded because input filepath does "
|
std::cerr << "Optimization settings could not be loaded because input filepath does "
|
||||||
"not exist:"
|
"not exist:"
|
||||||
|
@ -670,7 +670,7 @@ struct Settings
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Load full pattern files
|
// Load full pattern files
|
||||||
for (const auto &fileEntry : filesystem::directory_iterator(
|
for (const auto &fileEntry : std::filesystem::directory_iterator(
|
||||||
std::filesystem::path(simulationScenarioPath).append("Full"))) {
|
std::filesystem::path(simulationScenarioPath).append("Full"))) {
|
||||||
const auto filepath = fileEntry.path();
|
const auto filepath = fileEntry.path();
|
||||||
if (filepath.extension() == ".json") {
|
if (filepath.extension() == ".json") {
|
||||||
|
@ -781,8 +781,8 @@ struct Settings
|
||||||
const double beamWidth = std::sqrt(A);
|
const double beamWidth = std::sqrt(A);
|
||||||
const double beamHeight = beamWidth;
|
const double beamHeight = beamWidth;
|
||||||
CrossSectionType elementDimensions(beamWidth, beamHeight);
|
CrossSectionType elementDimensions(beamWidth, beamHeight);
|
||||||
for (int ei = 0; ei < pTiledReducedPattern_simulationMesh->EN(); ei++) {
|
for (int ei = 0; ei < pReducedPattern_simulationMesh->EN(); ei++) {
|
||||||
Element &e = pTiledReducedPattern_simulationMesh->elements[ei];
|
Element &e = pReducedPattern_simulationMesh->elements[ei];
|
||||||
e.setDimensions(elementDimensions);
|
e.setDimensions(elementDimensions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -792,8 +792,8 @@ struct Settings
|
||||||
if (optimalXVariables.contains(ymLabel)) {
|
if (optimalXVariables.contains(ymLabel)) {
|
||||||
const double E = optimalXVariables.at(ymLabel);
|
const double E = optimalXVariables.at(ymLabel);
|
||||||
const ElementMaterial elementMaterial(poissonsRatio, E);
|
const ElementMaterial elementMaterial(poissonsRatio, E);
|
||||||
for (int ei = 0; ei < pTiledReducedPattern_simulationMesh->EN(); ei++) {
|
for (int ei = 0; ei < pReducedPattern_simulationMesh->EN(); ei++) {
|
||||||
Element &e = pTiledReducedPattern_simulationMesh->elements[ei];
|
Element &e = pReducedPattern_simulationMesh->elements[ei];
|
||||||
e.setMaterial(elementMaterial);
|
e.setMaterial(elementMaterial);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -801,8 +801,8 @@ struct Settings
|
||||||
const std::string JLabel = "J";
|
const std::string JLabel = "J";
|
||||||
if (optimalXVariables.contains(JLabel)) {
|
if (optimalXVariables.contains(JLabel)) {
|
||||||
const double J = optimalXVariables.at(JLabel);
|
const double J = optimalXVariables.at(JLabel);
|
||||||
for (int ei = 0; ei < pTiledReducedPattern_simulationMesh->EN(); ei++) {
|
for (int ei = 0; ei < pReducedPattern_simulationMesh->EN(); ei++) {
|
||||||
Element &e = pTiledReducedPattern_simulationMesh->elements[ei];
|
Element &e = pReducedPattern_simulationMesh->elements[ei];
|
||||||
e.dimensions.inertia.J = J;
|
e.dimensions.inertia.J = J;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -810,8 +810,8 @@ struct Settings
|
||||||
const std::string I2Label = "I2";
|
const std::string I2Label = "I2";
|
||||||
if (optimalXVariables.contains(I2Label)) {
|
if (optimalXVariables.contains(I2Label)) {
|
||||||
const double I2 = optimalXVariables.at(I2Label);
|
const double I2 = optimalXVariables.at(I2Label);
|
||||||
for (int ei = 0; ei < pTiledReducedPattern_simulationMesh->EN(); ei++) {
|
for (int ei = 0; ei < pReducedPattern_simulationMesh->EN(); ei++) {
|
||||||
Element &e = pTiledReducedPattern_simulationMesh->elements[ei];
|
Element &e = pReducedPattern_simulationMesh->elements[ei];
|
||||||
e.dimensions.inertia.I2 = I2;
|
e.dimensions.inertia.I2 = I2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -819,12 +819,12 @@ struct Settings
|
||||||
const std::string I3Label = "I3";
|
const std::string I3Label = "I3";
|
||||||
if (optimalXVariables.contains(I3Label)) {
|
if (optimalXVariables.contains(I3Label)) {
|
||||||
const double I3 = optimalXVariables.at(I3Label);
|
const double I3 = optimalXVariables.at(I3Label);
|
||||||
for (int ei = 0; ei < pTiledReducedPattern_simulationMesh->EN(); ei++) {
|
for (int ei = 0; ei < pReducedPattern_simulationMesh->EN(); ei++) {
|
||||||
Element &e = pTiledReducedPattern_simulationMesh->elements[ei];
|
Element &e = pReducedPattern_simulationMesh->elements[ei];
|
||||||
e.dimensions.inertia.I3 = I3;
|
e.dimensions.inertia.I3 = I3;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pTiledReducedPattern_simulationMesh->reset();
|
pReducedPattern_simulationMesh->reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if POLYSCOPE_DEFINED
|
#if POLYSCOPE_DEFINED
|
||||||
|
|
Loading…
Reference in New Issue