feat(quadrature): quadrature system brought over

Ported and dramatically cleaned up the quadrature system. This includes centralizing all field definitions
This commit is contained in:
2026-09-19 07:35:57 -04:00
parent 7b4f30d945
commit c44584c1e7
75 changed files with 8936 additions and 172 deletions

View File

@@ -0,0 +1,31 @@
#pragma once
#include <unordered_map>
#include <type_traits>
#include "magic_enum/magic_enum_all.hpp"
namespace serif::meta {
template <typename EnumType>
[[nodiscard]] constexpr std::unordered_map<std::string_view, EnumType> enum_to_string_enum_map() noexcept {
static_assert(std::is_enum_v<EnumType>, "EnumType must be an enum type");
std::unordered_map<std::string_view, EnumType> map;
for (const auto& [value, name] : magic_enum::enum_entries<EnumType>()) {
map.emplace(name, value);
}
return map;
}
template <typename EnumType>
[[nodiscard]] constexpr std::unordered_map<EnumType, std::string_view> enum_to_enum_string_map() noexcept {
static_assert(std::is_enum_v<EnumType>, "EnumType must be an enum type");
std::unordered_map<EnumType, std::string_view> map;
for (const auto& [value, name] : magic_enum::enum_entries<EnumType>()) {
map.emplace(value, name);
}
return map;
}
}

View File

@@ -0,0 +1,25 @@
#pragma once
#include <string_view>
#include "nameof.hpp"
/* If we ever move to C++26 or above we can replace these with native reflection
*/
namespace serif::meta {
template <typename T>
[[nodiscard]] consteval std::string_view type_name() noexcept {
return nameof::nameof_short_type<T>();
}
template <typename T>
[[nodiscard]] consteval std::string_view template_name() noexcept {
constexpr std::string_view typeName = type_name<T>();
constexpr std::size_t templateStart = typeName.find('<');
if constexpr (templateStart == std::string_view::npos) {
return typeName;
}
return typeName.substr(0, templateStart);
}
}