OGS
FormattingUtils.h
Go to the documentation of this file.
1
11
#pragma once
12
13
#include <spdlog/fmt/ostr.h>
14
#include <spdlog/fmt/ranges.h>
15
16
#include <Eigen/Core>
17
#include <concepts>
18
19
#include "
mathlib_export.h
"
20
21
namespace
MathLib
22
{
23
struct
EigenIOFormat
24
{
25
static
MATHLIB_EXPORT
const
Eigen::IOFormat
full_precision
;
26
};
27
}
// namespace MathLib
28
29
// disable fmt's range formatting for Eigen types
30
template
<
typename
T>
31
requires
std::derived_from<T, Eigen::DenseBase<T>>
32
struct
fmt::is_range<T, char> : std::false_type
33
{
34
};
35
36
template
<
typename
T>
37
requires
std::derived_from<T, Eigen::DenseBase<T>>
38
struct
fmt::formatter<T> : fmt::ostream_formatter
39
{
40
auto
format
(T
const
& value, fmt::format_context& ctx)
const
41
{
42
return
fmt::ostream_formatter::format(
43
value.format(
MathLib::EigenIOFormat::full_precision
), ctx);
44
}
45
};
mathlib_export.h
MATHLIB_EXPORT
#define MATHLIB_EXPORT
Definition
mathlib_export.h:15
MathLib
Definition
CreateComponent.h:32
MathLib::EigenIOFormat
Definition
FormattingUtils.h:24
MathLib::EigenIOFormat::full_precision
static MATHLIB_EXPORT const Eigen::IOFormat full_precision
Definition
FormattingUtils.h:25
fmt::formatter< T >::format
auto format(T const &value, fmt::format_context &ctx) const
Definition
FormattingUtils.h:40
MathLib
FormattingUtils.h
Generated by
1.12.0