SpECTRE  v2024.12.16
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
Tensor

Namespaces

namespace  Frame
 Indicates the Frame that a TensorIndexType is in.
 
namespace  TensorMetafunctions
 Contains all metafunctions related to Tensor manipulations.
 
namespace  tnsr
 Type aliases to construct common Tensors.
 

Classes

struct  Frame::FrameIsPhysical
 Marks a Frame as being "physical" in the sense that it is meaningful to evaluate an analytic solution in that frame. More...
 
struct  tt::is_tensor_index_type< T >
 Inherits from std::true_type if T is a TensorIndexType. More...
 
class  Tensor< X, Symm, IndexList< Indices... > >
 Represents an object with multiple components. More...
 
struct  TensorMetafunctions::replace_frame_in_tag< Tag, NewFrame >
 Replaces Tag with an equivalent Tag but in frame NewFrame. More...
 

Typedefs

template<typename CheckFrame >
using Frame::is_frame_physical = std::integral_constant< bool, std::is_base_of< FrameIsPhysical, CheckFrame >::value >
 Returns std::true_type if the frame is "physical" in the sense that it is meaningful to evaluate an analytic solution in that frame. More...
 
template<size_t SpatialDim, UpLo Ul, typename Fr >
using SpatialIndex = implementation defined
 A SpatialIndex holds information about the number of spatial dimensions, whether the index is covariant or contravariant (UpLo), and the Frame the index is in. More...
 
template<size_t SpatialDim, UpLo Ul, typename Fr >
using SpacetimeIndex = implementation defined
 A SpacetimeIndex holds information about the number of spatial dimensions, whether the index is covariant or contravariant (UpLo), and the Frame the index is in. More...
 
template<typename Index >
using change_index_up_lo = implementation defined? Index::value :Index::value - 1, Index::ul==UpLo::Up ? UpLo::Lo :UpLo::Up, typename Index::Frame, Index::index_type >
 Change the TensorIndexType to be covariant if it's contravariant and vice-versa. More...
 
template<typename Index >
using change_index_type = implementation defined? Index::dim :Index::dim - 1, Index::ul, typename Index::Frame, Index::index_type==IndexType::Spatial ? IndexType::Spacetime :IndexType::Spatial >
 Change the TensorIndexType to be spacetime if it's spatial and vice versa. More...
 
template<typename Symm , typename... IndexPack>
using TensorMetafunctions::check_index_symmetry = implementation defined==1 ? 0 :2 >::template f< Symm, tmpl::map<>, IndexPack... >
 Check that each of symmetric indices is in the same frame and have the same dimensionality.
 
template<typename TheTensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spatial_index = ::Tensor< typename TheTensor::type, tmpl::push_front< typename TheTensor::symmetry, tmpl::int32_t< 1+tmpl::fold< typename TheTensor::symmetry, tmpl::int32_t< 0 >, tmpl::max< tmpl::_state, tmpl::_element > >::value > >, tmpl::push_front< typename TheTensor::index_list, SpatialIndex< VolumeDim, Ul, Fr > > >
 Add a spatial index to the front of a Tensor. More...
 
template<typename TheTensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spacetime_index = ::Tensor< typename TheTensor::type, tmpl::push_front< typename TheTensor::symmetry, tmpl::int32_t< 1+tmpl::fold< typename TheTensor::symmetry, tmpl::int32_t< 0 >, tmpl::max< tmpl::_state, tmpl::_element > >::value > >, tmpl::push_front< typename TheTensor::index_list, SpacetimeIndex< VolumeDim, Ul, Fr > > >
 Add a spacetime index to the front of a Tensor. More...
 
template<typename TheTensor >
using TensorMetafunctions::remove_first_index = ::Tensor< typename TheTensor::type, tmpl::pop_front< typename TheTensor::symmetry >, tmpl::pop_front< typename TheTensor::index_list > >
 remove the first index of a tensor More...
 
template<typename TheTensor >
using TensorMetafunctions::change_all_valences = ::Tensor< typename TheTensor::type, typename TheTensor::symmetry, tmpl::transform< typename TheTensor::index_list, tmpl::bind< change_index_up_lo, tmpl::_1 > > >
 Swap the valences of all indices on a Tensor.
 
template<typename NewType , typename TheTensor >
using TensorMetafunctions::swap_type = ::Tensor< NewType, typename TheTensor::symmetry, typename TheTensor::index_list >
 Swap the data type of a tensor for a new type. More...
 
template<typename TheTensor , typename Frame >
using TensorMetafunctions::any_index_in_frame = implementation defined
 Return tmpl::true_type if any indices of the Tensor are in the frame Frame.
 
template<std::int32_t... T>
using Symmetry = implementation defined< sizeof...(T)>, tmpl::integral_list< std::int32_t, T... > >::type
 Computes the canonical symmetry from the integers T More...
 
template<typename T >
using Scalar = Tensor< T, Symmetry<>, index_list<> >
 Scalar type.
 
template<typename Tag , typename NewFrame >
using TensorMetafunctions::replace_frame_in_tag_t = typename replace_frame_in_tag< Tag, NewFrame >::type
 Replaces Tag with an equivalent Tag but in frame NewFrame.
 
template<typename TagList , typename NewFrame >
using TensorMetafunctions::replace_frame_in_taglist = implementation defined
 Replaces every Tag in Taglist with an equivalent Tag but in frame NewFrame.
 

Enumerations

enum class  UpLo { UpLo::Up , UpLo::Lo }
 Whether a TensorIndexType is covariant or contravariant. More...
 
enum class  IndexType : char { IndexType::Spatial , IndexType::Spacetime }
 Indicates whether the TensorIndexType is Spatial or Spacetime. More...
 

Functions

