SpECTRE  v2024.04.12
Data Structures

Various useful data structures used in SpECTRE. More...

Namespaces

namespace  MakeWithValueImpls
 Implementations of make_with_value.
 

Classes

class  CachedTempBuffer< Tags >
 
class  ComplexDataVector
 Stores a collection of complex function values. More...
 
class  ComplexDiagonalModalOperator
 A class for an element-wise complex multiplier of modal coefficients. More...
 
class  ComplexModalVector
 A class for storing complex spectral coefficients on a spectral grid. More...
 
class  ObservationBox< tmpl::list< ComputeTags... >, DataBoxType >
 Used for adding compute items to a DataBox without copying or moving any data from the original DataBox More...
 
class  DataVector
 Stores a collection of function values. More...
 
class  DiagonalModalOperator
 A class for an element-wise multiplier of modal coefficients. More...
 
class  DynamicBuffer< T >
 A dynamically sized vector of DataVectors. More...
 
class  FixedHashMap< MaxSize, Key, ValueType, Hash, KeyEqual >
 A hash table with a compile-time specified maximum size and ability to efficiently handle perfect hashes. More...
 
struct  IdPair< IdType, DataType >
 A data structure that contains an ID and data associated with that ID. More...
 
class  Index< Dim >
 An integer multi-index. More...
 
class  IndexIterator< Dim >
 IndexIterator iterates over a unique set of Index. More...
 
class  LeviCivitaIterator< Dim >
 Iterate over all nonzero index permutations for a Levi-Civita symbol. More...
 
struct  LinkedMessageId< Id >
 An identifier for an element in a sequence. More...
 
class  LinkedMessageQueue< Id, tmpl::list< QueueTags... > >
 A collection of queues of asynchronously received data. More...
 
class  MathWrapper< T >
 Type-erased data for performing math on. More...
 
class  Matrix
 A dynamically sized matrix of doubles with column-major storage. More...
 
class  ModalVector
 A class for storing spectral coefficients on a spectral grid. More...
 
class  SliceIterator
 Iterate over a (dim-1)-dimensional slice. More...
 
struct  SpinWeighted< T, Spin, is_vector >
 Make a spin-weighted type T with spin-weight Spin. Mathematical operators are restricted to addition, subtraction, multiplication and division, with spin-weights checked for validity. More...
 
struct  is_any_spin_weighted< T >
 This is a std::true_type if the provided type is a SpinWeighted of any type and spin, otherwise is a std::false_type. More...
 
struct  is_spin_weighted_of< InternalType, T >
 This is a std::true_type if the provided type T is a SpinWeighted of InternalType and any spin, otherwise is a std::false_type. More...
 
struct  is_spin_weighted_of_same_type< T1, T2 >
 This is a std::true_type if the provided type T1 is a SpinWeighted and T2 is a SpinWeighted, and both have the same internal type, but any combination of spin weights. More...
 
class  StripeIterator
 Iterates over the 1-dimensional stripes with info on how to iterate over the current stripe. More...
 
struct  TempBuffer< TagList, is_fundamental >
 A TempBuffer holds a set of Tensor<DataType>s, where DataType is either a DataVector (or similar type) or a fundamental type, in a way that minimizes allocations. More...
 
struct  Tags::Magnitude< Tag >
 The magnitude of a (co)vector. More...
 
struct  Tags::EuclideanMagnitude< Tag >
 The Euclidean magnitude of a (co)vector. More...
 
struct  Tags::NonEuclideanMagnitude< Tag, MetricTag >
 The magnitude of a (co)vector with respect to a specific metric. More...
 
struct  Tags::Normalized< Tag >
 The normalized (co)vector represented by Tag. More...
 
struct  Tags::NormalizedCompute< Tag >
 Normalizes the (co)vector represented by Tag. More...
 
struct  Tags::PointwiseL2Norm< Tag >
 
struct  Tags::PointwiseL2NormCompute< Tag >
 
struct  Tags::L2Norm< Tag >
 
struct  Tags::L2NormCompute< Tag >
 
class  Variables< tmpl::list< Tags... > >
 A Variables holds a contiguous memory block with Tensors pointing into it. More...
 
class  VectorImpl< T, VectorType, StaticSize >
 Base class template for various DataVector and related types. More...
 
struct  get_vector_element_type< T, bool >
 Helper struct to determine the element type of a VectorImpl or container of VectorImpl. More...
 
class  DirectionMap< Dim, T >
 An optimized map with Direction keys. More...
 
struct  TensorComponent
 An untyped tensor component with a name for observation. More...
 
struct  ElementVolumeData
 Holds tensor components on a grid, to be written into an H5 file. More...
 
class  Mesh< Dim >
 Holds the number of grid points, basis, and quadrature in each direction of the computational grid. More...
 

Macros

