Files
FESADev/tests/reference/mitc4_reference_comparison.h
T
2026-08-18 02:29:26 +09:00

94 lines
2.2 KiB
C++

#ifndef FESA_TESTS_REFERENCE_MITC4_REFERENCE_COMPARISON_H_
#define FESA_TESTS_REFERENCE_MITC4_REFERENCE_COMPARISON_H_
#include <cstddef>
#include <cstdint>
#include <filesystem>
#include <string>
#include <vector>
#include "fesa/core/status.h"
namespace fesa::test {
struct Mitc4ReferenceCase {
std::string case_id;
std::string expected_source_element_type;
std::filesystem::path input_path;
std::filesystem::path displacement_csv_path;
std::filesystem::path results_hdf5_path;
};
struct Mitc4RowDecision {
std::string case_id;
std::string instance_name;
std::int64_t source_node_label;
std::string component;
double fesa_value;
double reference_value;
double absolute_error;
double tolerance;
double normalized_error;
double reference_scale;
double near_zero_band;
bool relative_error_applicable;
std::string tolerance_branch;
bool blocking;
bool within_tolerance;
};
struct Mitc4ComponentMetrics {
std::string family_identity;
std::vector<std::string> components;
bool blocking;
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 Mitc4VectorMetrics {
std::string instance_name;
std::int64_t source_node_label;
double displacement_norm_error;
double rotation_norm_error;
};
struct Mitc4Warning {
std::string code;
std::size_t row;
std::string message;
};
struct Mitc4ComparisonReport {
std::string case_id;
std::string source_element_type;
std::string internal_formulation;
std::string integration_rule;
std::vector<Mitc4RowDecision> rows;
std::vector<Mitc4ComponentMetrics> metrics;
std::vector<Mitc4VectorMetrics> vector_metrics;
std::vector<Mitc4Warning> warnings;
std::size_t worst_row;
bool passed;
};
class Mitc4ReferenceComparison {
public:
static Result<Mitc4ComparisonReport> Compare(
const Mitc4ReferenceCase& reference_case);
static Status WriteDeterministicJson(
const Mitc4ComparisonReport& report,
const std::filesystem::path& output_json);
};
} // namespace fesa::test
#endif // FESA_TESTS_REFERENCE_MITC4_REFERENCE_COMPARISON_H_