feat: add thermal semantic domain model
This commit is contained in:
@@ -1,11 +1,22 @@
|
||||
#include "fesa/analysis/analysis_model.h"
|
||||
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace fesa {
|
||||
|
||||
Result<AnalysisModel> AnalysisModel::Create(const Domain& domain) {
|
||||
if (domain.ThermalStep() != nullptr) {
|
||||
if (!domain.Steps().Empty()) {
|
||||
return Result<AnalysisModel>::Failure(Status::Failure(
|
||||
FailureCategory::kModel,
|
||||
{{Severity::kError, "mixed-thermal-procedure",
|
||||
domain.ThermalStep()->location, "STEP", domain.ThermalStep()->name,
|
||||
"Thermal and structural steps cannot coexist."}}));
|
||||
}
|
||||
return Result<AnalysisModel>::Success(AnalysisModel{domain});
|
||||
}
|
||||
if (domain.Steps().Empty()) {
|
||||
return Result<AnalysisModel>::Failure(
|
||||
Status::Failure(FailureCategory::kInput,
|
||||
@@ -33,6 +44,12 @@ const StepDefinition& AnalysisModel::Step() const noexcept {
|
||||
return domain_->Steps()[0U];
|
||||
}
|
||||
|
||||
bool AnalysisModel::IsThermal() const noexcept { return is_thermal_; }
|
||||
|
||||
const ThermalStepDefinition* AnalysisModel::ThermalStep() const noexcept {
|
||||
return is_thermal_ ? domain_->ThermalStep() : nullptr;
|
||||
}
|
||||
|
||||
const std::vector<EntityIndex>& AnalysisModel::ActiveElements() const noexcept {
|
||||
return active_elements_;
|
||||
}
|
||||
@@ -65,12 +82,45 @@ const std::vector<EntityIndex>& AnalysisModel::ActiveLoads() const noexcept {
|
||||
return active_loads_;
|
||||
}
|
||||
|
||||
const std::vector<EntityIndex>& AnalysisModel::ActiveThermalElements()
|
||||
const noexcept {
|
||||
return active_thermal_elements_;
|
||||
}
|
||||
|
||||
const std::vector<EntityIndex>& AnalysisModel::ActiveThermalNodes()
|
||||
const noexcept {
|
||||
return active_thermal_nodes_;
|
||||
}
|
||||
|
||||
const std::vector<SurfacePressureLoadDefinition>&
|
||||
AnalysisModel::ActiveSurfacePressureLoads() const noexcept {
|
||||
static const std::vector<SurfacePressureLoadDefinition> kNoSurfacePressures;
|
||||
if (is_thermal_) return kNoSurfacePressures;
|
||||
return Step().SurfacePressureLoads();
|
||||
}
|
||||
|
||||
AnalysisModel::AnalysisModel(const Domain& domain) : domain_{&domain} {
|
||||
if (domain.ThermalStep() != nullptr) {
|
||||
is_thermal_ = true;
|
||||
std::vector<bool> active_nodes(domain.Nodes().size(), false);
|
||||
const std::size_t first_element = domain.Elements().Size() -
|
||||
domain.ThermalElements().Size();
|
||||
for (std::size_t index = 0U; index < domain.ThermalElements().Size();
|
||||
++index) {
|
||||
active_thermal_elements_.push_back(
|
||||
static_cast<EntityIndex>(first_element + index));
|
||||
for (const EntityIndex node :
|
||||
domain.ThermalElements()[index].NodeIndices()) {
|
||||
active_nodes[node] = true;
|
||||
}
|
||||
}
|
||||
for (std::size_t index = 0U; index < active_nodes.size(); ++index) {
|
||||
if (active_nodes[index]) {
|
||||
active_thermal_nodes_.push_back(static_cast<EntityIndex>(index));
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
std::vector<bool> reachable_materials(domain.Materials().Size(), false);
|
||||
std::vector<bool> reachable_properties(domain.Properties().Size(), false);
|
||||
std::vector<bool> reachable_sections(domain.Sections().Size(), false);
|
||||
|
||||
Reference in New Issue
Block a user