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 "DataStructures/DataBox/DataBox.hpp" 9 : #include "Evolution/DgSubcell/ActiveGrid.hpp" 10 : #include "Evolution/DgSubcell/Tags/ActiveGrid.hpp" 11 : 12 : namespace evolution::dg::subcell { 13 : /// \brief Retrieve a tag from the active grid. 14 : template <typename DgTag, typename SubcellTag, typename DbTagsList> 15 1 : const typename DgTag::type& get_active_tag(const db::DataBox<DbTagsList>& box) { 16 : static_assert( 17 : std::is_same_v<typename DgTag::type, typename SubcellTag::type>); 18 : if (db::get<Tags::ActiveGrid>(box) == ActiveGrid::Subcell) { 19 : return db::get<SubcellTag>(box); 20 : } 21 : return db::get<DgTag>(box); 22 : } 23 : 24 : /// \brief Retrieve a tag from the inactive grid. 25 : template <typename DgTag, typename SubcellTag, typename DbTagsList> 26 1 : const typename DgTag::type& get_inactive_tag( 27 : const db::DataBox<DbTagsList>& box) { 28 : static_assert( 29 : std::is_same_v<typename DgTag::type, typename SubcellTag::type>); 30 : if (db::get<Tags::ActiveGrid>(box) == ActiveGrid::Subcell) { 31 : return db::get<DgTag>(box); 32 : } 33 : return db::get<SubcellTag>(box); 34 : } 35 : } // namespace evolution::dg::subcell