feat(libmeanfield): centrifugal + pressure

This commit is contained in:
2026-08-04 14:24:55 -04:00
parent 9bc4f2758a
commit dc912fd15e
115 changed files with 260058 additions and 163261 deletions

View File

@@ -0,0 +1,65 @@
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)
});
}
}