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 : using const_global_cache_tags = tmpl::list<>; 24 : }; 25 : } // namespace detail 26 : 27 : /// The `System::sources_computer` or the `System::sources_computer_linearized`, 28 : /// depending on the `Linearized` parameter. If the system has no 29 : /// `sources_computer_linearized` alias it is assumed to be linear, so the 30 : /// `System::sources_computer` is returned either way. 31 : template <typename System, bool Linearized> 32 1 : using get_sources_computer = tmpl::conditional_t< 33 : Linearized, typename detail::sources_computer_linearized<System>::type, 34 : typename System::sources_computer>; 35 : 36 : /// The `argument_tags` of either the `System::sources_computer` or the 37 : /// `System::sources_computer_linearized`, depending on the `Linearized` 38 : /// parameter, or an empty list if the sources computer is `void`. 39 : template <typename System, bool Linearized> 40 1 : using get_sources_argument_tags = typename tmpl::conditional_t< 41 : std::is_same_v<get_sources_computer<System, Linearized>, void>, 42 : detail::NoSourcesComputer, 43 : get_sources_computer<System, Linearized>>::argument_tags; 44 : 45 : /// The `const_global_cache_tags` of either the `System::sources_computer` or 46 : /// the `System::sources_computer_linearized`, depending on the `Linearized` 47 : /// parameter, or an empty list if the sources computer is `void`. 48 : template <typename System, bool Linearized> 49 1 : using get_sources_const_global_cache_tags = typename tmpl::conditional_t< 50 : std::is_same_v<get_sources_computer<System, Linearized>, void>, 51 : detail::NoSourcesComputer, 52 : get_sources_computer<System, Linearized>>::const_global_cache_tags; 53 : } // namespace elliptic