template<size_t SpatialDim, UpLo Ul, typename Frame , typename DataType , typename SymmList , typename IndexList >
void combine_spacetime_view (gsl::not_null< TensorMetafunctions::prepend_spacetime_index< Tensor< DataType, SymmList, IndexList >, SpatialDim, Ul, Frame > * > spacetime_tensor, const Tensor< DataType, SymmList, IndexList > &time_tensor, const TensorMetafunctions::prepend_spatial_index< Tensor< DataType, SymmList, IndexList >, SpatialDim, Ul, Frame > &spatial_tensor)
 Combines a time component of a tensor with spatial components to produce a spacetime tensor. More...
 
template<size_t NumIndicesToContract, typename LhsTensor , typename T1 , typename T2 >
void contract_first_n_indices (const gsl::not_null< LhsTensor * > lhs_tensor, const T1 &tensor1, const T2 &tensor2)
 Contract the first N indices of two Tensors. More...
 
template<size_t NumIndicesToContract, typename T1 , typename T2 >
auto contract_first_n_indices (const T1 &tensor1, const T2 &tensor2)
 Contract the first N indices of two Tensors. More...
 
template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< Index > > cross_product (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_b)
 Compute the Euclidean cross product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > cross_product (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &vector_b)
 Compute the Euclidean cross product of a vector and a one form. More...
 
template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< Index > > cross_product (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_b, const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index, Index > > &metric_or_inverse_metric, const Scalar< DataType > &metric_determinant)
 Compute the cross product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > cross_product (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &vector_b, const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index, Index > > &metric_or_inverse_metric, const Scalar< DataType > &metric_determinant)
 Compute the cross product of a vector and a one form. More...
 
template<typename DataType , typename Symm , typename IndexList >
double l2_norm (const Tensor< DataType, Symm, IndexList > &tensor)
 Compute Euclidean L2-norm of arbitrary Tensors reduced over an element. More...
 
template<size_t Dim, typename DataType >
tnsr::Ij< DataType, Dim, Frame::NoFrameidentity (const DataType &used_for_type)
 returns the Identity matrix
 
template<typename Fr >
std::string Frame::prefix ()
 The frame-dependent prefix used when constructing the string returned by the name function of a tag. More...
 
template<int I, class... Ts>
constexpr size_t index_dim (const Tensor< Ts... > &)
 Get dimensionality of i'th tensor index. More...
 

Variables

template<typename CheckFrame >
constexpr bool Frame::is_frame_physical_v = is_frame_physical<CheckFrame>::value
 Returns true if the frame is "physical" in the sense that it is meaningful to evaluate an analytic solution in that frame. More...
 
template<typename TheTensor , typename Frame >
constexpr bool TensorMetafunctions::any_index_in_frame_v
 Return true if any indices of the Tensor are in the frame Frame. More...
 
template<typename T , typename Symm , typename Index0 , typename Index1 >
void determinant (const gsl::not_null< Scalar< T > * > det_tensor, const Tensor< T, Symm, index_list< Index0, Index1 > > &tensor)
 Computes the determinant of a rank-2 Tensor tensor. More...
 
template<typename T , typename Symm , typename Index0 , typename Index1 >
Scalar< T > determinant (const Tensor< T, Symm, index_list< Index0, Index1 > > &tensor)
 Computes the determinant of a rank-2 Tensor tensor. More...
 
template<typename T , typename Symm , typename Index0 , typename Index1 >
void determinant_and_inverse (const gsl::not_null< Scalar< T > * > det, const gsl::not_null< Tensor< T, Symm, tmpl::list< change_index_up_lo< Index1 >, change_index_up_lo< Index0 > > > * > inv, const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &tensor)
 Computes the determinant and inverse of a rank-2 Tensor. More...
 
template<typename T , typename Symm , typename Index0 , typename Index1 >
auto determinant_and_inverse (const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &tensor) -> std::pair< Scalar< T >, Tensor< T, Symm, tmpl::list< change_index_up_lo< Index1 >, change_index_up_lo< Index0 > > > >
 Computes the determinant and inverse of a rank-2 Tensor. More...
 
template<typename DetTag , typename InvTag , typename T , typename Symm , typename Index0 , typename Index1 >
void determinant_and_inverse (const gsl::not_null< Variables< tmpl::list< DetTag, InvTag > > * > det_and_inv, const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &tensor)
 Computes the determinant and inverse of a rank-2 Tensor. More...
 
template<typename DetTag , typename InvTag , typename T , typename Symm , typename Index0 , typename Index1 >
auto determinant_and_inverse (const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &tensor) -> Variables< tmpl::list< DetTag, InvTag > >
 Computes the determinant and inverse of a rank-2 Tensor. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void dot_product (const gsl::not_null< Scalar< DataTypeResult > * > dot_product, const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &vector_b)
 Compute the Euclidean dot product of two vectors or one forms. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
Scalar< DataTypeResult > dot_product (const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &vector_b)
 Compute the Euclidean dot product of two vectors or one forms. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void dot_product (const gsl::not_null< Scalar< DataTypeResult > * > dot_product, const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &vector_b)
 Compute the dot product of a vector and a one form. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
Scalar< DataTypeResult > dot_product (const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &vector_b)
 Compute the dot product of a vector and a one form. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename DataTypeMetric , typename Index , typename DataTypeResult = decltype(blaze::evaluate( DataTypeLhs() * DataTypeRhs() * DataTypeMetric()))>
void dot_product (const gsl::not_null< Scalar< DataTypeResult > * > dot_product, const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &vector_b, const Tensor< DataTypeMetric, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &metric)
 Compute the dot_product of two vectors or one forms. More...
 
template<typename DataTypeLhs , typename DataTypeRhs , typename DataTypeMetric , typename Index , typename DataTypeResult = decltype(blaze::evaluate( DataTypeLhs() * DataTypeRhs() * DataTypeMetric()))>
Scalar< DataTypeResult > dot_product (const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &vector_a, const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &vector_b, const Tensor< DataTypeMetric, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &metric)
 Compute the dot_product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
