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
14namespace MathLib
15{
17{
18 static MATHLIB_EXPORT const Eigen::IOFormat full_precision;
19};
20} // namespace MathLib
21
22// disable fmt's range formatting for Eigen types
23template <typename T>
24 requires std::derived_from<T, Eigen::DenseBase<T>>
25struct fmt::is_range<T, char> : std::false_type
26{
27};
28
29template <typename T>
30 requires std::derived_from<T, Eigen::DenseBase<T>>
31struct 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(
37 }
38};
#define MATHLIB_EXPORT
static MATHLIB_EXPORT const Eigen::IOFormat full_precision
auto format(T const &value, fmt::format_context &ctx) const