feat: add thermal semantic domain model

This commit is contained in:
KOKO\Mimi
2026-09-29 18:33:44 +09:00
parent e6fd9e9e6b
commit 254247efc1
11 changed files with 755 additions and 2 deletions
@@ -0,0 +1,76 @@
#include "fesa/materials/isotropic_thermal_material.h"
#include <cmath>
#include <string>
#include <utility>
namespace fesa {
namespace {
Status InvalidThermalMaterial(const SourceEntityId& source_id,
const SourceLocation& location,
const std::string& message) {
return Status::Failure(
FailureCategory::kModel,
{{Severity::kError, "invalid-thermal-material", location, "*MATERIAL",
source_id.source_label_text, message}});
}
} // namespace
Result<IsotropicThermalMaterial> IsotropicThermalMaterial::Create(
SourceEntityId source_id, std::string name, double conductivity,
double density, double specific_heat, SourceLocation location) {
if (name.empty() || source_id.source_label_text.empty()) {
return Result<IsotropicThermalMaterial>::Failure(InvalidThermalMaterial(
source_id, location, "Material source identity must not be empty."));
}
if (!std::isfinite(conductivity) || !(conductivity > 0.0) ||
!std::isfinite(density) || !(density > 0.0) ||
!std::isfinite(specific_heat) || !(specific_heat > 0.0)) {
return Result<IsotropicThermalMaterial>::Failure(InvalidThermalMaterial(
source_id, location,
"Conductivity, density, and specific heat must be finite and positive."));
}
return Result<IsotropicThermalMaterial>::Success(IsotropicThermalMaterial{
std::move(source_id), std::move(name), conductivity, density,
specific_heat, std::move(location)});
}
MaterialKind IsotropicThermalMaterial::Kind() const noexcept {
return MaterialKind::kIsotropicThermal;
}
const SourceEntityId& IsotropicThermalMaterial::SourceId() const noexcept {
return source_id_;
}
const SourceLocation& IsotropicThermalMaterial::Location() const noexcept {
return location_;
}
const std::string& IsotropicThermalMaterial::Name() const noexcept {
return name_;
}
double IsotropicThermalMaterial::Conductivity() const noexcept {
return conductivity_;
}
double IsotropicThermalMaterial::Density() const noexcept { return density_; }
double IsotropicThermalMaterial::SpecificHeat() const noexcept {
return specific_heat_;
}
IsotropicThermalMaterial::IsotropicThermalMaterial(
SourceEntityId source_id, std::string name, double conductivity,
double density, double specific_heat, SourceLocation location)
: source_id_{std::move(source_id)},
name_{std::move(name)},
conductivity_{conductivity},
density_{density},
specific_heat_{specific_heat},
location_{std::move(location)} {}
} // namespace fesa