94 lines
2.4 KiB
C++
94 lines
2.4 KiB
C++
#ifndef FESA_TESTS_REFERENCE_REFERENCE_COMPARISON_H_
|
|
#define FESA_TESTS_REFERENCE_REFERENCE_COMPARISON_H_
|
|
|
|
#include <array>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <filesystem>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "fesa/core/status.h"
|
|
|
|
namespace fesa::test {
|
|
|
|
enum class ComparisonQuantity { kDisplacement, kReaction, kSectionResultant };
|
|
|
|
struct CanonicalComparisonRow {
|
|
std::string model_id;
|
|
std::string step_name;
|
|
std::size_t frame_index;
|
|
std::string instance_name;
|
|
std::int64_t source_node_label;
|
|
std::int64_t source_element_label;
|
|
int endpoint_index;
|
|
ComparisonQuantity quantity;
|
|
std::string component;
|
|
double value;
|
|
std::string unit_dimension;
|
|
std::string coordinate_system;
|
|
std::string hdf5_dataset_path;
|
|
};
|
|
|
|
struct RowDecision {
|
|
CanonicalComparisonRow fesa;
|
|
CanonicalComparisonRow reference;
|
|
double absolute_error;
|
|
double tolerance;
|
|
double reference_scale;
|
|
double near_zero_band;
|
|
double relative_error;
|
|
bool relative_error_applicable;
|
|
std::string tolerance_branch;
|
|
bool passed;
|
|
};
|
|
|
|
struct ComponentMetrics {
|
|
ComparisonQuantity quantity;
|
|
std::string family_identity;
|
|
std::vector<std::string> components;
|
|
double reference_scale;
|
|
double near_zero_band;
|
|
std::size_t near_zero_count;
|
|
double maximum_absolute_error;
|
|
double relative_rms;
|
|
std::size_t worst_row;
|
|
bool rms_passed;
|
|
bool passed;
|
|
std::string diagnostic_code;
|
|
std::size_t row_count{};
|
|
};
|
|
|
|
struct PhysicsEvidence {
|
|
double free_residual_norm;
|
|
std::array<double, 3> applied_force;
|
|
std::array<double, 3> reaction_force;
|
|
std::array<double, 3> applied_moment_about_origin;
|
|
std::array<double, 3> reaction_moment_about_origin;
|
|
bool endpoint_consistency_passed;
|
|
};
|
|
|
|
struct ComparisonReport {
|
|
std::vector<RowDecision> rows;
|
|
std::vector<ComponentMetrics> metrics;
|
|
PhysicsEvidence physics_evidence;
|
|
bool stress_comparison_applicable;
|
|
std::string stress_comparison_reason;
|
|
bool passed;
|
|
};
|
|
|
|
// Test-only comparison support keeps Abaqus artifacts read-only and exposes no
|
|
// backend handles to the implementation or downstream verification Steps.
|
|
class ReferenceComparison {
|
|
public:
|
|
static Result<ComparisonReport> Compare(
|
|
const std::filesystem::path& results_hdf5,
|
|
const std::filesystem::path& legacy_reference_directory);
|
|
static Status WriteDeterministicJson(
|
|
const ComparisonReport& report, const std::filesystem::path& output_json);
|
|
};
|
|
|
|
} // namespace fesa::test
|
|
|
|
#endif // FESA_TESTS_REFERENCE_REFERENCE_COMPARISON_H_
|