Scalar< DataType > magnitude (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector)
 Compute the Euclidean magnitude of a rank-1 tensor. More...
 
template<typename DataType , typename Index >
void magnitude (const gsl::not_null< Scalar< DataType > * > magnitude, const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector)
 Compute the Euclidean magnitude of a rank-1 tensor. More...
 
template<typename DataType , typename Index >
Scalar< DataType > magnitude (const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &metric)
 Compute the magnitude of a rank-1 tensor. More...
 
template<typename DataType , typename Index >
void magnitude (const gsl::not_null< Scalar< DataType > * > magnitude, const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &vector, const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &metric)
 Compute the magnitude of a rank-1 tensor. More...
 
template<typename DataType , typename Symm , typename IndexList >
Scalar< DataType > pointwise_l2_norm (const Tensor< DataType, Symm, IndexList > &tensor)
 Compute point-wise Euclidean L2-norm of arbitrary Tensors. More...
 
template<typename DataType , typename Symm , typename IndexList >
void pointwise_l2_norm (const gsl::not_null< Scalar< DataType > * > norm, const Tensor< DataType, Symm, IndexList > &tensor)
 Compute point-wise Euclidean L2-norm of arbitrary Tensors. More...
 
template<typename DataType , size_t VolumeDim, typename Frame >
void orthonormal_oneform (gsl::not_null< tnsr::i< DataType, VolumeDim, Frame > * > orthonormal_form, const tnsr::i< DataType, VolumeDim, Frame > &unit_form, const tnsr::II< DataType, VolumeDim, Frame > &inv_spatial_metric)
 Compute a spatial one-form orthonormal to the given unit form. More...
 
template<typename DataType , size_t VolumeDim, typename Frame >
tnsr::i< DataType, VolumeDim, Frame > orthonormal_oneform (const tnsr::i< DataType, VolumeDim, Frame > &unit_form, const tnsr::II< DataType, VolumeDim, Frame > &inv_spatial_metric)
 Compute a spatial one-form orthonormal to the given unit form. More...
 
template<typename DataType , typename Frame >
void orthonormal_oneform (gsl::not_null< tnsr::i< DataType, 3, Frame > * > orthonormal_form, const tnsr::i< DataType, 3, Frame > &first_unit_form, const tnsr::i< DataType, 3, Frame > &second_unit_form, const tnsr::ii< DataType, 3, Frame > &spatial_metric, const Scalar< DataType > &det_spatial_metric)
 Compute a spatial one-form orthonormal to two given unit forms. More...
 
template<typename DataType , typename Frame >
tnsr::i< DataType, 3, Frame > orthonormal_oneform (const tnsr::i< DataType, 3, Frame > &first_unit_form, const tnsr::i< DataType, 3, Frame > &second_unit_form, const tnsr::ii< DataType, 3, Frame > &spatial_metric, const Scalar< DataType > &det_spatial_metric)
 Compute a spatial one-form orthonormal to two given unit forms. More...
 
template<typename DataTypeLhs , typename SymmLhs , typename IndicesLhs , typename DataTypeRhs , typename SymmRhs , typename IndicesRhs , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void outer_product (const gsl::not_null< OuterProductResultTensor< DataTypeResult, SymmLhs, IndicesLhs, SymmRhs, IndicesRhs > * > result, const Tensor< DataTypeLhs, SymmLhs, IndicesLhs > &lhs, const Tensor< DataTypeRhs, SymmRhs, IndicesRhs > &rhs)
 The outer product (or tensor product) of two tensors. More...
 
template<typename DataTypeLhs , typename SymmLhs , typename IndicesLhs , typename DataTypeRhs , typename SymmRhs , typename IndicesRhs , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
auto outer_product (const Tensor< DataTypeLhs, SymmLhs, IndicesLhs > &lhs, const Tensor< DataTypeRhs, SymmRhs, IndicesRhs > &rhs) -> OuterProductResultTensor< DataTypeResult, SymmLhs, IndicesLhs, SymmRhs, IndicesRhs >
 The outer product (or tensor product) of two tensors. More...
 

Detailed Description

Tensor use documentation.

Typedef Documentation

◆ change_index_type

template<typename Index >
using change_index_type = implementation defined? Index::dim : Index::dim - 1, Index::ul, typename Index::Frame, Index::index_type == IndexType::Spatial ? IndexType::Spacetime : IndexType::Spatial>

Change the TensorIndexType to be spacetime if it's spatial and vice versa.

Template Parameters
Indexthe TensorIndexType to change

◆ change_index_up_lo

template<typename Index >
using change_index_up_lo = implementation defined? Index::value : Index::value - 1, Index::ul == UpLo::Up ? UpLo::Lo : UpLo::Up, typename Index::Frame, Index::index_type>

Change the TensorIndexType to be covariant if it's contravariant and vice-versa.

Here is an example of how to use change_index_up_lo

using UpIndex = change_index_up_lo<Index>;
static_assert(std::is_same_v<UpIndex, SpatialIndex<3, UpLo::Up, Frame::Grid>>,
"Failed testing change_index_up_lo");
An integer multi-index.
Definition: Index.hpp:31
Tensor_detail::TensorIndexType< SpatialDim, Ul, Fr, IndexType::Spatial > SpatialIndex
A SpatialIndex holds information about the number of spatial dimensions, whether the index is covaria...
Definition: IndexType.hpp:206
Tensor_detail::TensorIndexType< Index::index_type==IndexType::Spatial ? Index::value :Index::value - 1, Index::ul==UpLo::Up ? UpLo::Lo :UpLo::Up, typename Index::Frame, Index::index_type > change_index_up_lo
Change the TensorIndexType to be covariant if it's contravariant and vice-versa.
Definition: IndexType.hpp:254
Template Parameters
Indexthe TensorIndexType to change

