Began working on mfem_resolver formatters
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
#include <span>
|
||||
#include <format>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "mfem/fem/geom.hpp"
|
||||
#include "mfem/fem/intrules.hpp"
|
||||
|
||||
#include "serif/discretization/blocks/traits.hpp"
|
||||
#include "serif/discretization/quadrature/rules.hpp"
|
||||
|
||||
#include "serif/discretization/quadrature/backend/order.hpp"
|
||||
@@ -16,6 +17,8 @@
|
||||
#include "serif/discretization/quadrature/backend/mfem/concepts.hpp"
|
||||
#include "serif/discretization/quadrature/backend/mfem/mfem_static_order.hpp"
|
||||
|
||||
#include "serif/utils/format/strings.hpp"
|
||||
|
||||
// We may want to consider renaming this file to runtime to stick to convention. The reason
|
||||
// I did not initially is that this is more specific than pure runtime projection of compile
|
||||
// time invariants (which is what most of the other files named runtime.hpp do). Something to think
|
||||
@@ -43,7 +46,7 @@ namespace serif::discretization::quadrature::backend::mfem {
|
||||
};
|
||||
|
||||
struct MFEMRule final {
|
||||
Resolution resolution;
|
||||
Resolution resolution{};
|
||||
|
||||
const ::mfem::IntegrationRule *integration_rule = nullptr;
|
||||
};
|
||||
@@ -85,4 +88,33 @@ namespace serif::discretization::quadrature::backend::mfem {
|
||||
private:
|
||||
Policy m_policy;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
template <>
|
||||
struct std::formatter<serif::discretization::quadrature::backend::mfem::MFEMQuadratureContext> : std::formatter<std::string> {
|
||||
template <typename FormatContext>
|
||||
auto format(const serif::discretization::quadrature::backend::mfem::MFEMQuadratureContext& mfem_context, FormatContext& fc) {
|
||||
std::unordered_map<::mfem::Geometry::Type, std::string> MFEM_GEOM_TYPE_NAME_MAP {
|
||||
{::mfem::Geometry::INVALID, "INVALID"},
|
||||
{::mfem::Geometry::POINT, "POINT"},
|
||||
{::mfem::Geometry::SEGMENT, "SEGMENT"},
|
||||
{::mfem::Geometry::SQUARE, "SQUARE"},
|
||||
{::mfem::Geometry::TETRAHEDRON, "TETRAHEDRON"},
|
||||
{::mfem::Geometry::CUBE, "CUBE"},
|
||||
{::mfem::Geometry::PRISM, "PRISM"},
|
||||
{::mfem::Geometry::PYRAMID, "PYRAMID"},
|
||||
{::mfem::Geometry::NUM_GEOMETRIES, std::format("NUM_GEOMETRIES={}", static_cast<int>(mfem::Geometry::NUM_GEOMETRIES))}
|
||||
};
|
||||
return std::formatter<std::string>::format(
|
||||
std::format(
|
||||
"MFEMQuadratureContext(form={}, geom_type={}, geom_weight_order={}, dynamic_orders={}, domains={}, mapping={})",
|
||||
mfem_context.role,
|
||||
MFEM_GEOM_TYPE_NAME_MAP.at(mfem_context.geometry),
|
||||
mfem_context.geometry_weight_order,
|
||||
serif::utils::misc::format::join(mfem_context.dynamic_orders, ", "),
|
||||
mfem_context.domain,
|
||||
mfem_context.mapping
|
||||
), fc);
|
||||
}
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user