SpECTRE  v2026.04.01
Loading...
Searching...
No Matches
ModalVector Class Reference

A class for storing spectral coefficients on a spectral grid. More...

#include <ModalVector.hpp>

Public Types

using BaseType = VectorImpl<double, ModalVector>
Public Types inherited from VectorImpl< double, ModalVector >
using value_type
using size_type
using difference_type
using BaseType
using ElementType
using TransposeType
using CompositeType
using iterator
using const_iterator

Public Member Functions

 ModalVector (const ModalVector &)=default
 ModalVector (ModalVector &&)=default
ModalVectoroperator= (const ModalVector &)=default
ModalVectoroperator= (ModalVector &&)=default
VectorImploperator= (const double &rhs)
 VectorImpl (size_t set_size)
 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.
 VectorImpl (size_t set_size, double value)
 Create with the given size and value.
 VectorImpl (const Container &container)
 Create from a copy of the given container.
 VectorImpl (double *start, size_t set_size)
 Create a non-owning VectorImpl that points to start
 VectorImpl (std::initializer_list< U > list)
 Create from an initializer list of T.
 VectorImpl ()=default
 Empty VectorImpl.
Public Member Functions inherited from VectorImpl< double, ModalVector >
 VectorImpl (size_t set_size)
 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.
 VectorImpl (size_t set_size, double value)
 Create with the given size and value.
 VectorImpl (const Container &container)
 Create from a copy of the given container.
 VectorImpl (double *start, size_t set_size)
 Create a non-owning VectorImpl that points to start
 VectorImpl (std::initializer_list< U > list)
 Create from an initializer list of T.
 VectorImpl ()=default
 Empty VectorImpl.
VectorImploperator= (const double &rhs)
decltype(auto) operator[] (const size_t index)
decltype(auto) operator[] (const size_t index) const
void destructive_resize (const size_t new_size)
 A common operation for checking the size and resizing a memory buffer if needed to ensure that it has the desired size. This operation is not permitted on a non-owning vector.
bool is_owning () const
 Returns true if the class owns the data.
void clear ()
 Put the class in the default-constructed state.
void pup (PUP::er &p)
 Serialization for Charm++.
const BaseType & operator* () const
 Upcast to BaseType
BaseType & operator* ()
 Upcast to BaseType
void set_data_ref (gsl::not_null< ModalVector * > rhs)
 Set the VectorImpl to be a reference to another VectorImpl object.
void set_data_ref (double *const start, const size_t set_size)
 Set the VectorImpl to be a reference to another VectorImpl object.

Additional Inherited Members

Static Public Attributes inherited from VectorImpl< double, ModalVector >
static constexpr bool transpose_flag
static constexpr size_t static_size
Protected Member Functions inherited from VectorImpl< double, ModalVector >
void reset_pointer_vector (const size_t set_size)
std::unique_ptr< value_type[]> heap_alloc_if_necessary (const size_t set_size)
Protected Attributes inherited from VectorImpl< double, ModalVector >
std::unique_ptr< value_type[]> owned_data_
std::array< double, default_vector_impl_static_sizestatic_owned_data_
bool owning_

Detailed Description

A class for storing spectral coefficients on a spectral grid.

Details

A ModalVector holds an array of spectral coefficients, and can be either owning (the array is deleted when the ModalVector goes out of scope) or non-owning, meaning it just has a pointer to an array.

Only basic mathematical operations are supported with ModalVectors. ModalVectors may be added or subtracted, and the following unary operations are supported:

  • abs

Also multiplication is supported with doubles and ModalVectors, and ModalVectors can be divided by doubles. Multiplication is supported with DiagonalModalOperators and ModalVectors.

Member Function Documentation

◆ VectorImpl() [1/3]

VectorImpl< double, ModalVector, default_vector_impl_static_size >::VectorImpl ( const Container & container)
inlineexplicit

Create from a copy of the given container.

Parameters
containerA container with a value_type that is the same as T. Currently restricted to std::vector<T> and std::array<T>.

◆ VectorImpl() [2/3]

VectorImpl< double, ModalVector, default_vector_impl_static_size >::VectorImpl ( size_t set_size)
inlineexplicit

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() [3/3]

VectorImpl< double, ModalVector, default_vector_impl_static_size >::VectorImpl ( size_t set_size,
double value )
inline

Create with the given size and value.

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

The documentation for this class was generated from the following file:
  • src/DataStructures/ModalVector.hpp