Namespaces | Classes | Typedefs | Enumerations | Functions | Variables
Tensor

Namespaces

 Frame
 Indicates the Frame that a TensorIndexType is in.
 
 TensorMetafunctions
 Contains all metafunctions related to Tensor manipulations.
 
 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...
 

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 = Tensor_detail::TensorIndexType< SpatialDim, Ul, Fr, IndexType::Spatial >
 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 = Tensor_detail::TensorIndexType< SpatialDim, Ul, Fr, IndexType::Spacetime >
 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 = 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 the TensorIndexType to be covariant if it's contravariant and vice-versa. More...
 
template<typename Symm , typename... IndexPack>
using TensorMetafunctions::check_index_symmetry = typename detail::check_index_symmetry_impl< tmpl::size< Symm >::value==0 or tmpl::size< Symm >::value==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 Tensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spatial_index = ::Tensor< typename Tensor::type, tmpl::push_front< typename Tensor::symmetry, tmpl::int32_t< 1+tmpl::fold< typename Tensor::symmetry, tmpl::int32_t< 0 >, tmpl::max< tmpl::_state, tmpl::_element > >::value > >, tmpl::push_front< typename Tensor::index_list, SpatialIndex< VolumeDim, Ul, Fr > >>
 Add a spatial index to the front of a Tensor. More...
 
template<typename Tensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spacetime_index = ::Tensor< typename Tensor::type, tmpl::push_front< typename Tensor::symmetry, tmpl::int32_t< 1+tmpl::fold< typename Tensor::symmetry, tmpl::int32_t< 0 >, tmpl::max< tmpl::_state, tmpl::_element > >::value > >, tmpl::push_front< typename Tensor::index_list, SpacetimeIndex< VolumeDim, Ul, Fr > >>
 Add a spacetime index to the front of a Tensor. More...
 
template<typename Tensor >
using TensorMetafunctions::remove_first_index = ::Tensor< typename Tensor::type, tmpl::pop_front< typename Tensor::symmetry >, tmpl::pop_front< typename Tensor::index_list > >
 remove the first index of a tensor More...
 
template<typename NewType , typename Tensor >
using TensorMetafunctions::swap_type = ::Tensor< NewType, typename Tensor::symmetry, typename Tensor::index_list >
 Swap the data type of a tensor for a new type. More...
 
template<std::int32_t... T>
using Symmetry = typename detail::SymmetryImpl< std::make_index_sequence< 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.
 

Enumerations

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

Functions

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) noexcept
 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) noexcept
 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) noexcept
 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) noexcept
 Compute the cross product of a vector and a one form. 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 >
auto determinant_and_inverse (const Tensor< T, Symm, tmpl::list< Index0, Index1 >> &tensor) noexcept -> 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 TensorType >
TensorType divide_by (TensorType tensor, const DataVector &divisor)
 Divides the components of a tensor by a scalar. More...
 
template<typename DataType , typename Index >
Scalar< DataType > magnitude (const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector) noexcept
 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) noexcept
 Compute the magnitude of a rank-1 tensor. More...
 
template<size_t Dim, typename DataType >
tnsr::Ij< DataType, Dim, Frame::NoFrameidentity (const DataType &used_for_type) noexcept
 returns the Identity matrix
 
template<typename Fr >
std::string Frame::prefix () noexcept
 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... > &) noexcept
 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 DataType , typename Index >
void dot_product (const gsl::not_null< Scalar< DataType > *> dot_product, const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_b) noexcept
 Compute the Euclidean dot product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
Scalar< DataType > dot_product (const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_a, const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &vector_b) noexcept
 Compute the Euclidean dot product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
void dot_product (const gsl::not_null< Scalar< DataType > *> dot_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) noexcept
 Compute the dot product of a vector and a one form. More...
 
template<typename DataType , typename Index >
Scalar< DataType > dot_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) noexcept
 Compute the dot product of a vector and a one form. More...
 
template<typename DataType , typename Index >
void dot_product (const gsl::not_null< Scalar< DataType > *> dot_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< change_index_up_lo< Index >, change_index_up_lo< Index >>> &metric) noexcept
 Compute the dot_product of two vectors or one forms. More...
 
template<typename DataType , typename Index >
Scalar< DataType > dot_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< change_index_up_lo< Index >, change_index_up_lo< Index >>> &metric) noexcept
 Compute the dot_product of two vectors or one forms. More...
 

Detailed Description

Tensor use documentation.

Typedef Documentation

◆ change_index_up_lo

