diff --git a/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.h b/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.h index ece3ea2b6a..283b3af21b 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.h +++ b/packages/seacas/libraries/ioss/src/Ioss_StructuredBlock.h @@ -12,10 +12,11 @@ #include "Ioss_NodeBlock.h" #include "Ioss_Property.h" #include "Ioss_ZoneConnectivity.h" +#if !defined BUILT_IN_SIERRA +#include +#endif #include #include -#include -#include #include #include #include @@ -370,6 +371,7 @@ namespace Ioss { }; } // namespace Ioss +#if !defined BUILT_IN_SIERRA #if FMT_VERSION >= 90000 namespace fmt { template <> struct formatter : ostream_formatter @@ -377,3 +379,4 @@ namespace fmt { }; } // namespace fmt #endif +#endif diff --git a/packages/seacas/libraries/ioss/src/Ioss_ZoneConnectivity.h b/packages/seacas/libraries/ioss/src/Ioss_ZoneConnectivity.h index 9927e1b3d9..1df3ded943 100644 --- a/packages/seacas/libraries/ioss/src/Ioss_ZoneConnectivity.h +++ b/packages/seacas/libraries/ioss/src/Ioss_ZoneConnectivity.h @@ -10,8 +10,10 @@ #include #include #include +#if !defined BUILT_IN_SIERRA #include #include +#endif #include #include #include @@ -154,6 +156,7 @@ namespace Ioss { IOSS_EXPORT std::ostream &operator<<(std::ostream &os, const ZoneConnectivity &zgc); } // namespace Ioss +#if !defined BUILT_IN_SIERRA #if FMT_VERSION >= 90000 namespace fmt { template <> struct formatter : ostream_formatter @@ -161,3 +164,4 @@ namespace fmt { }; } // namespace fmt #endif +#endif diff --git a/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.C b/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.C index e08fd60a7f..39bcc59b9c 100644 --- a/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.C +++ b/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.C @@ -5,6 +5,9 @@ // See packages/seacas/LICENSE for details #include "heartbeat/Iohb_Layout.h" +#include +#include +#include #include namespace Iohb { @@ -21,4 +24,92 @@ namespace Iohb { fmt::print(layout_, "{}{:>{}}", legendStarted ? separator_ : "", label, fieldWidth_); legendStarted = true; } + + void Layout::output_common(const std::string &name) + { + if (count_++ > 0 && !separator_.empty()) { + fmt::print(layout_, "{}", separator_); + } + + if (showLabels && !name.empty()) { + fmt::print(layout_, "{}=", name); + } + } + + template void Layout::add(const std::string &name, const std::string &value); + template void Layout::add(const std::string &name, const int &value); + template void Layout::add(const std::string &name, const int64_t &value); + template void Layout::add(const std::string &name, const size_t &value); + + // Ideally, this would be in the include file, but when building in Sierra, we + // need to keep all `fmt` includes out of the include file due to some TPLs + // having an embedded fmt which is a different version than used by IOSS. + template void Layout::add(const std::string &name, const T &value) + { + output_common(name); + if (!showLabels && fieldWidth_ > 0) { + fmt::print(layout_, "{0:{1}}", value, fieldWidth_); + } + else { + fmt::print(layout_, "{}", value); + } + } + + template <> void Layout::add(const std::string &name, const double &value) + { + output_common(name); + if (precision_ == -1) { + // Use lib::fmt full precision output -- as many digits as needed to fully represent the + // double + fmt::print(layout_, "{}", value); + } + else if (!showLabels && fieldWidth_ > 0) { + fmt::print(layout_, "{0:{1}.{2}e}", value, fieldWidth_, precision_); + } + else { + fmt::print(layout_, "{0:.{1}e}", value, precision_); + } + } + + template void Layout::add(const std::string &name, const std::vector &value); + template void Layout::add(const std::string &name, const std::vector &value); + template void Layout::add(const std::string &name, const std::vector &value); + + template void Layout::add(const std::string &name, const std::vector &value) + { + if (value.size() == 1) { + add(name, value[0]); + } + else { + output_common(name); + if (!showLabels && fieldWidth_ > 0) { + fmt::print(layout_, "{0:{1}}", fmt::join(value, separator_), fieldWidth_); + } + else { + fmt::print(layout_, "{}", fmt::join(value, separator_)); + } + } + } + + template <> void Layout::add(const std::string &name, const std::vector &value) + { + if (value.size() == 1) { + add(name, value[0]); + } + else { + output_common(name); + if (precision_ == -1) { + // Use lib::fmt full precision output -- as many digits as needed to fully represent the + // double + fmt::print(layout_, "{}", fmt::join(value, separator_)); + } + else if (!showLabels && fieldWidth_ > 0) { + fmt::print(layout_, "{0:{2}.{1}e}", fmt::join(value, separator_), precision_, fieldWidth_); + } + else { + fmt::print(layout_, "{0:.{1}e}", fmt::join(value, separator_), precision_); + } + } + } + } // namespace Iohb diff --git a/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.h b/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.h index 34122957be..bc73c77b10 100644 --- a/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.h +++ b/packages/seacas/libraries/ioss/src/heartbeat/Iohb_Layout.h @@ -6,9 +6,6 @@ #pragma once -#include -#include -#include #include #include #include @@ -43,80 +40,4 @@ namespace Iohb { bool legendStarted{false}; }; - inline void Layout::output_common(const std::string &name) - { - if (count_++ > 0 && !separator_.empty()) { - fmt::print(layout_, "{}", separator_); - } - - if (showLabels && !name.empty()) { - fmt::print(layout_, "{}=", name); - } - } - - template inline void Layout::add(const std::string &name, const T &value) - { - output_common(name); - if (!showLabels && fieldWidth_ > 0) { - fmt::print(layout_, "{0:{1}}", value, fieldWidth_); - } - else { - fmt::print(layout_, "{}", value); - } - } - - template <> inline void Layout::add(const std::string &name, const double &value) - { - output_common(name); - if (precision_ == -1) { - // Use lib::fmt full precision output -- as many digits as needed to fully represent the - // double - fmt::print(layout_, "{}", value); - } - else if (!showLabels && fieldWidth_ > 0) { - fmt::print(layout_, "{0:{1}.{2}e}", value, fieldWidth_, precision_); - } - else { - fmt::print(layout_, "{0:.{1}e}", value, precision_); - } - } - - template - inline void Layout::add(const std::string &name, const std::vector &value) - { - if (value.size() == 1) { - add(name, value[0]); - } - else { - output_common(name); - if (!showLabels && fieldWidth_ > 0) { - fmt::print(layout_, "{0:{1}}", fmt::join(value, separator_), fieldWidth_); - } - else { - fmt::print(layout_, "{}", fmt::join(value, separator_)); - } - } - } - - template <> inline void Layout::add(const std::string &name, const std::vector &value) - { - if (value.size() == 1) { - add(name, value[0]); - } - else { - output_common(name); - if (precision_ == -1) { - // Use lib::fmt full precision output -- as many digits as needed to fully represent the - // double - fmt::print(layout_, "{}", fmt::join(value, separator_)); - } - else if (!showLabels && fieldWidth_ > 0) { - fmt::print(layout_, "{0:{2}.{1}e}", fmt::join(value, separator_), precision_, fieldWidth_); - } - else { - fmt::print(layout_, "{0:.{1}e}", fmt::join(value, separator_), precision_); - } - } - } - } // namespace Iohb