feat(cpp-object-oriented-modular-refactoring): step 6 - io-application-google-style
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
#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;
|
||||
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;
|
||||
bool passed;
|
||||
};
|
||||
|
||||
struct ComponentMetrics {
|
||||
ComparisonQuantity quantity;
|
||||
std::string component;
|
||||
double reference_scale;
|
||||
double maximum_absolute_error;
|
||||
double maximum_normalized_error;
|
||||
double rms_error;
|
||||
double norm_error;
|
||||
std::size_t worst_row;
|
||||
};
|
||||
|
||||
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_
|
||||
Reference in New Issue
Block a user