Integrate Refactor solver sources and dual MSVC CMake builds
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
#include "fesa/results/prepared_results_writer.h"
|
||||
|
||||
#include "fesa/results/dynamic_results_writer.h"
|
||||
#include "fesa/results/eigen_results_writer.h"
|
||||
#include "fesa/results/nonlinear_results_writer.h"
|
||||
#include "fesa/results/results_writer.h"
|
||||
#include "fesa/results/solid_results_writer.h"
|
||||
#include "fesa/results/thermal_results_writer.h"
|
||||
|
||||
namespace fesa {
|
||||
|
||||
Status WritePreparedAnalysisResult(
|
||||
const std::filesystem::path& results_path, const Domain& domain,
|
||||
const PreparedAnalysisOutcome& outcome,
|
||||
const std::vector<Diagnostic>& diagnostics, ResultsWriter& linear_writer,
|
||||
NonlinearResultsWriter& nonlinear_writer, EigenResultsWriter& eigen_writer,
|
||||
DynamicResultsWriter* dynamic_writer, ThermalResultsWriter* thermal_writer,
|
||||
SolidResultsWriter* solid_writer) {
|
||||
if (std::holds_alternative<SolidStaticExecutionResult>(outcome) ||
|
||||
std::holds_alternative<SolidFrequencyState>(outcome) ||
|
||||
std::holds_alternative<SolidDynamicExecutionResult>(outcome)) {
|
||||
if (solid_writer == nullptr)
|
||||
return Status::Failure(FailureCategory::kOutput,
|
||||
{{Severity::kError,
|
||||
"missing-solid-writer",
|
||||
{},
|
||||
"",
|
||||
{},
|
||||
"Solid result writer is required."}});
|
||||
if (const auto* result = std::get_if<SolidStaticExecutionResult>(&outcome))
|
||||
return solid_writer->Write(results_path, domain, result->state,
|
||||
diagnostics);
|
||||
if (const auto* result = std::get_if<SolidFrequencyState>(&outcome))
|
||||
return solid_writer->Write(results_path, domain, *result,
|
||||
diagnostics);
|
||||
return solid_writer->Write(
|
||||
results_path, domain,
|
||||
std::get<SolidDynamicExecutionResult>(outcome).state, diagnostics);
|
||||
}
|
||||
if (std::holds_alternative<ThermalExecutionResult>(outcome)) {
|
||||
if (thermal_writer == nullptr) {
|
||||
return Status::Failure(FailureCategory::kOutput,
|
||||
{{Severity::kError,
|
||||
"missing-thermal-writer",
|
||||
{},
|
||||
"HEAT TRANSFER",
|
||||
{},
|
||||
"Thermal result writer is required."}});
|
||||
}
|
||||
return thermal_writer->Write(
|
||||
results_path, domain,
|
||||
std::get<ThermalExecutionResult>(outcome).state, diagnostics);
|
||||
}
|
||||
if (std::holds_alternative<DynamicExecutionResult>(outcome)) {
|
||||
if (dynamic_writer == nullptr)
|
||||
return Status::Failure(FailureCategory::kOutput,
|
||||
{{Severity::kError,
|
||||
"missing-dynamic-writer",
|
||||
{},
|
||||
"DYNAMIC",
|
||||
{},
|
||||
"Dynamic result writer is required."}});
|
||||
return dynamic_writer->Write(
|
||||
results_path, domain,
|
||||
std::get<DynamicExecutionResult>(outcome).state, diagnostics);
|
||||
}
|
||||
if (std::holds_alternative<EigenAnalysisState>(outcome)) {
|
||||
return eigen_writer.Write(results_path, domain,
|
||||
std::get<EigenAnalysisState>(outcome),
|
||||
diagnostics);
|
||||
}
|
||||
if (std::holds_alternative<LinearStaticExecutionResult>(outcome)) {
|
||||
return linear_writer.Write(
|
||||
results_path, domain,
|
||||
std::get<LinearStaticExecutionResult>(outcome).state, diagnostics);
|
||||
}
|
||||
|
||||
return nonlinear_writer.Write(
|
||||
results_path, domain,
|
||||
std::get<NonlinearStaticExecutionResult>(outcome).state, diagnostics);
|
||||
}
|
||||
|
||||
} // namespace fesa
|
||||
@@ -22,18 +22,11 @@ Status RecoveryFailure(const std::string& code, const SourceLocation& location,
|
||||
|
||||
bool SameSourceIdentity(const SourceEntityId& left,
|
||||
const SourceEntityId& right) {
|
||||
return left.instance_name == right.instance_name &&
|
||||
left.source_label == right.source_label &&
|
||||
left.source_label_text == right.source_label_text;
|
||||
return fesa::SourceIdentityEquals(left, right);
|
||||
}
|
||||
|
||||
bool IsFiniteVector(const Vector& values) {
|
||||
for (std::size_t index = 0U; index < values.Size(); ++index) {
|
||||
if (!std::isfinite(values[index])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return math_internal::IsFinite(values);
|
||||
}
|
||||
|
||||
} // namespace fesa::results_internal
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
#ifndef FESA_RESULTS_RECOVERY_CANDIDATE_H_
|
||||
#define FESA_RESULTS_RECOVERY_CANDIDATE_H_
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstddef>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -12,6 +10,7 @@
|
||||
#include "fesa/core/status.h"
|
||||
#include "fesa/math/vector.h"
|
||||
#include "fesa/results/result_records.h"
|
||||
#include "math/finite_values.h"
|
||||
|
||||
namespace fesa::results_internal {
|
||||
|
||||
@@ -53,8 +52,7 @@ bool SameSourceIdentity(const SourceEntityId& left,
|
||||
/// @brief Tests a fixed-size recovery component array for finite values.
|
||||
template <std::size_t Size>
|
||||
bool IsFiniteArray(const std::array<double, Size>& values) {
|
||||
return std::all_of(values.begin(), values.end(),
|
||||
[](const double value) { return std::isfinite(value); });
|
||||
return math_internal::IsFinite(values);
|
||||
}
|
||||
|
||||
/// @brief Tests an owned Vector for finite values.
|
||||
|
||||
@@ -32,21 +32,8 @@ constexpr double kAxisTolerance = 1.0e-12;
|
||||
|
||||
using AxisSet = std::array<std::array<double, 3>, 3>;
|
||||
|
||||
Status RecoveryFailure(const std::string& code, const SourceLocation& location,
|
||||
const std::string& identity,
|
||||
const std::string& message) {
|
||||
return Status::Failure(FailureCategory::kModel,
|
||||
{{Severity::kError, code, location, "RESULT_RECOVERY",
|
||||
identity, message}});
|
||||
}
|
||||
|
||||
template <class T>
|
||||
Result<T> RecoveryResultFailure(const std::string& code,
|
||||
const SourceLocation& location,
|
||||
const std::string& identity,
|
||||
const std::string& message) {
|
||||
return Result<T>::Failure(RecoveryFailure(code, location, identity, message));
|
||||
}
|
||||
using results_internal::RecoveryFailure;
|
||||
using results_internal::RecoveryResultFailure;
|
||||
|
||||
template <std::size_t Size>
|
||||
bool IsFinite(const std::array<double, Size>& values) {
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include <cstddef>
|
||||
|
||||
namespace fesa::results_internal {
|
||||
namespace {
|
||||
|
||||
bool IsFiniteShellRow(const ShellResultRow& row) {
|
||||
if (!IsFiniteArray(row.natural_coordinates) ||
|
||||
@@ -25,8 +24,6 @@ bool IsFiniteShellRow(const ShellResultRow& row) {
|
||||
});
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
Status ShellResultRecovery(const SourceLocation& location,
|
||||
const SourceEntityId& source_id,
|
||||
const EntityIndex expected_element,
|
||||
|
||||
@@ -8,6 +8,9 @@
|
||||
|
||||
namespace fesa::results_internal {
|
||||
|
||||
/// @brief Checks physical fields in their preserved source-row order.
|
||||
bool IsFiniteShellRow(const ShellResultRow& row);
|
||||
|
||||
/// @brief Validates and appends physical shell rows and energy evidence.
|
||||
Status ShellResultRecovery(const SourceLocation& location,
|
||||
const SourceEntityId& source_id,
|
||||
|
||||
Reference in New Issue
Block a user