◆ is_frame_physical

template<typename CheckFrame >
using Frame::is_frame_physical = typedef std::integral_constant<bool, std::is_base_of<FrameIsPhysical, CheckFrame>::value>

Returns std::true_type if the frame is "physical" in the sense that it is meaningful to evaluate an analytic solution in that frame.

Example

static_assert(not Frame::is_frame_physical_v<Frame::BlockLogical>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::ElementLogical>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::Distorted>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::Grid>,
"Failed testing Frame::is_frame_physical");
static_assert(Frame::is_frame_physical_v<Frame::Inertial>,
"Failed testing Frame::is_frame_physical");

◆ prepend_spacetime_index

template<typename TheTensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spacetime_index = typedef ::Tensor< typename TheTensor::type, tmpl::push_front< typename TheTensor::symmetry, tmpl::int32_t< 1 + tmpl::fold<typename TheTensor::symmetry, tmpl::int32_t<0>, tmpl::max<tmpl::_state, tmpl::_element> >::value> >, tmpl::push_front<typename TheTensor::index_list, SpacetimeIndex<VolumeDim, Ul, Fr> >>

Add a spacetime index to the front of a Tensor.

Template Parameters
TheTensorthe tensor type to which the new index is prepended
VolumeDimthe volume dimension of the tensor index to prepend
Frthe Frame of the tensor index to prepend

◆ prepend_spatial_index

template<typename TheTensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spatial_index = typedef ::Tensor< typename TheTensor::type, tmpl::push_front< typename TheTensor::symmetry, tmpl::int32_t< 1 + tmpl::fold<typename TheTensor::symmetry, tmpl::int32_t<0>, tmpl::max<tmpl::_state, tmpl::_element> >::value> >, tmpl::push_front<typename TheTensor::index_list, SpatialIndex<VolumeDim, Ul, Fr> >>

Add a spatial index to the front of a Tensor.

Template Parameters
TheTensorthe tensor type to which the new index is prepended
VolumeDimthe volume dimension of the tensor index to prepend
Frthe Frame of the tensor index to prepend

◆ remove_first_index

template<typename TheTensor >
using TensorMetafunctions::remove_first_index = typedef ::Tensor<typename TheTensor::type, tmpl::pop_front<typename TheTensor::symmetry>, tmpl::pop_front<typename TheTensor::index_list> >

remove the first index of a tensor

Template Parameters
TheTensorthe tensor type whose first index is removed

◆ SpacetimeIndex

template<size_t SpatialDim, UpLo Ul, typename Fr >
using SpacetimeIndex = implementation defined

A SpacetimeIndex holds information about the number of spatial dimensions, whether the index is covariant or contravariant (UpLo), and the Frame the index is in.

Template Parameters
SpatialDimthe spatial dimensionality of the TensorIndexType
Uleither UpLo::Up or UpLo::Lo for contra or covariant
Frthe Frame the TensorIndexType is in

◆ SpatialIndex

template<size_t SpatialDim, UpLo Ul, typename Fr >
using SpatialIndex = implementation defined

A SpatialIndex holds information about the number of spatial dimensions, whether the index is covariant or contravariant (UpLo), and the Frame the index is in.

Template Parameters
SpatialDimthe spatial dimensionality of the TensorIndexType
Uleither UpLo::Up or UpLo::Lo for contra or covariant
Frthe Frame the TensorIndexType is in

◆ swap_type

template<typename NewType , typename TheTensor >
using TensorMetafunctions::swap_type = typedef ::Tensor<NewType, typename TheTensor::symmetry, typename TheTensor::index_list>

Swap the data type of a tensor for a new type.

Template Parameters
NewTypethe new data type
TheTensorthe tensor from which to keep symmetry and index information

◆ Symmetry

template<std::int32_t... T>
using Symmetry = implementation defined<sizeof...(T)>, tmpl::integral_list<std::int32_t, T...> >::type

Computes the canonical symmetry from the integers T

Details

Compute the canonical symmetry typelist given a set of integers, T. The resulting typelist is in ascending order of the integers, from right to left. For example, the result of Symmetry<1, 2, 1, 3> is integral_list<int32_t, 2, 3, 2, 1>. Anti-symmetries are not currently supported.

Template Parameters
Tthe integers denoting the symmetry of the Tensor

Enumeration Type Documentation

◆ IndexType

enum class IndexType : char
strong

Indicates whether the TensorIndexType is Spatial or Spacetime.

Enumerator
Spatial 

The TensorIndexType is purely spatial.

Spacetime 

The TensorIndexType is a spacetime index.

◆ UpLo

enum class UpLo
strong

Whether a TensorIndexType is covariant or contravariant.

Enumerator
Up 

Contravariant, or Upper index.

Lo 

Covariant, or Lower index.

Function Documentation

◆ combine_spacetime_view()

template<size_t SpatialDim, UpLo Ul, typename Frame , typename DataType , typename SymmList , typename IndexList >
void combine_spacetime_view ( gsl::not_null< TensorMetafunctions::prepend_spacetime_index< Tensor< DataType, SymmList, IndexList >, SpatialDim, Ul, Frame > * >  spacetime_tensor,
const Tensor< DataType, SymmList, IndexList > &  time_tensor,
const TensorMetafunctions::prepend_spatial_index< Tensor< DataType, SymmList, IndexList >, SpatialDim, Ul, Frame > &  spatial_tensor 
)

Combines a time component of a tensor with spatial components to produce a spacetime tensor.

Details

