From dc5d7d0365003416e67a6da823ad3cb6fd70e714 Mon Sep 17 00:00:00 2001 From: Bernd Flemisch Date: Wed, 4 May 2022 15:13:30 +0200 Subject: [PATCH 1/2] [fmt] move implementation to namespace Dumux --- dumux/io/format.hh | 8 ++++---- dumux/io/format/fmt/core.h | 8 ++++---- dumux/io/format/fmt/format-inl.h | 8 ++++---- dumux/io/format/fmt/format.h | 4 ++-- dumux/io/format/fmt/ranges.h | 4 ++-- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dumux/io/format.hh b/dumux/io/format.hh index f0b2547a5e..bccf607c1d 100644 --- a/dumux/io/format.hh +++ b/dumux/io/format.hh @@ -36,10 +36,10 @@ //! Formatting tools in the style of std::format (C++20) namespace Dumux::Fmt { -using fmt::format; -using fmt::format_to; -using fmt::format_to_n; -using fmt::formatted_size; +using Dumux::Detail::fmt::format; +using Dumux::Detail::fmt::format_to; +using Dumux::Detail::fmt::format_to_n; +using Dumux::Detail::fmt::formatted_size; } // end namespace Dumux::Fmt diff --git a/dumux/io/format/fmt/core.h b/dumux/io/format/fmt/core.h index 2903be5a07..7c5fdc7067 100644 --- a/dumux/io/format/fmt/core.h +++ b/dumux/io/format/fmt/core.h @@ -5,8 +5,8 @@ // // For the license information refer to format.h. -#ifndef FMT_CORE_H_ -#define FMT_CORE_H_ +#ifndef DUMUX_FMT_CORE_H_ +#define DUMUX_FMT_CORE_H_ #include // std::FILE #include @@ -201,7 +201,7 @@ } # endif # define FMT_BEGIN_NAMESPACE \ - namespace fmt { \ + namespace Dumux::Detail::fmt { \ FMT_INLINE_NAMESPACE v7 { #endif @@ -292,7 +292,7 @@ FMT_NORETURN FMT_API void assert_fail(const char* file, int line, # define FMT_ASSERT(condition, message) \ ((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \ ? (void)0 \ - : ::fmt::detail::assert_fail(__FILE__, __LINE__, (message))) + : Dumux::Detail::fmt::detail::assert_fail(__FILE__, __LINE__, (message))) # endif #endif diff --git a/dumux/io/format/fmt/format-inl.h b/dumux/io/format/fmt/format-inl.h index b7cb3209c8..ffc6588e2e 100644 --- a/dumux/io/format/fmt/format-inl.h +++ b/dumux/io/format/fmt/format-inl.h @@ -5,8 +5,8 @@ // // For the license information refer to format.h. -#ifndef FMT_FORMAT_INL_H_ -#define FMT_FORMAT_INL_H_ +#ifndef DUMUX_FMT_FORMAT_INL_H_ +#define DUMUX_FMT_FORMAT_INL_H_ #include #include @@ -29,8 +29,8 @@ // Dummy implementations of strerror_r and strerror_s called if corresponding // system functions are not available. -inline fmt::detail::null<> strerror_r(int, char*, ...) { return {}; } -inline fmt::detail::null<> strerror_s(char*, size_t, ...) { return {}; } +inline Dumux::Detail::fmt::detail::null<> strerror_r(int, char*, ...) { return {}; } +inline Dumux::Detail::fmt::detail::null<> strerror_s(char*, size_t, ...) { return {}; } FMT_BEGIN_NAMESPACE namespace detail { diff --git a/dumux/io/format/fmt/format.h b/dumux/io/format/fmt/format.h index fbe5045068..8f024ecb8f 100644 --- a/dumux/io/format/fmt/format.h +++ b/dumux/io/format/fmt/format.h @@ -30,8 +30,8 @@ without including the above copyright and permission notices. */ -#ifndef FMT_FORMAT_H_ -#define FMT_FORMAT_H_ +#ifndef DUMUX_FMT_FORMAT_H_ +#define DUMUX_FMT_FORMAT_H_ #include #include diff --git a/dumux/io/format/fmt/ranges.h b/dumux/io/format/fmt/ranges.h index b603d637d7..86361c54db 100644 --- a/dumux/io/format/fmt/ranges.h +++ b/dumux/io/format/fmt/ranges.h @@ -9,8 +9,8 @@ // All Rights Reserved // {fmt} support for ranges, containers and types tuple interface. -#ifndef FMT_RANGES_H_ -#define FMT_RANGES_H_ +#ifndef DUMUX_FMT_RANGES_H_ +#define DUMUX_FMT_RANGES_H_ #include #include -- GitLab From 27942de6992d395b084bddc0cf9cc308007fd455 Mon Sep 17 00:00:00 2001 From: Timo Koch Date: Tue, 10 May 2022 12:43:09 +0200 Subject: [PATCH 2/2] [test] Use Fmt in cornerpoint test --- test/porousmediumflow/2p/cornerpoint/main.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/test/porousmediumflow/2p/cornerpoint/main.cc b/test/porousmediumflow/2p/cornerpoint/main.cc index e356de7c3d..dd2aa8937c 100644 --- a/test/porousmediumflow/2p/cornerpoint/main.cc +++ b/test/porousmediumflow/2p/cornerpoint/main.cc @@ -48,6 +48,7 @@ #include #include +#include #include "properties.hh" @@ -80,6 +81,8 @@ int main(int argc, char** argv) // we compute on the leaf grid view const auto& leafGridView = gridManager.grid().leafGridView(); + std::cout << Fmt::format("Initialized cornerpoint grid with {} elements\n", leafGridView.size(0)); + // create the finite volume grid geometry using GridGeometry = GetPropType; auto gridGeometry = std::make_shared(leafGridView); -- GitLab