diff --git a/include/openmc/position.h b/include/openmc/position.h index 5ab0774f4..4fde420cc 100644 --- a/include/openmc/position.h +++ b/include/openmc/position.h @@ -5,6 +5,7 @@ #include #include // for out_of_range +#include "fmt/format.h" #include "openmc/array.h" #include "openmc/vector.h" @@ -210,4 +211,14 @@ using Direction = Position; } // namespace openmc +template<> +struct fmt::formatter : formatter { + template + auto format(const openmc::Position& pos, FormatContext& ctx) + { + return fmt::formatter::format( + fmt::format("({}, {}, {})", pos.x, pos.y, pos.z), ctx); + } +}; + #endif // OPENMC_POSITION_H