Files
MeanField/experiments/experiment_results.cppm
Emily Boudreaux 85500fef3b feat(surface): surface deformation prescriptions
restricted the unknown state vector to surface deformation and implemented one prescription, NodalRadialSurface, while the full volumetric displacment field is reconstructed analytically from that. This reduced the number of degrees of freedom in the system by a factor of 80 while also removing many null vectors from the system.
2026-09-01 11:50:13 -04:00

69 lines
1.9 KiB
C++

module;
#include <algorithm>
#include <map>
#include <mutex>
#include <set>
#include <string>
#include <utility>
#include <vector>
export module experiment;
export namespace experiment {
struct ExperimentResult {
std::string experiment_name;
std::string case_name;
std::map<std::string, std::string> parameters;
std::map<std::string, double> metrics;
};
class ExperimentRegistry {
public:
static ExperimentRegistry &instance() {
static ExperimentRegistry registry;
return registry;
}
void add_result(ExperimentResult result) {
std::scoped_lock lock(m_mutex);
m_results.push_back(std::move(result));
}
[[nodiscard]] std::vector<ExperimentResult> results() const {
std::scoped_lock lock(m_mutex);
return m_results;
}
void set_output_path(std::string output_path) {
std::scoped_lock lock(m_mutex);
m_output_path = std::move(output_path);
}
[[nodiscard]] std::string output_path() const {
std::scoped_lock lock(m_mutex);
return m_output_path;
}
private:
mutable std::mutex m_mutex;
std::vector<ExperimentResult> m_results;
std::string m_output_path{"accuracy_budget.csv"};
};
inline void record_experiment_result(
const std::string &experiment_name,
const std::string &case_name,
std::map<
std::string,
std::string> parameters,
std::map<
std::string,
double> metrics
) {
ExperimentRegistry::instance().add_result(
{.experiment_name = experiment_name,
.case_name = case_name,
.parameters = std::move(parameters),
.metrics = std::move(metrics)}
);
}
} // namespace experiment