AutoPas  3.0.0
Loading...
Searching...
No Matches
SoAStorage.h
Go to the documentation of this file.
1
7#pragma once
8
9#include <tuple>
10
12
13namespace autopas::utils {
14
19template <class SoAArraysType>
21 public:
31 template <typename FunctorT>
32 void apply(FunctorT func) {
33 utils::TupleUtils::for_each(soaStorageTuple, func);
34 }
35
41 template <size_t soaAttribute>
42 inline constexpr auto &get() {
43 return std::get<soaAttribute>(soaStorageTuple);
44 }
45
50 template <size_t soaAttribute>
51 inline constexpr const auto &get() const {
52 return std::get<soaAttribute>(soaStorageTuple);
53 }
54
59 inline constexpr const auto &getTuple() const { return soaStorageTuple; }
60
61 private:
62 SoAArraysType soaStorageTuple;
63};
64
65} // namespace autopas::utils
SoAStorage is a helper to access the stored SoA's.
Definition: SoAStorage.h:20
void apply(FunctorT func)
Apply the specific function to all vectors.
Definition: SoAStorage.h:32
constexpr auto & get()
Get the vector at the specific entry of the storage.
Definition: SoAStorage.h:42
constexpr const auto & get() const
Get the vector at the specific entry of the storage.
Definition: SoAStorage.h:51
constexpr const auto & getTuple() const
Getter for the internal tuple.
Definition: SoAStorage.h:59
void for_each(T &&tuple, F &&f)
Applies a function f on every element of the tuple.
Definition: TupleUtils.h:22
In this namespace some helper classes and functions can be found used inside of AutoPas.
Definition: namespaces.h:44