AutoPas  3.0.0
Loading...
Searching...
No Matches
Public Member Functions | List of all members
autopas::SoA< SoAArraysType > Class Template Reference

Structur of the array class. More...

#include <SoA.h>

Inheritance diagram for autopas::SoA< SoAArraysType >:
Inheritance graph
[legend]

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).
 

Detailed Description

template<class SoAArraysType>
class autopas::SoA< SoAArraysType >

Structur of the array class.

Template Parameters
SoAArraysTypeThe SoAArrayType to be used for storage.

Constructor & Destructor Documentation

◆ SoA()

template<class SoAArraysType >
autopas::SoA< SoAArraysType >::SoA ( const SoA< SoAArraysType > &  soa)
default

Copy constructor.

Parameters
soaSoA to copy.

Member Function Documentation

◆ append() [1/3]

template<class SoAArraysType >
void autopas::SoA< SoAArraysType >::append ( const SoA< SoAArraysType > &  other)
inline

Appends the other SoA buffer to this.

Parameters
otherOther buffer.

◆ append() [2/3]

template<class SoAArraysType >
template<int... attributes>
void autopas::SoA< SoAArraysType >::append ( const SoA< SoAArraysType > &  other)
inline

Appends the specified attributes from the other SoA buffer to this.

Template Parameters
attributesAttributes to append.
Parameters
otherOther buffer.

◆ append() [3/3]

template<class SoAArraysType >
void autopas::SoA< SoAArraysType >::append ( const SoAView< SoAArraysType > &  other)
inline

Appends the other SoA buffer to this.

Parameters
otherOther buffer.

◆ begin()

template<class SoAArraysType >
template<std::size_t attribute>
auto autopas::SoA< SoAArraysType >::begin ( )
inline

Returns a pointer to the given attribute vector.

Template Parameters
attributeID of the desired attribute.
Returns
Pointer to the beginning of the attribute vector

◆ constructView() [1/2]

template<class SoAArraysType >
SoAView< SoAArraysType > autopas::SoA< SoAArraysType >::constructView ( )
inline

Constructs a SoAView for the whole SoA and returns it.

Returns
the constructed SoAView on the whole SoA.

◆ constructView() [2/2]

template<class SoAArraysType >
SoAView< SoAArraysType > autopas::SoA< SoAArraysType >::constructView ( size_t  startIndex,
size_t  endIndex 
)
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.

Parameters
startIndexThe index of the first entry to view.
endIndexThe index of the entry after the last entry to view.
Returns
the constructed SoAView from startIndex (inclusive) to endIndex (exclusive).

◆ push()

template<class SoAArraysType >
template<std::size_t attribute>
void autopas::SoA< SoAArraysType >::push ( const double  value)
inline

Pushes a given value to the desired attribute array.

Template Parameters
attributeIndex of array to push to.
Parameters
valueValue to push.

◆ read()

template<class SoAArraysType >
template<std::size_t attribute>
auto autopas::SoA< SoAArraysType >::read ( size_t  particleId) const
inline

Reads the value of a given attribute of a given particle.

Template Parameters
attributeAttribute to read from.
Parameters
particleIdPosition to read from.
Returns
Attribute value.

◆ readMultiple()

template<class SoAArraysType >
template<int... attributes>
std::array< double, sizeof...(attributes)> autopas::SoA< SoAArraysType >::readMultiple ( size_t  particleId) const
inline

Reads from all given attribute arrays at position particleId.

Template Parameters
ArrayLengthlength of the returned array. Should be equal attributes.size().
attributesAttributes to read from.
Parameters
particleIdPosition to read from.
Returns
Array of attributes ordered by given attribute order.

◆ resizeArrays()

template<class SoAArraysType >
void autopas::SoA< SoAArraysType >::resizeArrays ( size_t  length)
inline

Resizes all Vectors to the given length.

Parameters
lengthnew length.

◆ size()

template<class SoAArraysType >
size_t autopas::SoA< SoAArraysType >::size ( ) const
inline

Returns the number of particles.

Since not necessarily all arrays are filled the length of the longest array is returned.

Returns
Number of particles.

◆ swap()

template<class SoAArraysType >
void autopas::SoA< SoAArraysType >::swap ( std::size_t  a,
std::size_t  b 
)
inline

swap the position of two particles in the soa

Parameters
aposition of the first particle
bposition of the second particle

◆ write()

template<class SoAArraysType >
template<int attribute, class ValueType >
void autopas::SoA< SoAArraysType >::write ( size_t  particleId,
const ValueType &  value 
)
inline

Writes / updates the value of an attribute for a specific particle.

Template Parameters
attributeAttribute to update.
ValueTypetype of the attribute
Parameters
particleIdParticle to update.
valueNew value.

◆ writeMultiple() [1/2]

template<class SoAArraysType >
template<int... attributes, size_t N = sizeof...(attributes)>
void autopas::SoA< SoAArraysType >::writeMultiple ( size_t  particleId,
const std::array< double, N > &  values 
)
inline

Specialized version to pass arrays without specifying it directly.

Template Parameters
attributes
N
Parameters
particleId
values

◆ writeMultiple() [2/2]

template<class SoAArraysType >
template<int... attributes, class ValueArrayType >
void autopas::SoA< SoAArraysType >::writeMultiple ( size_t  particleId,
const ValueArrayType &  values 
)
inline

Writes or updates values of attributes for a specific particle.

Template Parameters
attributesArray of attributes to update.
ValueArrayTypetype of the array
Parameters
particleIdParticle to update.
valuesNew value.

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