#define MATH_WRAPPER_TYPES    double, std::complex<double>, DataVector, ComplexDataVector
 A comma-separated list of valid template arguments to MathWrapper. Useful for explicit instantiations. More...
 
#define BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT(VECTOR_TYPE, BLAZE_MATH_TRAIT)
 Instructs Blaze to provide the appropriate vector result type after math operations. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction and specifying the using Type = nested type alias in the traits. More...
 
#define BLAZE_TRAIT_SPECIALIZE_COMPATIBLE_BINARY_TRAIT( VECTOR_TYPE, COMPATIBLE, BLAZE_MATH_TRAIT, RESULT_TYPE)
 Instructs Blaze to provide the appropriate vector result type of an operator between VECTOR_TYPE and COMPATIBLE, where the operation is represented by BLAZE_MATH_TRAIT More...
 
#define VECTOR_BLAZE_TRAIT_SPECIALIZE_ARITHMETIC_TRAITS(VECTOR_TYPE)
 Instructs Blaze to provide the appropriate vector result type of arithmetic operations for VECTOR_TYPE. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction. More...
 
#define VECTOR_BLAZE_TRAIT_SPECIALIZE_ALL_MAP_TRAITS(VECTOR_TYPE)
 Instructs Blaze to provide the appropriate vector result type of Map operations (unary and binary) acting on VECTOR_TYPE. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction. More...
 
#define MAKE_STD_ARRAY_VECTOR_BINOPS(VECTOR_TYPE)
 Defines the set of binary operations often supported for std::array<VECTOR_TYPE, size>, for arbitrary size. More...
 
#define MAKE_WITH_VALUE_IMPL_DEFINITION_FOR(VECTOR_TYPE)
 Defines the MakeWithValueImpl apply specialization. More...
 

Typedefs

template<typename T >
using math_wrapper_type = typename decltype(make_math_wrapper(std::declval< tmpl::conditional_t< std::is_const_v< T >, const T &, gsl::not_null< T * > > >()))::value_type
 The value_type for a MathWrapper wrapping T.
 

Enumerations

enum  FloatingPointType { Float , Double }
 Which floating point type to use. More...
 

Functions

template<size_t N>
DataVector array_to_datavector (const std::array< double, N > &arr)
 Convert a std::array to a DataVector. Currently only instantiated for N=3.
 
template<typename Tag , typename DataBoxType , typename... ComputeTags>
const auto & get (const ObservationBox< tmpl::list< ComputeTags... >, DataBoxType > &box)
 Retrieve a Tag from the ObservationBox.
 
template<typename DataBoxType , typename ComputeTagsList , typename... Args, typename F >
auto apply (F &&f, const ObservationBox< ComputeTagsList, DataBoxType > &observation_box, Args &&... args)
 Apply the function object f using its nested argument_tags list of tags.
 
template<size_t N>
size_t collapsed_index (const Index< N > &index, const Index< N > &extents)
 Get the collapsed index into a 1D array of the data corresponding to this Index. Note that the first dimension of the Index varies fastest when computing the collapsed index.
 
template<size_t VolumeDim>
auto volume_and_slice_indices (const Index< VolumeDim > &extents) -> std::pair< std::unique_ptr< std::pair< size_t, size_t >[]>, std::array< std::pair< gsl::span< std::pair< size_t, size_t > >, gsl::span< std::pair< size_t, size_t > > >, VolumeDim > >
 Get the mapping between volume and boundary slice indices. More...
 
template<std::size_t VolumeDim, typename... VolumeTags, typename... SliceTags>
void add_slice_to_data (const gsl::not_null< Variables< tmpl::list< VolumeTags... > > * > volume_vars, const Variables< tmpl::list< SliceTags... > > &vars_on_slice, const Index< VolumeDim > &extents, const size_t sliced_dim, const size_t fixed_index)
 Adds data on a codimension 1 slice to a volume quantity. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to add to the lower boundary of sliced_dim, pass 0 for fixed_index; to add to the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<typename SpinWeightedType , Requires< is_any_spin_weighted_v< SpinWeightedType > and is_derived_of_vector_impl_v< typename SpinWeightedType::value_type > > = nullptr>
void make_const_view (const gsl::not_null< const SpinWeightedType * > view, const SpinWeightedType &spin_weighted, const size_t offset, const size_t extent)
 Make the input view a const view of the const data spin_weighted, at offset offset and length extent. More...
 
template<typename... Tags>
Variables< tmpl::list< Tags... > > variables_from_tagged_tuple (const tuples::TaggedTuple< Tags... > &tuple)
 Construct a variables from the Tensors in a TaggedTuple.
 
template<typename VectorType , Requires< is_derived_of_vector_impl_v< VectorType > > = nullptr>
void make_const_view (const gsl::not_null< const VectorType * > view, const VectorType &vector, const size_t offset, const size_t extent)
 Make the input view a const view of the const data vector, at offset offset and length extent. More...
 