Combines a time component of a tensor with spatial components to produce a spacetime tensor. Specifically, the components of the result are views to the inputs. Can do so for a tensor of any rank, but requires that the new index is the first index of the resulting tensor, replacing the position of the spatial index in the input spatial tensor. For instance, it may combine ϕ with Ai into Aa=(ϕ,Ai), or it may combine Aabc with Biabc into Cabcd=(Abcd,Bibcd), but it may not combine Aia with Bija to produce a tensor of the form Ciab.

Template Parameters
SpatialDimthe number of spatial dimensions in the input and output tensors
Ulwhether the new index is covariant or contravariant (must match that of the spatial index of the input spatial tensor)
Framethe frame of the new spacetime index (must match that of the spatial index of the input spatial tensor)

◆ contract_first_n_indices() [1/2]

template<size_t NumIndicesToContract, typename LhsTensor , typename T1 , typename T2 >
void contract_first_n_indices ( const gsl::not_null< LhsTensor * >  lhs_tensor,
const T1 &  tensor1,
const T2 &  tensor2 
)

Contract the first N indices of two Tensors.

Details

The indices of lhs_tensor should be the concatenation of the uncontracted indices of tensor1 and the uncontracted indices of tensor2, in this order. For example, if tensor1 is rank 3, tensor2 is rank 4, and we want to contract the first two indices, the indices of lhs_tensor need to be the last index of tensor1 followed by the 3rd index and then the 4th index of tensor2.

The index types (spatial or spacetime) must be the same for the two indices in a pair of indices being contracted. Support can be added to this function to automatically contract the spatial indices of a spacetime index with a spatial index.

Template Parameters
NumIndicesToContractthe number of indices to contract
Parameters
lhs_tensorthe result LHS Tensor
tensor1the first Tensor of the two to contract
tensor2the second Tensor of the two to contract

◆ contract_first_n_indices() [2/2]

template<size_t NumIndicesToContract, typename T1 , typename T2 >
auto contract_first_n_indices ( const T1 &  tensor1,
const T2 &  tensor2 
)

Contract the first N indices of two Tensors.

Details

The indices of the returned Tensor will be the concatenation of the uncontracted indices of tensor1 and the uncontracted indices of tensor2, in this order. For example, if tensor1 is rank 3, tensor2 is rank 4, and we want to contract the first two indices, the indices of the returned Tensor will be the last index of tensor1 followed by the 3rd index and then the 4th index of tensor2.

The index types (spatial or spacetime) must be the same for the two indices in a pair of indices being contracted. Support can be added to this function to automatically contract the spatial indices of a spacetime index with a spatial index.

Template Parameters
NumIndicesToContractthe number of indices to contract
Parameters
tensor1the first Tensor of the two to contract
tensor2the second Tensor of the two to contract

◆ cross_product() [1/4]

template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > cross_product ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &  vector_b 
)

Compute the Euclidean cross product of a vector and a one form.

Details

Returns AjBlδlkϵijk for input vector Aj and input one form Bl or AjBlδlkϵijk for input one form Aj and input vector Bl. Note that this function returns a vector if vector_b is a vector and a one form if vector_b is a one form.

◆ cross_product() [2/4]

template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > cross_product ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataType, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &  vector_b,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index, Index > > &  metric_or_inverse_metric,
const Scalar< DataType > &  metric_determinant 
)

Compute the cross product of a vector and a one form.

Details

Returns gAjBlglkϵijk for input vector Aj and input one form Bl. In this case, the argument vector_a should be a vector, vector_b should be a one form, metric_or_inverse_metric should be the inverse spatial metric gij, and metric_determinant should be the determinant of the spatial metric det(gij). Or, returns g1AjBlglkϵijk for input one form Aj and input vector Bl. In this case, the argument vector_a should be a one form, vector_b should be a vector, metric_or_inverse_metric should be the spatial metric gij, and metric_determinant should be the determinant of the spatial metric det(gij). Note that this function returns a vector if vector_b is a vector and a one form if vector_b is a one form.

◆ cross_product() [3/4]

template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< Index > > cross_product ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_b 
)

Compute the Euclidean cross product of two vectors or one forms.

Details

Returns AjBkϵljkδil for input vectors Aj and Bk or AjBkϵljkδil for input one forms Aj and Bk.

◆ cross_product() [4/4]

template<typename DataType , typename Index >
Tensor< DataType, Symmetry< 1 >, index_list< Index > > cross_product ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector_b,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index, Index > > &  metric_or_inverse_metric,
const Scalar< DataType > &  metric_determinant 
)

Compute the cross product of two vectors or one forms.

Details

Returns ggliAjBkϵljk, where Aj and Bk are vectors and gli and g are the inverse and determinant, respectively, of the spatial metric (computed via determinant_and_inverse). In this case, the arguments vector_a and vector_b should be vectors, the argument metric_or_inverse_metric should be the inverse spatial metric gij, and the argument metric_determinant should be the determinant of the spatial metric det(gij). Or, returns g1gliAjBkϵljk, where Aj and Bk are one forms and gli and g are the spatial metric and its determinant. In this case, the arguments vector_a and vector_b should be one forms, the argument metric_or_inverse_metric should be the spatial metric gij, and the argument metric_determinant should be the determinant of the spatial metric det(gij).

◆ determinant() [1/2]

template<typename T , typename Symm , typename Index0 , typename Index1 >
void determinant ( const gsl::not_null< Scalar< T > * >  det_tensor,
const Tensor< T, Symm, index_list< Index0, Index1 > > &  tensor 
)

Computes the determinant of a rank-2 Tensor tensor.

Requires: That tensor be a rank-2 Tensor, with both indices sharing the same dimension and type.

◆ determinant() [2/2]

template<typename T , typename Symm , typename Index0 , typename Index1 >
Scalar< T > determinant ( const Tensor< T, Symm, index_list< Index0, Index1 > > &  tensor)

Computes the determinant of a rank-2 Tensor tensor.

Requires: That tensor be a rank-2 Tensor, with both indices sharing the same dimension and type.

