Line data Source code
1 0 : // Distributed under the MIT License. 2 : // See LICENSE.txt for details. 3 : 4 : #pragma once 5 : 6 : #include <cstddef> 7 : 8 : #include "DataStructures/DataBox/Tag.hpp" 9 : #include "DataStructures/Tensor/TypeAliases.hpp" 10 : #include "PointwiseFunctions/Hydro/TagsDeclarations.hpp" // IWYU pragma: keep 11 : #include "Utilities/TMPL.hpp" 12 : 13 : /// \cond 14 : namespace gsl { 15 : template <typename> 16 : struct not_null; 17 : } // namespace gsl 18 : /// \endcond 19 : 20 : namespace hydro { 21 : /// @{ 22 : /// Computes the Lorentz factor \f$W=1/\sqrt{1 - v^i v_i}\f$ 23 : template <typename DataType, size_t Dim, typename Frame> 24 1 : void lorentz_factor(gsl::not_null<Scalar<DataType>*> result, 25 : const tnsr::I<DataType, Dim, Frame>& spatial_velocity, 26 : const tnsr::i<DataType, Dim, Frame>& spatial_velocity_form); 27 : 28 : template <typename DataType, size_t Dim, typename Frame> 29 1 : Scalar<DataType> lorentz_factor( 30 : const tnsr::I<DataType, Dim, Frame>& spatial_velocity, 31 : const tnsr::i<DataType, Dim, Frame>& spatial_velocity_form); 32 : 33 : template <typename DataType> 34 1 : void lorentz_factor(gsl::not_null<Scalar<DataType>*> result, 35 : const Scalar<DataType>& spatial_velocity_squared); 36 : 37 : template <typename DataType> 38 1 : Scalar<DataType> lorentz_factor( 39 : const Scalar<DataType>& spatial_velocity_squared); 40 : /// @} 41 : 42 : namespace Tags { 43 : /// Compute item for Lorentz factor \f$W\f$. 44 : /// 45 : /// Can be retrieved using `hydro::Tags::LorentzFactor` 46 : template <typename DataType, size_t Dim, typename Frame> 47 1 : struct LorentzFactorCompute : LorentzFactor<DataType>, db::ComputeTag { 48 0 : using argument_tags = 49 : tmpl::list<SpatialVelocity<DataType, Dim, Frame>, 50 : SpatialVelocityOneForm<DataType, Dim, Frame>>; 51 : 52 0 : using return_type = Scalar<DataType>; 53 : 54 0 : static constexpr auto function = static_cast<void (*)( 55 : gsl::not_null<Scalar<DataType>*>, const tnsr::I<DataType, Dim, Frame>&, 56 : const tnsr::i<DataType, Dim, Frame>&)>( 57 : &lorentz_factor<DataType, Dim, Frame>); 58 : 59 0 : using base = LorentzFactor<DataType>; 60 : }; 61 : } // namespace Tags 62 : } // namespace hydro