template<size_t Dim>
bool is_isotropic (const Mesh< Dim > &mesh)
 Returns true if the mesh is isotropic, false otherwise. More...
 
template<typename R , typename T , typename ValueType >
std::remove_const_t< R > make_with_value (const T &input, const ValueType &value)
 Given an object of type T, create an object of type R whose elements are initialized to value. More...
 
template<typename T , typename U >
void set_number_of_grid_points (const gsl::not_null< T * > result, const U &pattern)
 Change the number of grid points in an object. More...
 

Variables

constexpr size_t default_vector_impl_static_size = 0
 Default static size for vector impl.
 
template<typename DataBoxType , typename ComputeTagsList , typename... Args, typename F >
auto mutate_apply (F &&f, const gsl::not_null< ObservationBox< ComputeTagsList, DataBoxType > * > observation_box, Args &&... args)
 Apply the function object f using its nested return_tags and argument_tags list of tags. Modifications are made to the underlying DataBox.
 
template<typename ReturnTags , typename ArgumentTags , typename DataBoxType , typename ComputeTagsList , typename... Args, typename F >
auto mutate_apply (F &&f, const gsl::not_null< ObservationBox< ComputeTagsList, DataBoxType > * > observation_box, Args &&... args)
 Apply the function object f using its nested return_tags and argument_tags list of tags. Modifications are made to the underlying DataBox.
 
template<typename... Structure>
void extract_point (const gsl::not_null< Tensor< double, Structure... > * > destination, const Tensor< DataVector, Structure... > &source, const size_t index)
 Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>. More...
 
template<typename... Structure>
Tensor< double, Structure... > extract_point (const Tensor< DataVector, Structure... > &tensor, const size_t index)
 Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>. More...
 
template<typename... Structure>
void extract_point (const gsl::not_null< Tensor< DataVector, Structure... > * > destination, const Tensor< DataVector, Structure... > &source, const size_t index)
 Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>. More...
 
template<typename... Tags>
void extract_point (const gsl::not_null< Variables< tmpl::list< Tags... > > * > result, const Variables< tmpl::list< Tags... > > &variables, const size_t index)
 Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>. More...
 
template<typename... Tags>
Variables< tmpl::list< Tags... > > extract_point (const Variables< tmpl::list< Tags... > > &variables, const size_t index)
 Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>. More...
 
template<typename... Structure>
void overwrite_point (const gsl::not_null< Tensor< DataVector, Structure... > * > destination, const Tensor< double, Structure... > &source, const size_t index)
 Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>. More...
 
template<typename... Structure>
void overwrite_point (const gsl::not_null< Tensor< DataVector, Structure... > * > destination, const Tensor< DataVector, Structure... > &source, const size_t index)
 Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>. More...
 
template<typename... Tags>
void overwrite_point (const gsl::not_null< Variables< tmpl::list< Tags... > > * > destination, const Variables< tmpl::list< Tags... > > &source, const size_t index)
 Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>. More...
 
