Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include "DataStructures/DataBox/Tag.hpp" 7 : #include "DataStructures/Tensor/EagerMath/OuterProduct.hpp" 8 : #include "DataStructures/Tensor/Metafunctions.hpp" 9 : 10 : namespace imex { 11 : namespace Tags { 12 : /*! 13 : * Tag for the derivative of an implicit source (`Dependent`) with 14 : * respect to an implicit variable (`Independent`). 15 : * 16 : * The independent indices are given first, so 17 : * \f{equation} 18 : * \frac{S(U_{j...})}{U_{i...}} = J_{i\ldots,j\ldots} 19 : * \f} 20 : * with appropriate upper and lower indices. 21 : */ 22 : template <typename Independent, typename Dependent> 23 1 : struct Jacobian : db::SimpleTag { 24 : static_assert(std::is_same_v<typename Independent::type::value_type, 25 : typename Dependent::type::value_type>); 26 0 : using independent = Independent; 27 0 : using dependent = Dependent; 28 : 29 : private: 30 0 : using Denominator = 31 : TensorMetafunctions::change_all_valences<typename Independent::type>; 32 : 33 : public: 34 0 : using type = OuterProductResultTensor< 35 : typename Dependent::type::value_type, typename Denominator::symmetry, 36 : typename Denominator::index_list, typename Dependent::type::symmetry, 37 : typename Dependent::type::index_list>; 38 : }; 39 : } // namespace Tags 40 : 41 : /// Create a list of all jacobian tags for the dependence of \p 42 : /// DependentList on \p IndependentList. 43 : /// 44 : /// This can be used to construct the argument for a `Variables` from 45 : /// the `tags_list`s of two other `Variables`. 46 : template <typename IndependentList, typename DependentList> 47 1 : using jacobian_tags = tmpl::join<tmpl::transform< 48 : IndependentList, 49 : tmpl::lazy::transform< 50 : tmpl::pin<DependentList>, 51 : tmpl::defer<tmpl::bind<::imex::Tags::Jacobian, tmpl::parent<tmpl::_1>, 52 : tmpl::_1>>>>>; 53 : } // namespace imex