feat(mean_field): added dimensions, discritization, and start of eos
The full rewrite of mean_field into something maintainable is progressing. dimensions is mostly done, discritization (domain, blocks, and fields) is done, and eos is progressing quickly
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
#pragma once
|
||||
|
||||
#include <cstddef>
|
||||
#include <optional>
|
||||
#include <string_view>
|
||||
#include <vector>
|
||||
#include <format>
|
||||
#include <string>
|
||||
|
||||
#include "serif/discretization/domain/relation/validation/runtime.hpp"
|
||||
|
||||
// The aggregate result of validating a whole schema against a mesh
|
||||
namespace serif::discretization::domain::schema::validation {
|
||||
struct SchemaRelationValidationResult {
|
||||
std::size_t relationIndex{0};
|
||||
std::string_view relationName;
|
||||
relation::validation::RelationValidationResult result;
|
||||
|
||||
[[nodiscard]] bool valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
};
|
||||
|
||||
struct SchemaValidationResult {
|
||||
std::vector<SchemaRelationValidationResult> relationResults;
|
||||
|
||||
[[nodiscard]] bool valid() const noexcept;
|
||||
[[nodiscard]] explicit operator bool() const noexcept;
|
||||
[[nodiscard]] std::size_t relation_count() const noexcept;
|
||||
[[nodiscard]] std::size_t failed_relation_count() const noexcept;
|
||||
[[nodiscard]] std::size_t passed_relation_count() const noexcept;
|
||||
[[nodiscard]] std::optional<std::size_t> first_failed_relation_index() const noexcept;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
template <>
|
||||
struct std::formatter<serif::discretization::domain::schema::validation::SchemaValidationResult> {
|
||||
std::formatter<std::string> string_formatter;
|
||||
|
||||
constexpr auto parse(std::format_parse_context& ctx) {
|
||||
return string_formatter.parse(ctx);
|
||||
}
|
||||
|
||||
auto format(const serif::discretization::domain::schema::validation::SchemaValidationResult& result, std::format_context& ctx) const {
|
||||
std::string output;
|
||||
output += "SchemaValidationResult:\n";
|
||||
output += std::format(" Valid: {}\n", result.valid());
|
||||
output += std::format(" Relation count: {}\n", result.relation_count());
|
||||
output += std::format(" Passed relation count: {}\n", result.passed_relation_count());
|
||||
output += std::format(" Failed relation count: {}\n", result.failed_relation_count());
|
||||
if (auto first_failed_index = result.first_failed_relation_index()) {
|
||||
output += std::format(" First failed relation index: {}\n", *first_failed_index);
|
||||
} else {
|
||||
output += " No failed relations.\n";
|
||||
}
|
||||
return string_formatter.format(output, ctx);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user