MathWrapper< double > make_math_wrapper (const gsl::not_null< double * > data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< const double > make_math_wrapper (const double &data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< std::complex< double > > make_math_wrapper (const gsl::not_null< std::complex< double > * > data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< const std::complex< double > > make_math_wrapper (const std::complex< double > &data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< DataVectormake_math_wrapper (const gsl::not_null< DataVector * > data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< const DataVectormake_math_wrapper (const DataVector &data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< ComplexDataVectormake_math_wrapper (const gsl::not_null< ComplexDataVector * > data)
 A fundamental overload of the MathWrapper construction functions. More...
 
MathWrapper< const ComplexDataVectormake_math_wrapper (const ComplexDataVector &data)
 A fundamental overload of the MathWrapper construction functions. More...
 
template<typename... TagsToSlice, size_t VolumeDim>
void data_on_slice (const gsl::not_null< Variables< tmpl::list< TagsToSlice... > > * > interface_vars, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index, const typename TagsToSlice::type &... tensors)
 Slices volume Tensors into a Variables More...
 
template<typename... TagsToSlice, size_t VolumeDim>
Variables< tmpl::list< TagsToSlice... > > data_on_slice (const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index, const typename TagsToSlice::type &... tensors)
 Slices volume Tensors into a Variables More...
 
template<std::size_t VolumeDim, typename TagsList >
void data_on_slice (const gsl::not_null< Variables< TagsList > * > interface_vars, const Variables< TagsList > &vars, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within vars to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<std::size_t VolumeDim, typename TagsList >
Variables< TagsList > data_on_slice (const Variables< TagsList > &vars, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within vars to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<typename Tag , typename... TagsOrTagsList, typename... Ts, template< class... > class U, Requires<(not tt::is_a_v< gsl::not_null, U< TagsOrTagsList... > >) and not(... and tt::is_a_v< gsl::not_null, std::decay_t< Ts > >)> = nullptr>
const Tag::type & get (const U< TagsOrTagsList... > &first_vars, const Ts &... vars)
 Retrieves a desired tag from data structures containing tags. More...
 
template<typename Tag , typename... TagsOrTagsList, typename... Ts, template< class... > class U>
gsl::not_null< typename Tag::type * > get (const gsl::not_null< U< TagsOrTagsList... > * > first_vars, const gsl::not_null< Ts >... vars)
 Retrieves a desired tag from data structures containing tags. More...
 
template<std::size_t VolumeDim, typename VectorType , typename... Structure>
void data_on_slice (const gsl::not_null< Tensor< VectorType, Structure... > * > interface_tensor, const Tensor< VectorType, Structure... > &volume_tensor, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<std::size_t VolumeDim, typename VectorType , typename... Structure>
Tensor< VectorType, Structure... > data_on_slice (const Tensor< VectorType, Structure... > &volume_tensor, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<std::size_t VolumeDim, typename VectorType , typename... Structure>
void data_on_slice (const gsl::not_null< std::optional< Tensor< VectorType, Structure... > > * > interface_tensor, const std::optional< Tensor< VectorType, Structure... > > &volume_tensor, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<std::size_t VolumeDim, typename VectorType , typename... Structure>
std::optional< Tensor< VectorType, Structure... > > data_on_slice (const std::optional< Tensor< VectorType, Structure... > > &volume_tensor, const Index< VolumeDim > &element_extents, const size_t sliced_dim, const size_t fixed_index)
 Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1. More...
 
template<typename Tag , typename TagList >
constexpr Tag::type & get (Variables< TagList > &v)
 Return Tag::type pointing into the contiguous array. More...
 
template<typename Tag , typename TagList >
constexpr const Tag::type & get (const Variables< TagList > &v)
 Return Tag::type pointing into the contiguous array. More...
 

Detailed Description

Various useful data structures used in SpECTRE.

Macro Definition Documentation

◆ BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT

#define BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT (   VECTOR_TYPE,
  BLAZE_MATH_TRAIT 
)
Value:
template <> \
struct BLAZE_MATH_TRAIT<VECTOR_TYPE, VECTOR_TYPE> { \
using Type = VECTOR_TYPE; \
}; \
template <> \
struct BLAZE_MATH_TRAIT<VECTOR_TYPE, VECTOR_TYPE::value_type> { \
using Type = VECTOR_TYPE; \
}; \
template <> \
struct BLAZE_MATH_TRAIT<VECTOR_TYPE::value_type, VECTOR_TYPE> { \
using Type = VECTOR_TYPE; \
}

Instructs Blaze to provide the appropriate vector result type after math operations. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction and specifying the using Type = nested type alias in the traits.

Parameters
VECTOR_TYPEThe vector type, which matches the type of the operation result (e.g. DataVector)
BLAZE_MATH_TRAITThe blaze trait/expression for which you want to specify the return type (e.g. AddTrait).

◆ BLAZE_TRAIT_SPECIALIZE_COMPATIBLE_BINARY_TRAIT

#define BLAZE_TRAIT_SPECIALIZE_COMPATIBLE_BINARY_TRAIT (   VECTOR_TYPE,
  COMPATIBLE,
  BLAZE_MATH_TRAIT,
  RESULT_TYPE 
)
Value:
template <> \
struct BLAZE_MATH_TRAIT<VECTOR_TYPE, COMPATIBLE> { \
using Type = RESULT_TYPE; \
}; \
template <> \
struct BLAZE_MATH_TRAIT<COMPATIBLE, VECTOR_TYPE> { \
using Type = RESULT_TYPE; \
}

Instructs Blaze to provide the appropriate vector result type of an operator between VECTOR_TYPE and COMPATIBLE, where the operation is represented by BLAZE_MATH_TRAIT

Parameters
VECTOR_TYPEThe vector type, which matches the type of the operation result (e.g. ComplexDataVector)
COMPATIBLEthe type for which you want math operations to work with VECTOR_TYPE smoothly (e.g. DataVector)
BLAZE_MATH_TRAITThe blaze trait for which you want declare the Type field (e.g. AddTrait)
RESULT_TYPEThe type which should be used as the 'return' type for the binary operation

◆ MAKE_STD_ARRAY_VECTOR_BINOPS

#define MAKE_STD_ARRAY_VECTOR_BINOPS (   VECTOR_TYPE)
Value:
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE::value_type, \
VECTOR_TYPE, operator+, std::plus<>()) \
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE, \
VECTOR_TYPE::value_type, operator+, std::plus<>()) \
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE, VECTOR_TYPE, operator+, \
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE::value_type, \
VECTOR_TYPE, operator-, std::minus<>()) \
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE, \
VECTOR_TYPE::value_type, operator-, std::minus<>()) \
DEFINE_STD_ARRAY_BINOP(VECTOR_TYPE, VECTOR_TYPE, VECTOR_TYPE, operator-, \
DEFINE_STD_ARRAY_INPLACE_BINOP(VECTOR_TYPE, VECTOR_TYPE, operator-=, \
DEFINE_STD_ARRAY_INPLACE_BINOP( \
VECTOR_TYPE, VECTOR_TYPE::value_type, operator-=, std::minus<>()) \
DEFINE_STD_ARRAY_INPLACE_BINOP(VECTOR_TYPE, VECTOR_TYPE, operator+=, \
DEFINE_STD_ARRAY_INPLACE_BINOP( \
VECTOR_TYPE, VECTOR_TYPE::value_type, operator+=, std::plus<>())
#define DEFINE_STD_ARRAY_INPLACE_BINOP(LTYPE, RTYPE, OP_FUNCTION_NAME, BINARY_OP)
Declares an in-place binary function on an array, intended for operations such as +=
Definition: StdArrayHelpers.hpp:291
#define DEFINE_STD_ARRAY_BINOP(RESULT_TYPE, LTYPE, RTYPE, OP_FUNCTION_NAME, BINARY_OP)
Declares a binary function on an array, intended for binary operators such as +
Definition: StdArrayHelpers.hpp:263

Defines the set of binary operations often supported for std::array<VECTOR_TYPE, size>, for arbitrary size.

Parameters
VECTOR_TYPEThe vector type (e.g. DataVector)

◆ MAKE_WITH_VALUE_IMPL_DEFINITION_FOR

#define MAKE_WITH_VALUE_IMPL_DEFINITION_FOR (   VECTOR_TYPE)
Value:
namespace MakeWithValueImpls { \
template <> \
struct NumberOfPoints<VECTOR_TYPE> { \
static SPECTRE_ALWAYS_INLINE size_t apply(const VECTOR_TYPE& input) { \
return input.size(); \
} \
}; \
template <> \
struct MakeWithSize<VECTOR_TYPE> { \
apply(const size_t size, const VECTOR_TYPE::value_type value) { \
return VECTOR_TYPE(size, value); \
} \
}; \
} /* namespace MakeWithValueImpls */ \
template <> \
static constexpr bool is_trivial = false; \
const gsl::not_null<VECTOR_TYPE*> result, const size_t size) { \
result->destructive_resize(size); \
} \
};
Require a pointer to not be a nullptr
Definition: Gsl.hpp:183
auto apply(F &&f, const ObservationBox< ComputeTagsList, DataBoxType > &observation_box, Args &&... args)
Apply the function object f using its nested argument_tags list of tags.
Definition: ObservationBox.hpp:238
constexpr T & value(T &t)
Returns t.value() if t is a std::optional otherwise returns t.
Definition: OptionalHelpers.hpp:32
#define SPECTRE_ALWAYS_INLINE
Always inline a function. Only use this if you benchmarked the code.
Definition: ForceInline.hpp:16
Implementations of make_with_value.
Definition: DynamicVector.hpp:52
Default implementation is not defined.
Definition: SetNumberOfGridPoints.hpp:36

Defines the MakeWithValueImpl apply specialization.

Details

The MakeWithValueImpl<VECTOR_TYPE, VECTOR_TYPE> member apply(VECTOR_TYPE, VECTOR_TYPE::value_type) specialization defined by this macro produces an object with the same size as the input argument, initialized with the value argument in every entry.

Parameters
VECTOR_TYPEThe vector type (e.g. DataVector)

◆ MATH_WRAPPER_TYPES

#define MATH_WRAPPER_TYPES    double, std::complex<double>, DataVector, ComplexDataVector

A comma-separated list of valid template arguments to MathWrapper. Useful for explicit instantiations.

#define MATH_WRAPPER_TYPES
A comma-separated list of valid template arguments to MathWrapper. Useful for explicit instantiations...
Definition: MathWrapper.hpp:21
#define GENERATE_INSTANTIATIONS(INSTANTIATION_MACRO,...)
Macro useful for generating many explicit instantiations of function or class templates.
Definition: GenerateInstantiations.hpp:160

◆ VECTOR_BLAZE_TRAIT_SPECIALIZE_ALL_MAP_TRAITS

#define VECTOR_BLAZE_TRAIT_SPECIALIZE_ALL_MAP_TRAITS (   VECTOR_TYPE)
Value:
template <typename Operator> \
struct MapTrait<VECTOR_TYPE, Operator> { \
using Type = VECTOR_TYPE; \
}; \
template <typename Operator> \
struct MapTrait<VECTOR_TYPE, VECTOR_TYPE, Operator> { \
using Type = VECTOR_TYPE; \
}

Instructs Blaze to provide the appropriate vector result type of Map operations (unary and binary) acting on VECTOR_TYPE. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction.

Details

Type declarations here are suitable for contiguous data (e.g. DataVector), but this macro might need to be tweaked for other types of data, for instance Fourier coefficients.

Parameters
VECTOR_TYPEThe vector type, which for the Map operations is the type of the operation result (e.g. DataVector)

◆ VECTOR_BLAZE_TRAIT_SPECIALIZE_ARITHMETIC_TRAITS

#define VECTOR_BLAZE_TRAIT_SPECIALIZE_ARITHMETIC_TRAITS (   VECTOR_TYPE)
Value:
template <> \
struct TransposeFlag<VECTOR_TYPE> \
: BoolConstant<VECTOR_TYPE::transpose_flag> {}; \
BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT(VECTOR_TYPE, AddTrait); \
BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT(VECTOR_TYPE, SubTrait); \
BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT(VECTOR_TYPE, MultTrait); \
BLAZE_TRAIT_SPECIALIZE_BINARY_TRAIT(VECTOR_TYPE, DivTrait)

Instructs Blaze to provide the appropriate vector result type of arithmetic operations for VECTOR_TYPE. This is accomplished by specializing Blaze's type traits that are used for handling return type deduction.

Details

Type definitions here are suitable for contiguous data (e.g. DataVector), but this macro might need to be tweaked for other types of data, for instance Fourier coefficients.

Parameters
VECTOR_TYPEThe vector type, which for the arithmetic operations is the type of the operation result (e.g. DataVector)

Enumeration Type Documentation

◆ FloatingPointType

Which floating point type to use.

An example use-case is for specifying in an input file to what precision data is written to disk, since most simulations will not have full double precision accuracy on volume data and we don't need all digits to visualize the data.

Function Documentation

◆ add_slice_to_data()

template<std::size_t VolumeDim, typename... VolumeTags, typename... SliceTags>
void add_slice_to_data ( const gsl::not_null< Variables< tmpl::list< VolumeTags... > > * >  volume_vars,
const Variables< tmpl::list< SliceTags... > > &  vars_on_slice,
const Index< VolumeDim > &  extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Adds data on a codimension 1 slice to a volume quantity. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to add to the lower boundary of sliced_dim, pass 0 for fixed_index; to add to the upper boundary, pass extents[sliced_dim] - 1.

See also
data_on_slice

◆ data_on_slice() [1/8]

template<std::size_t VolumeDim, typename VectorType , typename... Structure>
void data_on_slice ( const gsl::not_null< std::optional< Tensor< VectorType, Structure... > > * >  interface_tensor,
const std::optional< Tensor< VectorType, Structure... > > &  volume_tensor,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Tensor class sliced to a hypersurface.

◆ data_on_slice() [2/8]

template<std::size_t VolumeDim, typename VectorType , typename... Structure>
void data_on_slice ( const gsl::not_null< Tensor< VectorType, Structure... > * >  interface_tensor,
const Tensor< VectorType, Structure... > &  volume_tensor,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Tensor class sliced to a hypersurface.

◆ data_on_slice() [3/8]

template<std::size_t VolumeDim, typename TagsList >
void data_on_slice ( const gsl::not_null< Variables< TagsList > * >  interface_vars,
const Variables< TagsList > &  vars,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within vars to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Variables class sliced to a hypersurface.

◆ data_on_slice() [4/8]

template<typename... TagsToSlice, size_t VolumeDim>
void data_on_slice ( const gsl::not_null< Variables< tmpl::list< TagsToSlice... > > * >  interface_vars,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index,
const typename TagsToSlice::type &...  tensors 
)

Slices volume Tensors into a Variables

The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

◆ data_on_slice() [5/8]

template<typename... TagsToSlice, size_t VolumeDim>
Variables< tmpl::list< TagsToSlice... > > data_on_slice ( const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index,
const typename TagsToSlice::type &...  tensors 
)

Slices volume Tensors into a Variables

The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

◆ data_on_slice() [6/8]

template<std::size_t VolumeDim, typename VectorType , typename... Structure>
std::optional< Tensor< VectorType, Structure... > > data_on_slice ( const std::optional< Tensor< VectorType, Structure... > > &  volume_tensor,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Tensor class sliced to a hypersurface.

◆ data_on_slice() [7/8]

template<std::size_t VolumeDim, typename VectorType , typename... Structure>
Tensor< VectorType, Structure... > data_on_slice ( const Tensor< VectorType, Structure... > &  volume_tensor,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within volume_tensor to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Tensor class sliced to a hypersurface.

◆ data_on_slice() [8/8]

template<std::size_t VolumeDim, typename TagsList >
Variables< TagsList > data_on_slice ( const Variables< TagsList > &  vars,
const Index< VolumeDim > &  element_extents,
const size_t  sliced_dim,
const size_t  fixed_index 
)

Slices the data within vars to a codimension 1 slice. The slice has a constant logical coordinate in direction sliced_dim, slicing the volume at fixed_index in that dimension. For example, to get the lower boundary of sliced_dim, pass 0 for fixed_index; to get the upper boundary, pass extents[sliced_dim] - 1.

See also
add_slice_to_data

Returns Variables class sliced to a hypersurface.

◆ extract_point() [1/5]

template<typename... Structure>
void extract_point ( const gsl::not_null< Tensor< DataVector, Structure... > * >  destination,
const Tensor< DataVector, Structure... > &  source,
const size_t  index 
)

Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>.

Note
There is no by-value overload extracting to a Tensor<DataVector>. This is both for the practical reason that it would be ambiguous with the Tensor<double> overload and because allocating multiple DataVectors for the return type would usually be very inefficient.
See also
overwrite_point

◆ extract_point() [2/5]

template<typename... Structure>
void extract_point ( const gsl::not_null< Tensor< double, Structure... > * >  destination,
const Tensor< DataVector, Structure... > &  source,
const size_t  index 
)

Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>.

Note
There is no by-value overload extracting to a Tensor<DataVector>. This is both for the practical reason that it would be ambiguous with the Tensor<double> overload and because allocating multiple DataVectors for the return type would usually be very inefficient.
See also
overwrite_point

◆ extract_point() [3/5]

template<typename... Tags>
void extract_point ( const gsl::not_null< Variables< tmpl::list< Tags... > > * >  result,
const Variables< tmpl::list< Tags... > > &  variables,
const size_t  index 
)

Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>.

Note
There is no by-value overload extracting to a Tensor<DataVector>. This is both for the practical reason that it would be ambiguous with the Tensor<double> overload and because allocating multiple DataVectors for the return type would usually be very inefficient.
See also
overwrite_point

◆ extract_point() [4/5]

template<typename... Structure>
Tensor< double, Structure... > extract_point ( const Tensor< DataVector, Structure... > &  tensor,
const size_t  index 
)

Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>.

Note
There is no by-value overload extracting to a Tensor<DataVector>. This is both for the practical reason that it would be ambiguous with the Tensor<double> overload and because allocating multiple DataVectors for the return type would usually be very inefficient.
See also
overwrite_point

◆ extract_point() [5/5]

template<typename... Tags>
Variables< tmpl::list< Tags... > > extract_point ( const Variables< tmpl::list< Tags... > > &  variables,
const size_t  index 
)

Copy a given index of each component of a Tensor<DataVector> or Variables<DataVector> into a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector>.

Note
There is no by-value overload extracting to a Tensor<DataVector>. This is both for the practical reason that it would be ambiguous with the Tensor<double> overload and because allocating multiple DataVectors for the return type would usually be very inefficient.
See also
overwrite_point

◆ get() [1/4]

template<typename Tag , typename... TagsOrTagsList, typename... Ts, template< class... > class U>
gsl::not_null< typename Tag::type * > get ( const gsl::not_null< U< TagsOrTagsList... > * >  first_vars,
const gsl::not_null< Ts >...  vars 
)

Retrieves a desired tag from data structures containing tags.

Details

Given multiple containers retrieve a desired tag from the first container in which it is found. The containers are searched in the order in which they are supplied (i.e. first_vars is checked before vars). An error will be emitted if the tag cannot be found in any container.

◆ get() [2/4]

template<typename Tag , typename... TagsOrTagsList, typename... Ts, template< class... > class U, Requires<(not tt::is_a_v< gsl::not_null, U< TagsOrTagsList... > >) and not(... and tt::is_a_v< gsl::not_null, std::decay_t< Ts > >)> = nullptr>
const Tag::type & get ( const U< TagsOrTagsList... > &  first_vars,
const Ts &...  vars 
)

Retrieves a desired tag from data structures containing tags.

Details

Given multiple containers retrieve a desired tag from the first container in which it is found. The containers are searched in the order in which they are supplied (i.e. first_vars is checked before vars). An error will be emitted if the tag cannot be found in any container.

◆ get() [3/4]

template<typename Tag , typename TagList >
constexpr const Tag::type & get ( const Variables< TagList > &  v)
constexpr

Return Tag::type pointing into the contiguous array.

Template Parameters
Tagthe variable to return

◆ get() [4/4]

template<typename Tag , typename TagList >
constexpr Tag::type & get ( Variables< TagList > &  v)
constexpr

Return Tag::type pointing into the contiguous array.

Template Parameters
Tagthe variable to return

◆ is_isotropic()

template<size_t Dim>
bool is_isotropic ( const Mesh< Dim > &  mesh)

Returns true if the mesh is isotropic, false otherwise.

If Dim is zero, then true is always returned.

◆ make_const_view() [1/2]

template<typename SpinWeightedType , Requires< is_any_spin_weighted_v< SpinWeightedType > and is_derived_of_vector_impl_v< typename SpinWeightedType::value_type > > = nullptr>
void make_const_view ( const gsl::not_null< const SpinWeightedType * >  view,
const SpinWeightedType &  spin_weighted,
const size_t  offset,
const size_t  extent 
)

Make the input view a const view of the const data spin_weighted, at offset offset and length extent.

Warning
This DOES modify the (const) input view. The reason view is taken by const pointer is to try to insist that the object to be a const view is actually const. Of course, there are ways of subverting this intended functionality and editing the data pointed into by view after this function is called; doing so is highly discouraged and results in undefined behavior.

◆ make_const_view() [2/2]

template<typename VectorType , Requires< is_derived_of_vector_impl_v< VectorType > > = nullptr>
void make_const_view ( const gsl::not_null< const VectorType * >  view,
const VectorType &  vector,
const size_t  offset,
const size_t  extent 
)

Make the input view a const view of the const data vector, at offset offset and length extent.

Warning
This DOES modify the (const) input view. The reason view is taken by const pointer is to try to insist that the object to be a const view is actually const. Of course, there are ways of subverting this intended functionality and editing the data pointed into by view after this function is called; doing so is highly discouraged and results in undefined behavior.

◆ make_math_wrapper() [1/8]

MathWrapper< const ComplexDataVector > make_math_wrapper ( const ComplexDataVector data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [2/8]

MathWrapper< const DataVector > make_math_wrapper ( const DataVector data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [3/8]

MathWrapper< const double > make_math_wrapper ( const double &  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [4/8]

MathWrapper< ComplexDataVector > make_math_wrapper ( const gsl::not_null< ComplexDataVector * >  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [5/8]

MathWrapper< DataVector > make_math_wrapper ( const gsl::not_null< DataVector * >  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [6/8]

MathWrapper< double > make_math_wrapper ( const gsl::not_null< double * >  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [7/8]

MathWrapper< std::complex< double > > make_math_wrapper ( const gsl::not_null< std::complex< double > * >  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_math_wrapper() [8/8]

MathWrapper< const std::complex< double > > make_math_wrapper ( const std::complex< double > &  data)
inline

A fundamental overload of the MathWrapper construction functions.

Additional overloads can be implemented in terms of the fundamental overloads.

◆ make_with_value()

template<typename R , typename T , typename ValueType >
std::remove_const_t< R > make_with_value ( const T &  input,
const ValueType &  value 
)

Given an object of type T, create an object of type R whose elements are initialized to value.

Details

This function is useful in function templates in order to initialize the return type of a function template with value for functions that can be called either at a single grid-point or to fill a data structure at the same set of grid-points as the input

Template Parameters
ValueTypeThe type of value. For most containers, this will be double.
See also
MakeWithValueImpls, set_number_of_grid_points

◆ overwrite_point() [1/3]

template<typename... Structure>
void overwrite_point ( const gsl::not_null< Tensor< DataVector, Structure... > * >  destination,
const Tensor< DataVector, Structure... > &  source,
const size_t  index 
)

Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>.

See also
extract_point

◆ overwrite_point() [2/3]

template<typename... Structure>
void overwrite_point ( const gsl::not_null< Tensor< DataVector, Structure... > * >  destination,
const Tensor< double, Structure... > &  source,
const size_t  index 
)

Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>.

See also
extract_point

◆ overwrite_point() [3/3]

template<typename... Tags>
void overwrite_point ( const gsl::not_null< Variables< tmpl::list< Tags... > > * >  destination,
const Variables< tmpl::list< Tags... > > &  source,
const size_t  index 
)

Copy a Tensor<double>, single point Tensor<DataVector>, or single-point Variables<DataVector> into the given index of each component of a Tensor<DataVector> or Variables<DataVector>.

See also
extract_point

◆ set_number_of_grid_points()

template<typename T , typename U >
void set_number_of_grid_points ( const gsl::not_null< T * >  result,
const U &  pattern 
)

Change the number of grid points in an object.

Change the number of points stored in result to a given value or to match another object. If pattern is a size_t it will be used as the number of points, otherwise it will be interpreted as data on a collection of grid points.

See also
SetNumberOfGridPointsImpls, make_with_value

◆ volume_and_slice_indices()

template<size_t VolumeDim>
auto volume_and_slice_indices ( const Index< VolumeDim > &  extents) -> std::pair< std::unique_ptr< std::pair< size_t, size_t >[]>, std::array< std::pair< gsl::span< std::pair< size_t, size_t > >, gsl::span< std::pair< size_t, size_t > > >, VolumeDim > >

Get the mapping between volume and boundary slice indices.

SliceIterator is used to map between the index of a point on a slice in the volume data and the index in the corresponding sliced data. Repeatedly applying the SliceIterator on various components of a tensor becomes very expensive and so precomputing the index map is sometimes advantageous. This function computes the index map onto all boundary slices of volume mesh with extents extents.

The unique_ptr is where the volume and slice indices are stored in memory, the array holds views into the memory buffer. The index of the array is the fixed dimension, the outer pair holds the indices for the lower and upper side, respectively, while the pairs in the spans hold the volume and slice indices, respectively.