From 8ba4d18e3b5c84ebbf6893fd063554f156141e02 Mon Sep 17 00:00:00 2001 From: "KOKO\\Mimi" Date: Tue, 29 Sep 2026 19:09:28 +0900 Subject: [PATCH] style(thermal): apply repository formatting to semantic additions --- include/fesa/elements/ds4_thermal.h | 3 +- .../materials/isotropic_thermal_material.cpp | 7 +- tests/unit/model/thermal_semantics_test.cpp | 66 ++++++++++--------- 3 files changed, 41 insertions(+), 35 deletions(-) diff --git a/include/fesa/elements/ds4_thermal.h b/include/fesa/elements/ds4_thermal.h index 1c6f0af..727a1c9 100644 --- a/include/fesa/elements/ds4_thermal.h +++ b/include/fesa/elements/ds4_thermal.h @@ -64,7 +64,8 @@ inline const SourceEntityId& Ds4ThermalDefinition::SourceId() const noexcept { return source_id_; } -inline std::string_view Ds4ThermalDefinition::SourceElementType() const noexcept { +inline std::string_view Ds4ThermalDefinition::SourceElementType() + const noexcept { return "DS4"; } diff --git a/src/fesa/materials/isotropic_thermal_material.cpp b/src/fesa/materials/isotropic_thermal_material.cpp index 6b39c74..2f30661 100644 --- a/src/fesa/materials/isotropic_thermal_material.cpp +++ b/src/fesa/materials/isotropic_thermal_material.cpp @@ -28,9 +28,10 @@ Result IsotropicThermalMaterial::Create( if (!std::isfinite(conductivity) || !(conductivity > 0.0) || !std::isfinite(density) || !(density > 0.0) || !std::isfinite(specific_heat) || !(specific_heat > 0.0)) { - return Result::Failure(InvalidThermalMaterial( - source_id, location, - "Conductivity, density, and specific heat must be finite and positive.")); + return Result::Failure( + InvalidThermalMaterial(source_id, location, + "Conductivity, density, and specific heat must " + "be finite and positive.")); } return Result::Success(IsotropicThermalMaterial{ std::move(source_id), std::move(name), conductivity, density, diff --git a/tests/unit/model/thermal_semantics_test.cpp b/tests/unit/model/thermal_semantics_test.cpp index cfa65ec..08229aa 100644 --- a/tests/unit/model/thermal_semantics_test.cpp +++ b/tests/unit/model/thermal_semantics_test.cpp @@ -1,5 +1,3 @@ -#include "fesa/model/domain.h" - #include #include @@ -11,6 +9,7 @@ #include "fesa/analysis/analysis_model.h" #include "fesa/elements/ds4_thermal.h" #include "fesa/materials/isotropic_thermal_material.h" +#include "fesa/model/domain.h" namespace { @@ -19,24 +18,31 @@ fesa::SourceLocation Location() { return {"models/thermal.inp", 10U}; } fesa::ModelDefinition ValidDefinition() { fesa::ModelDefinition definition{}; definition.source_path = "models/thermal.inp"; - definition.nodes = { - {{"Plate", 1, "1"}, {0.0, 0.0, 0.0}, Location()}, - {{"Plate", 2, "2"}, {1.0, 0.0, 0.0}, Location()}, - {{"Plate", 3, "3"}, {1.0, 1.0, 0.0}, Location()}, - {{"Plate", 4, "4"}, {0.0, 1.0, 0.0}, Location()}, - {{"Plate", 5, "5"}, {2.0, 2.0, 0.0}, Location()}}; - definition.thermal_materials = { - {{"", 1, "Thermal-Steel"}, "Thermal-Steel", 45.0, 7800.0, 500.0, - Location()}}; + definition.nodes = {{{"Plate", 1, "1"}, {0.0, 0.0, 0.0}, Location()}, + {{"Plate", 2, "2"}, {1.0, 0.0, 0.0}, Location()}, + {{"Plate", 3, "3"}, {1.0, 1.0, 0.0}, Location()}, + {{"Plate", 4, "4"}, {0.0, 1.0, 0.0}, Location()}, + {{"Plate", 5, "5"}, {2.0, 2.0, 0.0}, Location()}}; + definition.thermal_materials = {{{"", 1, "Thermal-Steel"}, + "Thermal-Steel", + 45.0, + 7800.0, + 500.0, + Location()}}; definition.thermal_sections = { {{"", 1, "Section"}, "Section", 0.01, 0U, Location()}}; - definition.thermal_elements = {{{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, - 0U, Location()}}; + definition.thermal_elements = { + {{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, 0U, Location()}}; definition.thermal_initial_conditions = {{0U, 12.5, Location()}}; definition.thermal_model_boundaries = {{0U, 11, 10.0, Location()}}; - definition.thermal_step = {"Heat", 0.2, 1.0, 100U, false, + definition.thermal_step = {"Heat", + 0.2, + 1.0, + 100U, + false, {{0U, 11, 20.0, Location()}}, - {{0U, 15, -5.0, Location()}}, Location()}; + {{0U, 15, -5.0, Location()}}, + Location()}; return definition; } @@ -66,9 +72,9 @@ TEST(IsotropicThermalMaterial, RequiresFinitePositivePropertiesAndIdentity) { ASSERT_FALSE(invalid.HasValue()); EXPECT_EQ(invalid.GetStatus().Category(), fesa::FailureCategory::kModel); - EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create( - {"", 7, "Thermal-Steel"}, "Thermal-Steel", 45.0, 0.0, - 500.0, Location()) + EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create({"", 7, "Thermal-Steel"}, + "Thermal-Steel", 45.0, + 0.0, 500.0, Location()) .HasValue()); EXPECT_FALSE(fesa::IsotropicThermalMaterial::Create( {"", 7, "Thermal-Steel"}, "Thermal-Steel", 45.0, 7800.0, @@ -114,8 +120,7 @@ TEST(ThermalDomain, RejectsInactiveTargetsConflictsAndMixedElements) { EXPECT_EQ(conflicting.GetStatus().Category(), fesa::FailureCategory::kModel); invalid = ValidDefinition(); - invalid.elements.push_back( - {{"Plate", 9, "9"}, {0U, 1U}, 0U, 0U, Location()}); + invalid.elements.push_back({{"Plate", 9, "9"}, {0U, 1U}, 0U, 0U, Location()}); const auto mixed = fesa::Domain::Create(std::move(invalid)); ASSERT_FALSE(mixed.HasValue()); EXPECT_EQ(mixed.GetStatus().Category(), fesa::FailureCategory::kModel); @@ -189,20 +194,19 @@ TEST(ThermalAnalysisModel, KeepsThermalSectionMaterialIndicesSeparateFromDomainMaterials) { auto definition = ValidDefinition(); definition.materials = {{"Unused-Structural", 210.0e9, 0.3, Location()}}; - definition.thermal_materials.push_back( - {{"", 2, "Thermal-Aluminum"}, "Thermal-Aluminum", 120.0, 2700.0, - 900.0, Location()}); + definition.thermal_materials.push_back({{"", 2, "Thermal-Aluminum"}, + "Thermal-Aluminum", + 120.0, + 2700.0, + 900.0, + Location()}); definition.thermal_sections = { {{"", 1, "Section-A"}, "Section-A", 0.01, 1U, Location()}, {{"", 2, "Section-B"}, "Section-B", 0.02, 0U, Location()}}; - definition.nodes.push_back( - {{"Plate", 6, "6"}, {3.0, 0.0, 0.0}, Location()}); - definition.nodes.push_back( - {{"Plate", 7, "7"}, {4.0, 0.0, 0.0}, Location()}); - definition.nodes.push_back( - {{"Plate", 8, "8"}, {4.0, 1.0, 0.0}, Location()}); - definition.nodes.push_back( - {{"Plate", 9, "9"}, {3.0, 1.0, 0.0}, Location()}); + definition.nodes.push_back({{"Plate", 6, "6"}, {3.0, 0.0, 0.0}, Location()}); + definition.nodes.push_back({{"Plate", 7, "7"}, {4.0, 0.0, 0.0}, Location()}); + definition.nodes.push_back({{"Plate", 8, "8"}, {4.0, 1.0, 0.0}, Location()}); + definition.nodes.push_back({{"Plate", 9, "9"}, {3.0, 1.0, 0.0}, Location()}); definition.thermal_elements = { {{"Plate", 8, "8"}, {0U, 1U, 2U, 3U}, 0U, Location()}, {{"Plate", 9, "9"}, {5U, 6U, 7U, 8U}, 1U, Location()}};