Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cmath> 7 : #include <cstddef> 8 : #include <cstdint> 9 : #include <utility> 10 : 11 : #include "DataStructures/DataBox/Prefixes.hpp" 12 : #include "DataStructures/DataBox/Tag.hpp" 13 : #include "DataStructures/Tensor/EagerMath/DeterminantAndInverse.hpp" 14 : #include "DataStructures/Tensor/Tensor.hpp" 15 : #include "DataStructures/VariablesTag.hpp" 16 : #include "NumericalAlgorithms/LinearOperators/PartialDerivatives.hpp" 17 : #include "PointwiseFunctions/GeneralRelativity/Tags.hpp" 18 : #include "Utilities/ContainerHelpers.hpp" 19 : #include "Utilities/Gsl.hpp" 20 : #include "Utilities/TMPL.hpp" 21 : #include "Utilities/TaggedTuple.hpp" 22 : 23 : /// \ingroup GeneralRelativityGroup 24 : /// Holds functions related to general relativity. 25 : namespace gr { 26 : /// @{ 27 : /*! 28 : * \ingroup GeneralRelativityGroup 29 : * \brief Compute spatial metric from spacetime metric. 30 : * \details Simply pull out the spatial components. 31 : */ 32 : template <typename DataType, size_t SpatialDim, typename Frame> 33 1 : tnsr::ii<DataType, SpatialDim, Frame> spatial_metric( 34 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 35 : 36 : template <typename DataType, size_t SpatialDim, typename Frame> 37 1 : void spatial_metric( 38 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*> spatial_metric, 39 : const tnsr::aa<DataType, SpatialDim, Frame>& spacetime_metric); 40 : /// @} 41 : 42 : namespace Tags { 43 : /*! 44 : * \brief Compute item for spatial metric \f$\gamma_{ij}\f$ from the 45 : * spacetime metric \f$g_{ab}\f$. 46 : * 47 : * \details Can be retrieved using `gr::Tags::SpatialMetric`. 48 : */ 49 : template <typename DataType, size_t SpatialDim, typename Frame> 50 1 : struct SpatialMetricCompute : SpatialMetric<DataType, SpatialDim, Frame>, 51 : db::ComputeTag { 52 0 : using argument_tags = 53 : tmpl::list<SpacetimeMetric<DataType, SpatialDim, Frame>>; 54 : 55 0 : using return_type = tnsr::ii<DataType, SpatialDim, Frame>; 56 : 57 0 : static constexpr auto function = static_cast<void (*)( 58 : gsl::not_null<tnsr::ii<DataType, SpatialDim, Frame>*>, 59 : const tnsr::aa<DataType, SpatialDim, Frame>&)>( 60 : &spatial_metric<DataType, SpatialDim, Frame>); 61 : 62 0 : using base = SpatialMetric<DataType, SpatialDim, Frame>; 63 : }; 64 : } // namespace Tags 65 : } // namespace gr