OGS
FormattingUtils.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) OpenGeoSys Community (opengeosys.org)
2
// SPDX-License-Identifier: BSD-3-Clause
3
4
#pragma once
5
6
#include <spdlog/fmt/ostr.h>
7
#include <spdlog/fmt/ranges.h>
8
9
#include <Eigen/Core>
10
#include <concepts>
11
12
#include "
mathlib_export.h
"
13
14
namespace
MathLib
15
{
16
struct
EigenIOFormat
17
{
18
static
MATHLIB_EXPORT
const
Eigen::IOFormat
full_precision
;
19
};
20
}
// namespace MathLib
21
22
// disable fmt's range formatting for Eigen types
23
template
<
typename
T>
24
requires
std::derived_from<T, Eigen::DenseBase<T>>
25
struct
fmt::is_range<T, char> : std::false_type
26
{
27
};
28
29
template
<
typename
T>
30
requires
std::derived_from<T, Eigen::DenseBase<T>>
31
struct
fmt::formatter<T> : fmt::ostream_formatter
32
{
33
auto
format
(T
const
& value, fmt::format_context& ctx)
const
34
{
35
return
fmt::ostream_formatter::format(
36
value.format(
MathLib::EigenIOFormat::full_precision
), ctx);
37
}
38
};
mathlib_export.h
MATHLIB_EXPORT
#define MATHLIB_EXPORT
Definition
mathlib_export.h:15
MathLib
Definition
CreateComponent.h:23
MathLib::EigenIOFormat
Definition
FormattingUtils.h:17
MathLib::EigenIOFormat::full_precision
static MATHLIB_EXPORT const Eigen::IOFormat full_precision
Definition
FormattingUtils.h:18
fmt::formatter< T >::format
auto format(T const &value, fmt::format_context &ctx) const
Definition
FormattingUtils.h:33
MathLib
FormattingUtils.h
Generated by
1.14.0