template<typename Index >
using change_index_up_lo = 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 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>;
"Failed testing change_index_up_lo");
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::Logical>,
"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 Tensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spacetime_index = typedef ::Tensor< typename Tensor::type, tmpl::push_front< typename Tensor::symmetry, tmpl::int32_t< 1 + tmpl::fold<typename Tensor::symmetry, tmpl::int32_t<0>, tmpl::max<tmpl::_state, tmpl::_element> >::value> >, tmpl::push_front<typename Tensor::index_list, SpacetimeIndex<VolumeDim, Ul, Fr> >>

Add a spacetime index to the front of a Tensor.

Template Parameters
Tensorthe 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 Tensor , std::size_t VolumeDim, UpLo Ul, typename Fr = Frame::Grid>
using TensorMetafunctions::prepend_spatial_index = typedef ::Tensor< typename Tensor::type, tmpl::push_front< typename Tensor::symmetry, tmpl::int32_t< 1 + tmpl::fold<typename Tensor::symmetry, tmpl::int32_t<0>, tmpl::max<tmpl::_state, tmpl::_element> >::value> >, tmpl::push_front<typename Tensor::index_list, SpatialIndex<VolumeDim, Ul, Fr> >>

Add a spatial index to the front of a Tensor.

Template Parameters
Tensorthe 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 Tensor >
using TensorMetafunctions::remove_first_index = typedef ::Tensor<typename Tensor::type, tmpl::pop_front<typename Tensor::symmetry>, tmpl::pop_front<typename Tensor::index_list> >

remove the first index of a tensor

Template Parameters
Tensorthe tensor type whose first index is removed

◆ SpacetimeIndex

template<size_t SpatialDim, UpLo Ul, typename Fr >
using SpacetimeIndex = Tensor_detail::TensorIndexType<SpatialDim, Ul, Fr, IndexType::Spacetime>

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 = Tensor_detail::TensorIndexType<SpatialDim, Ul, Fr, IndexType::Spatial>

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 Tensor >
using TensorMetafunctions::swap_type = typedef ::Tensor<NewType, typename Tensor::symmetry, typename Tensor::index_list>

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

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

◆ Symmetry

template<std::int32_t... T>
using Symmetry = typename detail::SymmetryImpl< std::make_index_sequence<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 descending order of the absolute value of the integers. For example, the result of Symmetry<1, 2, 3> is integral_list<int32_t, 3, 2, 1>. Anti-symmetries can be denoted with a minus sign on either or both indices. That is, Symmetry<-1, 2, 1> is anti-symmetric in the first and last index and is the same as Symmetry<-1, 2, -1>. Note: two minus signs are still anti-symmetric because it simplifies the algorithm used to compute the canonical form of the symmetry.

Template Parameters
Tthe integers denoting the symmetry of the Tensor

Enumeration Type Documentation

◆ IndexType

enum 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 UpLo
strong

Whether a TensorIndexType is covariant or contravariant.

Enumerator
Up 

Contravariant, or Upper index.

Lo 

Covariant, or Lower index.

Function Documentation

◆ cross_product() [1/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 
)
noexcept

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

Details

Returns \(A^j B^k \epsilon_{ljk} \delta^{il}\) for input vectors \(A^j\) and \(B^k\) or \(A_j B_k \epsilon^{ljk} \delta_{il}\) for input one forms \(A_j\) and \(B_k\).

◆ 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 
)
noexcept

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

Details

Returns \(A^j B_l \delta^{lk} \epsilon_{ijk}\) for input vector \(A^j\) and input one form \(B_l\) or \(A_j B^l \delta_{lk} \epsilon^{ijk}\) for input one form \(A_j\) and input vector \(B^l\). 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,
const Tensor< DataType, Symmetry< 1, 1 >, index_list< Index, Index >> &  metric_or_inverse_metric,
const Scalar< DataType > &  metric_determinant 
)
noexcept

Compute the cross product of two vectors or one forms.

Details

Returns \(\sqrt{g} g^{li} A^j B^k \epsilon_{ljk}\), where \(A^j\) and \(B^k\) are vectors and \(g^{li}\) 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 \(g^{ij}\), and the argument metric_determinant should be the determinant of the spatial metric \(\det(g_{ij})\). Or, returns \(\sqrt{g}^{-1} g_{li} A_j B_k \epsilon^{ljk}\), where \(A_j\) and \(B_k\) are one forms and \(g_{li}\) 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 \(g_{ij}\), and the argument metric_determinant should be the determinant of the spatial metric \(\det(g_{ij})\).

◆ cross_product() [4/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 
)
noexcept

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

Details