◆ determinant_and_inverse() [1/4]

template<typename T , typename Symm , typename Index0 , typename Index1 >
void determinant_and_inverse ( const gsl::not_null< Scalar< T > * >  det,
const gsl::not_null< Tensor< T, Symm, tmpl::list< change_index_up_lo< Index1 >, change_index_up_lo< Index0 > > > * >  inv,
const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &  tensor 
)

Computes the determinant and inverse of a rank-2 Tensor.

Computes the determinant and inverse together, because this leads to fewer operations compared to computing the determinant independently.

Details

Treats the input rank-2 tensor as a matrix. The first (second) index of the tensor corresponds to the rows (columns) of the matrix. The determinant is a scalar tensor. The inverse is a rank-2 tensor whose indices are reversed and of opposite valence relative to the input tensor, i.e. given Tab returns (Tinv)ba.

Note
When inverting a 4x4 spacetime metric, it is typically more efficient to use the 3+1 decomposition of the 4-metric in terms of lapse, shift, and spatial 3-metric, in which only the spatial 3-metric needs to be inverted.

◆ determinant_and_inverse() [2/4]

template<typename DetTag , typename InvTag , typename T , typename Symm , typename Index0 , typename Index1 >
void determinant_and_inverse ( const gsl::not_null< Variables< tmpl::list< DetTag, InvTag > > * >  det_and_inv,
const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &  tensor 
)

Computes the determinant and inverse of a rank-2 Tensor.

Computes the determinant and inverse together, because this leads to fewer operations compared to computing the determinant independently.

Template Parameters
DetTagthe Tag for the determinant of input Tensor.
InvTagthe Tag for the inverse of input Tensor.

Details

See determinant_and_inverse().

◆ determinant_and_inverse() [3/4]

template<typename T , typename Symm , typename Index0 , typename Index1 >
auto determinant_and_inverse ( const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &  tensor) -> std::pair<Scalar<T>, Tensor<T, Symm, tmpl::list<change_index_up_lo<Index1>, change_index_up_lo<Index0>>>>

Computes the determinant and inverse of a rank-2 Tensor.

Computes the determinant and inverse together, because this leads to fewer operations compared to computing the determinant independently.

Details

Treats the input rank-2 tensor as a matrix. The first (second) index of the tensor corresponds to the rows (columns) of the matrix. The determinant is a scalar tensor. The inverse is a rank-2 tensor whose indices are reversed and of opposite valence relative to the input tensor, i.e. given Tab returns (Tinv)ba.

Note
When inverting a 4x4 spacetime metric, it is typically more efficient to use the 3+1 decomposition of the 4-metric in terms of lapse, shift, and spatial 3-metric, in which only the spatial 3-metric needs to be inverted.

◆ determinant_and_inverse() [4/4]

template<typename DetTag , typename InvTag , typename T , typename Symm , typename Index0 , typename Index1 >
auto determinant_and_inverse ( const Tensor< T, Symm, tmpl::list< Index0, Index1 > > &  tensor) -> Variables<tmpl::list<DetTag, InvTag>>

Computes the determinant and inverse of a rank-2 Tensor.

Computes the determinant and inverse together, because this leads to fewer operations compared to computing the determinant independently.

Template Parameters
DetTagthe Tag for the determinant of input Tensor.
InvTagthe Tag for the inverse of input Tensor.

Details

See determinant_and_inverse().

