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 : } // namespace detail 22 : 23 : /// The `System::sources_computer` or the `System::sources_computer_linearized`, 24 : /// depending on the `Linearized` parameter. If the system has no 25 : /// `sources_computer_linearized` alias it is assumed to be linear, so the 26 : /// `System::sources_computer` is returned either way. 27 : template <typename System, bool Linearized> 28 1 : using get_sources_computer = tmpl::conditional_t< 29 : Linearized, typename detail::sources_computer_linearized<System>::type, 30 : typename System::sources_computer>; 31 : } // namespace elliptic