|
SpECTRE
v2025.08.19
|
A dynamically sized vector of DataVectors.
More...
#include <DynamicBuffer.hpp>
Public Member Functions | |
| DynamicBuffer (size_t number_of_vectors, size_t number_of_grid_points) | |
| DynamicBuffer (DynamicBuffer &&other)=default | |
| DynamicBuffer & | operator= (DynamicBuffer &&other)=default |
| DynamicBuffer (const DynamicBuffer &other) | |
| DynamicBuffer & | operator= (const DynamicBuffer &other) |
| T & | operator[] (size_t index) |
| T & | at (size_t index) |
| const T & | operator[] (size_t index) const |
| const T & | at (size_t index) const |
| auto | begin () |
| auto | end () |
| auto | begin () const |
| auto | end () const |
| size_t | size () const |
| void | pup (PUP::er &p) |
Static Public Attributes | |
| static constexpr bool | is_data_vector_type = std::is_same_v<DataVector, T> |
Friends | |
| template<typename LocalT > | |
| bool | operator== (const DynamicBuffer< LocalT > &lhs, const DynamicBuffer< LocalT > &rhs) |
A dynamically sized vector of DataVectors.
For convenience it can also be instantiated for fundamental types.
This class is useful when one wants to create a std::vector<T> with a size that is unknown at compile time. It allocates all DataVectors in a single memory chunk rather than allocating each individually. If the size of the vector is known at compile time, a TempBuffer object should be used instead.
Currently this can only be used for DataVectors, but if needed, it should be fairly straightforward to generalize to ComplexDataVector.
| DynamicBuffer< T >::DynamicBuffer | ( | size_t | number_of_vectors, |
| size_t | number_of_grid_points | ||
| ) |
Constructs a DynamicBuffer. The number_of_vectors corresponds to the number of DataVectors which are saved inside, each of which has size number_of_grid_points. number_of_grid_points has to be 1 if T is a fundamental type.