◆ dot_product() [1/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void dot_product ( const gsl::not_null< Scalar< DataTypeResult > * >  dot_product,
const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &  vector_b 
)

Compute the dot product of a vector and a one form.

Details

Returns AaBbδab for input vector Aa and input one form Bb or AaBbδba for input one form Aa and input vector Bb.

◆ dot_product() [2/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void dot_product ( const gsl::not_null< Scalar< DataTypeResult > * >  dot_product,
const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &  vector_b 
)

Compute the Euclidean dot product of two vectors or one forms.

Details

Returns AaBbδab for input vectors Aa and Bb or AaBbδab for input one forms Aa and Bb.

◆ dot_product() [3/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename DataTypeMetric , typename Index , typename DataTypeResult = decltype(blaze::evaluate( DataTypeLhs() * DataTypeRhs() * DataTypeMetric()))>
void dot_product ( const gsl::not_null< Scalar< DataTypeResult > * >  dot_product,
const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &  vector_b,
const Tensor< DataTypeMetric, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &  metric 
)

Compute the dot_product of two vectors or one forms.

Details

Returns gabAaBb, where gab is the metric, Aa is vector_a, and Bb is vector_b. Or, returns gabAaBb when given one forms Aa and Bb with an inverse metric gab.

◆ dot_product() [4/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
Scalar< DataTypeResult > dot_product ( const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< change_index_up_lo< Index > > > &  vector_b 
)

Compute the dot product of a vector and a one form.

Details

Returns AaBbδab for input vector Aa and input one form Bb or AaBbδba for input one form Aa and input vector Bb.

◆ dot_product() [5/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename Index , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
Scalar< DataTypeResult > dot_product ( const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &  vector_b 
)

Compute the Euclidean dot product of two vectors or one forms.

Details

Returns AaBbδab for input vectors Aa and Bb or AaBbδab for input one forms Aa and Bb.

◆ dot_product() [6/6]

template<typename DataTypeLhs , typename DataTypeRhs , typename DataTypeMetric , typename Index , typename DataTypeResult = decltype(blaze::evaluate( DataTypeLhs() * DataTypeRhs() * DataTypeMetric()))>
Scalar< DataTypeResult > dot_product ( const Tensor< DataTypeLhs, Symmetry< 1 >, index_list< Index > > &  vector_a,
const Tensor< DataTypeRhs, Symmetry< 1 >, index_list< Index > > &  vector_b,
const Tensor< DataTypeMetric, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &  metric 
)

Compute the dot_product of two vectors or one forms.

Details

Returns gabAaBb, where gab is the metric, Aa is vector_a, and Bb is vector_b. Or, returns gabAaBb when given one forms Aa and Bb with an inverse metric gab.

◆ index_dim()

template<int I, class... Ts>
constexpr size_t index_dim ( const Tensor< Ts... > &  )
constexpr

Get dimensionality of i'th tensor index.

index_list<SpacetimeIndex<2, UpLo::Up, Frame::Inertial>,
const T t{};
CHECK(index_dim<0>(t) == 3);
CHECK(index_dim<1>(t) == 1);
CHECK(index_dim<2>(t) == 2);
CHECK(T::index_dim(0) == 3);
CHECK(T::index_dim(1) == 1);
CHECK(T::index_dim(2) == 2);
CHECK(T::index_dims() == std::array<size_t, 3>{{3, 1, 2}});
Definition: ContractFirstNIndices.hpp:16
constexpr size_t index_dim(const Tensor< Ts... > &)
Get dimensionality of i'th tensor index.
Definition: Tensor.hpp:574

◆ l2_norm()

template<typename DataType , typename Symm , typename IndexList >
double l2_norm ( const Tensor< DataType, Symm, IndexList > &  tensor)

Compute Euclidean L2-norm of arbitrary Tensors reduced over an element.

Details

Computes the RMS value of the point-wise Frobenius norm of a given Tensor with arbitrary rank over all grid points in an element. If the Tensor A has rank n and dimensionality D, and the element (of order N) has N+1 points, then its element-reduced Frobenius norm is computed as:

(1)||A||2=(1N+1p=0N(i1=0D1i2=0D1in=0D1|Ai1i2inp|2))1/2,

where both contra-variant and co-variant indices are shown as lower indices, and p indexes grid points in the element.

Warning
This function reduces the Frobenius norm over the element, not the whole domain.

◆ magnitude() [1/4]

template<typename DataType , typename Index >
void magnitude ( const gsl::not_null< Scalar< DataType > * >  magnitude,
const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector 
)

Compute the Euclidean magnitude of a rank-1 tensor.

Details

Computes the square root of the sum of the squares of the components of the rank-1 tensor.

◆ magnitude() [2/4]

template<typename DataType , typename Index >
void magnitude ( const gsl::not_null< Scalar< DataType > * >  magnitude,
const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &  metric 
)

Compute the magnitude of a rank-1 tensor.

Details

Returns the square root of the input tensor contracted twice with the given metric.

◆ magnitude() [3/4]

template<typename DataType , typename Index >
Scalar< DataType > magnitude ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector)

Compute the Euclidean magnitude of a rank-1 tensor.

Details

Computes the square root of the sum of the squares of the components of the rank-1 tensor.

◆ magnitude() [4/4]

template<typename DataType , typename Index >
Scalar< DataType > magnitude ( const Tensor< DataType, Symmetry< 1 >, index_list< Index > > &  vector,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< change_index_up_lo< Index >, change_index_up_lo< Index > > > &  metric 
)

Compute the magnitude of a rank-1 tensor.

Details

Returns the square root of the input tensor contracted twice with the given metric.

◆ orthonormal_oneform() [1/4]

template<typename DataType , typename Frame >
tnsr::i< DataType, 3, Frame > orthonormal_oneform ( const tnsr::i< DataType, 3, Frame > &  first_unit_form,
const tnsr::i< DataType, 3, Frame > &  second_unit_form,
const tnsr::ii< DataType, 3, Frame > &  spatial_metric,
const Scalar< DataType > &  det_spatial_metric 
)

Compute a spatial one-form orthonormal to two given unit forms.

Given a unit spatial one-form si and another form ti that is orthonormal to si, compute a new form ui which is orthonormal to both si and ti, in the sense that γijsiuj=γijtiuj=0, for the given inverse spatial metric γij. The normalization of ui is such that γijuiuj=1.

Details

The new form is obtained by taking the covariant cross product of si and ti, for which the spatial metric as well as its determinant must be provided.

◆ orthonormal_oneform() [2/4]

template<typename DataType , size_t VolumeDim, typename Frame >
tnsr::i< DataType, VolumeDim, Frame > orthonormal_oneform ( const tnsr::i< DataType, VolumeDim, Frame > &  unit_form,
const tnsr::II< DataType, VolumeDim, Frame > &  inv_spatial_metric 
)

Compute a spatial one-form orthonormal to the given unit form.

Given a unit spatial one-form si, compute a new form ti which is orthonormal to si, in the sense that γijsitj=0, for the given inverse spatial metric γij. The normalization of ti is such that γijtitj=1.

Details

The new form is obtained via Gram-Schmidt process, starting from a form whose components are ti=δiI, where I is the index of the component of si with the smallest absolute value.

◆ orthonormal_oneform() [3/4]

template<typename DataType , typename Frame >
void orthonormal_oneform ( gsl::not_null< tnsr::i< DataType, 3, Frame > * >  orthonormal_form,
const tnsr::i< DataType, 3, Frame > &  first_unit_form,
const tnsr::i< DataType, 3, Frame > &  second_unit_form,
const tnsr::ii< DataType, 3, Frame > &  spatial_metric,
const Scalar< DataType > &  det_spatial_metric 
)

Compute a spatial one-form orthonormal to two given unit forms.

Given a unit spatial one-form si and another form ti that is orthonormal to si, compute a new form ui which is orthonormal to both si and ti, in the sense that γijsiuj=γijtiuj=0, for the given inverse spatial metric γij. The normalization of ui is such that γijuiuj=1.

Details

The new form is obtained by taking the covariant cross product of si and ti, for which the spatial metric as well as its determinant must be provided.

◆ orthonormal_oneform() [4/4]

template<typename DataType , size_t VolumeDim, typename Frame >
void orthonormal_oneform ( gsl::not_null< tnsr::i< DataType, VolumeDim, Frame > * >  orthonormal_form,
const tnsr::i< DataType, VolumeDim, Frame > &  unit_form,
const tnsr::II< DataType, VolumeDim, Frame > &  inv_spatial_metric 
)

Compute a spatial one-form orthonormal to the given unit form.

Given a unit spatial one-form si, compute a new form ti which is orthonormal to si, in the sense that γijsitj=0, for the given inverse spatial metric γij. The normalization of ti is such that γijtitj=1.

Details

The new form is obtained via Gram-Schmidt process, starting from a form whose components are ti=δiI, where I is the index of the component of si with the smallest absolute value.

◆ outer_product() [1/2]

template<typename DataTypeLhs , typename SymmLhs , typename IndicesLhs , typename DataTypeRhs , typename SymmRhs , typename IndicesRhs , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
void outer_product ( const gsl::not_null< OuterProductResultTensor< DataTypeResult, SymmLhs, IndicesLhs, SymmRhs, IndicesRhs > * >  result,
const Tensor< DataTypeLhs, SymmLhs, IndicesLhs > &  lhs,
const Tensor< DataTypeRhs, SymmRhs, IndicesRhs > &  rhs 
)

The outer product (or tensor product) of two tensors.

Details

Computes Aij=BiCj for two tensors Bi and Cj. Both tensors can have arbitrary indices and symmetries.

◆ outer_product() [2/2]

template<typename DataTypeLhs , typename SymmLhs , typename IndicesLhs , typename DataTypeRhs , typename SymmRhs , typename IndicesRhs , typename DataTypeResult = decltype(blaze::evaluate(DataTypeLhs() * DataTypeRhs()))>
auto outer_product ( const Tensor< DataTypeLhs, SymmLhs, IndicesLhs > &  lhs,
const Tensor< DataTypeRhs, SymmRhs, IndicesRhs > &  rhs 
) -> OuterProductResultTensor<DataTypeResult, SymmLhs, IndicesLhs, SymmRhs, IndicesRhs>

The outer product (or tensor product) of two tensors.

Details

Computes Aij=BiCj for two tensors Bi and Cj. Both tensors can have arbitrary indices and symmetries.

◆ pointwise_l2_norm() [1/2]

template<typename DataType , typename Symm , typename IndexList >
void pointwise_l2_norm ( const gsl::not_null< Scalar< DataType > * >  norm,
const Tensor< DataType, Symm, IndexList > &  tensor 
)

Compute point-wise Euclidean L2-norm of arbitrary Tensors.

Details

At each grid point p in the element, this function computes the point-wise Frobenius norm of a given Tensor with arbitrary rank. If the Tensor A has rank n and dimensionality D, then its Frobenius norm at point p is computed as:

(2)||A||2(p)=(i1=0D1i2=0D1in=0D1|Ai1i2in(p)|2)1/2,

where both contra-variant and co-variant indices are shown as lower indices.

◆ pointwise_l2_norm() [2/2]

template<typename DataType , typename Symm , typename IndexList >
Scalar< DataType > pointwise_l2_norm ( const Tensor< DataType, Symm, IndexList > &  tensor)

Compute point-wise Euclidean L2-norm of arbitrary Tensors.

Details

At each grid point p in the element, this function computes the point-wise Frobenius norm of a given Tensor with arbitrary rank. If the Tensor A has rank n and dimensionality D, then its Frobenius norm at point p is computed as:

(3)||A||2(p)=(i1=0D1i2=0D1in=0D1|Ai1i2in(p)|2)1/2,

where both contra-variant and co-variant indices are shown as lower indices.

◆ prefix()

template<typename Fr >
std::string Frame::prefix ( )
inline

The frame-dependent prefix used when constructing the string returned by the name function of a tag.

For Frame::Inertial it is the empty string, otherwise, it is the name of the Frame followed by an underscore (as the name will be used in I/O).

Example

TestHelpers::db::test_simple_tag<
"Grid_SpatialVelocity");
TestHelpers::db::test_simple_tag<hydro::Tags::SpatialVelocityOneForm<
"ElementLogical_SpatialVelocityOneForm");
Stores a collection of function values.
Definition: DataVector.hpp:48
Definition: IndexType.hpp:43
The spatial velocity one-form , where is raised and lowered with the spatial metric.
Definition: Tags.hpp:282
The spatial velocity of the fluid, where . Here is the spatial part of the 4-velocity of the fluid,...
Definition: Tags.hpp:274

Variable Documentation

◆ any_index_in_frame_v

template<typename TheTensor , typename Frame >
constexpr bool TensorMetafunctions::any_index_in_frame_v
constexpr
Initial value:
=
tmpl::any< typename TheTensor::index_list, tmpl::bind< detail::frame_is_the_same, tmpl::_1, Frame > > any_index_in_frame
Return tmpl::true_type if any indices of the Tensor are in the frame Frame.
Definition: Metafunctions.hpp:148

Return true if any indices of the Tensor are in the frame Frame.

◆ is_frame_physical_v

template<typename CheckFrame >
constexpr bool Frame::is_frame_physical_v = is_frame_physical<CheckFrame>::value
constexpr

Returns true if the frame is "physical" in the sense that it is meaningful to evaluate an analytic solution in that frame.

Example

static_assert(not Frame::is_frame_physical_v<Frame::BlockLogical>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::ElementLogical>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::Distorted>,
"Failed testing Frame::is_frame_physical");
static_assert(not Frame::is_frame_physical_v<Frame::Grid>,
"Failed testing Frame::is_frame_physical");
static_assert(Frame::is_frame_physical_v<Frame::Inertial>,
"Failed testing Frame::is_frame_physical");