Returns \(\sqrt{g} A^j B_l g^{lk} \epsilon_{ijk}\) for input vector \(A^j\) and input one form \(B_l\). 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 \(g^{ij}\), and metric_determinant should be the determinant of the spatial metric \(\det(g_{ij})\). Or, returns \(\sqrt{g}^{-1} A_j B^l g_{lk} \epsilon^{ijk}\) for input one form \(A_j\) and input vector \(B^l\). 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 \(g_{ij}\), and metric_determinant should be the determinant of the spatial metric \(\det(g_{ij})\). Note that this function returns a vector if vector_b is a vector and a one form if vector_b is a one form.

◆ determinant()

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.

Returns: The determinant of tensor.

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

◆ determinant_and_inverse()

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>>>>
noexcept

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.

Parameters
tensorthe input rank-2 Tensor.

Returns: a std::pair that holds the determinant (in pair.first) and inverse (in pair.second) of the input tensor.

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 \(T_a^b\) returns \((Tinv)_b^a\).

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.

◆ divide_by()

template<typename TensorType >
TensorType divide_by ( TensorType  tensor,
const DataVector divisor 
)

Divides the components of a tensor by a scalar.

Returns: a tensor of the same type as the input tensor

◆ dot_product() [1/6]

template<typename DataType , typename Index >
void dot_product ( const gsl::not_null< Scalar< DataType > *>  dot_product,
const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &  vector_a,
const Tensor< DataType, Symmetry< 1 >, index_list< Index >> &  vector_b 
)
noexcept

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

Details

Returns \(A^a B^b \delta_{ab}\) for input vectors \(A^a\) and \(B^b\) or \(A_a B_b \delta^{ab}\) for input one forms \(A_a\) and \(B_b\).

◆ dot_product() [2/6]

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

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

Details

Returns \(A^a B^b \delta_{ab}\) for input vectors \(A^a\) and \(B^b\) or \(A_a B_b \delta^{ab}\) for input one forms \(A_a\) and \(B_b\).

◆ dot_product() [3/6]

template<typename DataType , typename Index >
void dot_product ( const gsl::not_null< Scalar< DataType > *>  dot_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 
)
noexcept

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

Details

Returns \(A^a B_b \delta_{a}^b\) for input vector \(A^a\) and input one form \(B_b\) or \(A_a B^b \delta^a_b\) for input one form \(A_a\) and input vector \(B^b\).

◆ dot_product() [4/6]

template<typename DataType , typename Index >
Scalar<DataType> dot_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 
)
noexcept

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

Details

Returns \(A^a B_b \delta_{a}^b\) for input vector \(A^a\) and input one form \(B_b\) or \(A_a B^b \delta^a_b\) for input one form \(A_a\) and input vector \(B^b\).

◆ dot_product() [5/6]

template<typename DataType , typename Index >
void dot_product ( const gsl::not_null< Scalar< DataType > *>  dot_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< change_index_up_lo< Index >, change_index_up_lo< Index >>> &  metric 
)
noexcept

Compute the dot_product of two vectors or one forms.

Details

Returns \(g_{ab} A^a B^b\), where \(g_{ab}\) is the metric, \(A^a\) is vector_a, and \(B^b\) is vector_b. Or, returns \(g^{ab} A_a B_b\) when given one forms \(A_a\) and \(B_b\) with an inverse metric \(g^{ab}\).

◆ dot_product() [6/6]

template<typename DataType , typename Index >
Scalar<DataType> dot_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< change_index_up_lo< Index >, change_index_up_lo< Index >>> &  metric 
)
noexcept

Compute the dot_product of two vectors or one forms.

Details

Returns \(g_{ab} A^a B^b\), where \(g_{ab}\) is the metric, \(A^a\) is vector_a, and \(B^b\) is vector_b. Or, returns \(g^{ab} A_a B_b\) when given one forms \(A_a\) and \(B_b\) with an inverse metric \(g^{ab}\).

◆ index_dim()

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

Get dimensionality of i'th tensor index.

using T = Tensor<double, Symmetry<1, 2, 3>,
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}});

◆ magnitude() [1/2]

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

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/2]

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 
)
noexcept

Compute the magnitude of a rank-1 tensor.

Details

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

◆ prefix()

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

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

"SpatialVelocity");
"Grid_SpatialVelocity");
Frame::Inertial>::name() ==
"SpatialVelocityOneForm");
Frame::Logical>::name() ==
"Logical_SpatialVelocityOneForm");

Variable Documentation

◆ is_frame_physical_v

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.

Example

static_assert(not Frame::is_frame_physical_v<Frame::Logical>,
"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");