Structur of the array class. More...
#include <SoA.h>
Public Member Functions | |
SoA ()=default | |
Default constructor. | |
SoA (const SoA &soa)=default | |
Copy constructor. | |
void | resizeArrays (size_t length) |
Resizes all Vectors to the given length. | |
template<std::size_t attribute> | |
void | push (const double value) |
Pushes a given value to the desired attribute array. | |
template<int attribute, class ValueType > | |
void | write (size_t particleId, const ValueType &value) |
Writes / updates the value of an attribute for a specific particle. | |
void | append (const SoA< SoAArraysType > &other) |
Appends the other SoA buffer to this. | |
void | append (const SoAView< SoAArraysType > &other) |
Appends the other SoA buffer to this. | |
template<int... attributes> | |
void | append (const SoA< SoAArraysType > &other) |
Appends the specified attributes from the other SoA buffer to this. | |
template<int... attributes, class ValueArrayType > | |
void | writeMultiple (size_t particleId, const ValueArrayType &values) |
Writes or updates values of attributes for a specific particle. | |
template<int... attributes, size_t N = sizeof...(attributes)> | |
void | writeMultiple (size_t particleId, const std::array< double, N > &values) |
Specialized version to pass arrays without specifying it directly. | |
template<int... attributes> | |
std::array< double, sizeof...(attributes)> | readMultiple (size_t particleId) const |
Reads from all given attribute arrays at position particleId . | |
template<std::size_t attribute> | |
auto | read (size_t particleId) const |
Reads the value of a given attribute of a given particle. | |
template<std::size_t attribute> | |
auto | begin () |
Returns a pointer to the given attribute vector. | |
size_t | size () const |
Returns the number of particles. | |
void | clear () |
delete all particles in the soa | |
void | swap (std::size_t a, std::size_t b) |
swap the position of two particles in the soa | |
void | pop_back () |
Delete the last particle in the SoA. | |
SoAView< SoAArraysType > | constructView () |
Constructs a SoAView for the whole SoA and returns it. | |
SoAView< SoAArraysType > | constructView (size_t startIndex, size_t endIndex) |
Constructs a view that starts at startIndex (inclusive) and ends at endIndex (exclusive). | |
Structur of the array class.
SoAArraysType | The SoAArrayType to be used for storage. |
|
default |
Copy constructor.
soa | SoA to copy. |
|
inline |
Appends the other SoA buffer to this.
other | Other buffer. |
|
inline |
Appends the specified attributes from the other SoA buffer to this.
attributes | Attributes to append. |
other | Other buffer. |
|
inline |
Appends the other SoA buffer to this.
other | Other buffer. |
|
inline |
Returns a pointer to the given attribute vector.
attribute | ID of the desired attribute. |
|
inline |
|
inline |
Constructs a view that starts at startIndex
(inclusive) and ends at endIndex
(exclusive).
startIndex
and endIndex
have to be between 0 (inclusive) and this->size()
(inclusive). endIndex
has to be greater or equal to startIndex
.
startIndex | The index of the first entry to view. |
endIndex | The index of the entry after the last entry to view. |
startIndex
(inclusive) to endIndex
(exclusive).
|
inline |
Pushes a given value to the desired attribute array.
attribute | Index of array to push to. |
value | Value to push. |
|
inline |
Reads the value of a given attribute of a given particle.
attribute | Attribute to read from. |
particleId | Position to read from. |
|
inline |
Reads from all given attribute arrays at position particleId
.
ArrayLength | length of the returned array. Should be equal attributes.size(). |
attributes | Attributes to read from. |
particleId | Position to read from. |
|
inline |
Resizes all Vectors to the given length.
length | new length. |
|
inline |
Returns the number of particles.
Since not necessarily all arrays are filled the length of the longest array is returned.
|
inline |
swap the position of two particles in the soa
a | position of the first particle |
b | position of the second particle |
|
inline |
Writes / updates the value of an attribute for a specific particle.
attribute | Attribute to update. |
ValueType | type of the attribute |
particleId | Particle to update. |
value | New value. |
|
inline |
Specialized version to pass arrays without specifying it directly.
attributes | |
N |
particleId | |
values |
|
inline |
Writes or updates values of attributes for a specific particle.
attributes | Array of attributes to update. |
ValueArrayType | type of the array |
particleId | Particle to update. |
values | New value. |