Public Types | Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | List of all members
VectorImpl< T, VectorType > Class Template Reference

Base class template for various DataVector and related types. More...

#include <VectorImpl.hpp>

Public Types

using value_type = T
 
using size_type = size_t
 
using difference_type = std::ptrdiff_t
 
using BaseType = PointerVector< T, blaze::unaligned, blaze::unpadded, blaze::defaultTransposeFlag, VectorType >
 
using ElementType = T
 
using TransposeType = VectorImpl< T, VectorType >
 
using CompositeType = const VectorImpl< T, VectorType > &
 
using iterator = typename BaseType::Iterator
 
using const_iterator = typename BaseType::ConstIterator
 

Public Member Functions

 VectorImpl (size_t set_size) noexcept
 Create with the given size. In debug mode, the vector is initialized to 'NaN' by default. If not initialized to 'NaN', the memory is allocated but not initialized. More...
 
 VectorImpl (size_t set_size, T value) noexcept
 Create with the given size and value. More...
 
 VectorImpl (T *start, size_t set_size) noexcept
 Create a non-owning VectorImpl that points to start
 
template<class U , Requires< cpp17::is_same_v< U, T >> = nullptr>
 VectorImpl (std::initializer_list< U > list) noexcept
 Create from an initializer list of T.
 
 VectorImpl ()=default
 Empty VectorImpl.
 
VectorImploperator= (const T &rhs) noexcept
 
bool is_owning () const noexcept
 Returns true if the class owns the data.
 
void pup (PUP::er &p) noexcept
 Serialization for Charm++.
 
template<typename T, typename VectorType >
 VectorImpl (const VectorImpl< T, VectorType > &rhs) noexcept
 
template<typename T, typename VectorType >
 VectorImpl (VectorImpl< T, VectorType > &&rhs) noexcept
 
const BaseTypeoperator~ () const noexcept
 Upcast to BaseType More...
 
BaseTypeoperator~ () noexcept
 Upcast to BaseType More...
 
void set_data_ref (gsl::not_null< VectorType *> rhs) noexcept
 Set the VectorImpl to be a reference to another VectorImpl object.
 
void set_data_ref (T *const start, const size_t set_size) noexcept
 Set the VectorImpl to be a reference to another VectorImpl object.
 

Static Public Attributes

static constexpr bool transpose_flag = blaze::defaultTransposeFlag
 

Protected Member Functions

void reset_pointer_vector (const size_t set_size) noexcept
 

Protected Attributes

std::unique_ptr< value_type[], decltype(&free)> owned_data_ {nullptr, &free}
 
bool owning_ {true}
 

Detailed Description

template<typename T, typename VectorType>
class VectorImpl< T, VectorType >

Base class template for various DataVector and related types.

Details

The VectorImpl class is the generic parent class for vectors representing collections of related function values, such as DataVectors for contiguous data over a computational domain.

The VectorImpl does not itself define any particular mathematical operations on the contained values. The VectorImpl template class and the macros defined in VectorImpl.hpp assist in the construction of various derived classes supporting a chosen set of mathematical operations.

In addition, the equivalence operator == is inherited from the underlying PointerVector type, and returns true if and only if the size and contents of the two compared vectors are equivalent.

Template parameters:

Note
  • If created with size 0, then data() will return nullptr
  • If either SPECTRE_DEBUG or SPECTRE_NAN_INIT are defined, then the VectorImpl is default initialized to signaling_NaN(). Otherwise, the vector is filled with uninitialized memory for performance.

Constructor & Destructor Documentation

◆ VectorImpl() [1/2]

template<typename T, typename VectorType>
VectorImpl< T, VectorType >::VectorImpl ( size_t  set_size)
inlineexplicitnoexcept

Create with the given size. In debug mode, the vector is initialized to 'NaN' by default. If not initialized to 'NaN', the memory is allocated but not initialized.

  • set_size number of values

◆ VectorImpl() [2/2]

template<typename T, typename VectorType>
VectorImpl< T, VectorType >::VectorImpl ( size_t  set_size,
value 
)
inlinenoexcept

Create with the given size and value.

  • set_size number of values
  • value the value to initialize each element

Member Function Documentation

◆ operator~() [1/2]

template<typename T, typename VectorType>
const BaseType& VectorImpl< T, VectorType >::operator~ ( ) const
inlinenoexcept

Upcast to BaseType

Attention
upcast should only be used when implementing a derived vector type, not in calling code

◆ operator~() [2/2]

template<typename T, typename VectorType>
BaseType& VectorImpl< T, VectorType >::operator~ ( )
inlinenoexcept

Upcast to BaseType

Attention
upcast should only be used when implementing a derived vector type, not in calling code

The documentation for this class was generated from the following file: