Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <type_traits> 7 : 8 : #include "Utilities/TMPL.hpp" 9 : 10 : namespace elliptic { 11 : namespace detail { 12 : template <typename System, typename = std::void_t<>> 13 : struct sources_computer_linearized { 14 : using type = typename System::sources_computer; 15 : }; 16 : template <typename System> 17 : struct sources_computer_linearized< 18 : System, std::void_t<typename System::sources_computer_linearized>> { 19 : using type = typename System::sources_computer_linearized; 20 : }; 21 : struct NoSourcesComputer { 22 : using argument_tags = tmpl::list<>; 23 : }; 24 : } // namespace detail 25 : 26 : /// The `System::sources_computer` or the `System::sources_computer_linearized`, 27 : /// depending on the `Linearized` parameter. If the system has no 28 : /// `sources_computer_linearized` alias it is assumed to be linear, so the 29 : /// `System::sources_computer` is returned either way. 30 : template <typename System, bool Linearized> 31 1 : using get_sources_computer = tmpl::conditional_t< 32 : Linearized, typename detail::sources_computer_linearized<System>::type, 33 : typename System::sources_computer>; 34 : 35 : /// The `argument_tags` of either the `System::sources_computer` or the 36 : /// `System::sources_computer_linearized`, depending on the `Linearized` 37 : /// parameter, or an empty list if the sources computer is `void`. 38 : template <typename System, bool Linearized> 39 1 : using get_sources_argument_tags = typename tmpl::conditional_t< 40 : std::is_same_v<get_sources_computer<System, Linearized>, void>, 41 : detail::NoSourcesComputer, 42 : get_sources_computer<System, Linearized>>::argument_tags; 43 : } // namespace elliptic