diff options
author | 2022-03-11 08:52:48 -0800 | |
---|---|---|
committer | 2022-03-11 17:52:48 +0100 | |
commit | f00682d954522598112f03845bae018e3ec85a15 (patch) | |
tree | 0f63f22a6c38858365fadccb7d4c2c713fecd866 /Source/Utils/TextMsg.cpp | |
parent | 77af949745f2c784aee17d9fee0df6565ab4273d (diff) | |
download | WarpX-f00682d954522598112f03845bae018e3ec85a15.tar.gz WarpX-f00682d954522598112f03845bae018e3ec85a15.tar.zst WarpX-f00682d954522598112f03845bae018e3ec85a15.zip |
ABLASTR: Move TextMsg (#2953)
* ABLASTR: Move TextMsg
Since this is used in a ABLASTR header, we need to compile this
in ABLASTR, so ImpactX can use it as well. Otherwise we have missing
symbols for that utility.
* Fix typo in GNUmake
* Apply Wording Update for Doxygen
Co-authored-by: Luca Fedeli <luca.fedeli@for.unipi.it>
Diffstat (limited to 'Source/Utils/TextMsg.cpp')
-rw-r--r-- | Source/Utils/TextMsg.cpp | 73 |
1 files changed, 0 insertions, 73 deletions
diff --git a/Source/Utils/TextMsg.cpp b/Source/Utils/TextMsg.cpp deleted file mode 100644 index 5b945f122..000000000 --- a/Source/Utils/TextMsg.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/* Copyright 2022 Luca Fedeli - * - * This file is part of WarpX. - * - * License: BSD-3-Clause-LBNL - */ - -#include "TextMsg.H" - -#include "WarpXUtil.H" - -#include <AMReX_Print.H> - -#include <sstream> - -namespace -{ - constexpr auto err_prefix = "### ERROR : "; - constexpr auto warn_prefix = "!!! WARNING : "; - constexpr auto info_prefix = "--- INFO : "; - constexpr auto err_line_prefix = "# "; - constexpr auto line_prefix = " "; - constexpr auto line_length = 66; - - std::string Msg( - const std::string& msg, - const std::string& msg_prefix, - const std::string& msg_line_prefix, - const int msg_line_length, - const bool do_text_wrapping) - { - if(!do_text_wrapping){ - return msg_prefix + msg + "\n"; - } - - const auto wrapped_text = WarpXUtilStr::automatic_text_wrap( - msg, msg_line_length); - - std::stringstream ss_out; - - std::for_each(std::begin(wrapped_text), std::end(wrapped_text), - [&,ln=0](const auto& line) mutable { - ss_out << ((ln++ == 0) ? msg_prefix : msg_line_prefix); - ss_out << line << "\n"; - }); - - return ss_out.str(); - } -} - -std::string Utils::TextMsg::Err(const std::string& msg, const bool do_text_wrapping) -{ - return ::Msg( - msg, ::err_prefix, ::err_line_prefix, ::line_length, do_text_wrapping); -} - -std::string Utils::TextMsg::Info(const std::string& msg, const bool do_text_wrapping) -{ - return ::Msg( - msg, ::info_prefix, ::line_prefix, ::line_length, do_text_wrapping); -} - -std::string Utils::TextMsg::Warn(const std::string& msg, const bool do_text_wrapping) -{ - return ::Msg( - msg, ::warn_prefix, ::line_prefix, ::line_length, do_text_wrapping); -} - -void Utils::TextMsg::Assert(const char* ex, const char* file, const int line, const std::string& msg) -{ - const auto n_msg = "\n" + Err(msg); - amrex::Assert(ex , file, line , n_msg.c_str()); -} |