.. _program_listing_file_src_feedback_FeedbackCommons.hpp: Program Listing for File FeedbackCommons.hpp ============================================ |exhale_lsh| :ref:`Return to documentation for file ` (``src/feedback/FeedbackCommons.hpp``) .. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS .. code-block:: cpp #ifndef FEEDBACKCOMMONS_HPP #define FEEDBACKCOMMONS_HPP #include #include #include #include #include #include #include #include namespace feedback { enum class WRwindModel : std::uint8_t { // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore on each enumerator matches yields::Channel's own identical convention (see its own comment) none_, lOverc_, nugisLamers00_ // NOLINTEND(readability-identifier-naming) }; constexpr std::array wrWindModelStr{ "none", "l_over_c", "nugis_lamers_00" }; inline auto wrWindModelFromString(const std::string_view name) -> WRwindModel { const auto* const it = std::ranges::find(wrWindModelStr, name); if (it == wrWindModelStr.end()) { throw std::invalid_argument("'" + std::string(name) + "' is not a recognized WR wind model (expected none, " "l_over_c, or nugis_lamers_00)"); } return static_cast(std::distance(wrWindModelStr.begin(), it)); } inline auto wrWindModelToString(const WRwindModel model) -> std::string_view { return wrWindModelStr.at(static_cast(model)); } enum class OBwindModel : std::uint8_t { // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore on each enumerator matches yields::Channel's own identical convention (see its own comment) none_, vink01_, vinkSander21_ // NOLINTEND(readability-identifier-naming) }; constexpr std::array obWindModelStr{ "none", "vink_01", "vink_sander_21" }; inline auto obWindModelFromString(const std::string_view name) -> OBwindModel { const auto* const it = std::ranges::find(obWindModelStr, name); if (it == obWindModelStr.end()) { throw std::invalid_argument("'" + std::string(name) + "' is not a recognized OB wind model (expected none, " "vink_01, or vink_sander_21)"); } return static_cast(std::distance(obWindModelStr.begin(), it)); } inline auto obWindModelToString(const OBwindModel model) -> std::string_view { return obWindModelStr.at(static_cast(model)); } enum class AGBwindModel : std::uint8_t { // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore on each enumerator matches yields::Channel's own identical convention (see its own comment) none_, slug2_ // NOLINTEND(readability-identifier-naming) }; constexpr std::array agbWindModelStr{ "none", "slug2" }; inline auto agbWindModelFromString(const std::string_view name) -> AGBwindModel { const auto* const it = std::ranges::find(agbWindModelStr, name); if (it == agbWindModelStr.end()) { throw std::invalid_argument("'" + std::string(name) + "' is not a recognized AGB wind model (expected none or slug2)"); } return static_cast(std::distance(agbWindModelStr.begin(), it)); } inline auto agbWindModelToString(const AGBwindModel model) -> std::string_view { return agbWindModelStr.at(static_cast(model)); } enum class OtherwindModel : std::uint8_t { // NOLINTBEGIN(readability-identifier-naming) -- trailing underscore on each enumerator matches yields::Channel's own identical convention (see its own comment) none_, vesc_ // NOLINTEND(readability-identifier-naming) }; constexpr std::array otherWindModelStr{ "none", "vesc" }; inline auto otherWindModelFromString(const std::string_view name) -> OtherwindModel { const auto* const it = std::ranges::find(otherWindModelStr, name); if (it == otherWindModelStr.end()) { throw std::invalid_argument("'" + std::string(name) + "' is not a recognized other-star wind model (expected none or vesc)"); } return static_cast(std::distance(otherWindModelStr.begin(), it)); } inline auto otherWindModelToString(const OtherwindModel model) -> std::string_view { return otherWindModelStr.at(static_cast(model)); } } // namespace feedback #endif // FEEDBACKCOMMONS_HPP