BioDynaMo
v1.05.120-25dc9790
|
Go to the documentation of this file.
15 #ifndef CORE_CONTAINER_SHARED_DATA_H_
16 #define CORE_CONTAINER_SHARED_DATA_H_
33 #ifdef __cpp_lib_hardware_interference_size
51 struct alignas(hardware_destructive_interference_size)
AlignedT {
58 using Data = std::vector<AlignedT>;
63 for (
auto& info :
data_) {
75 data_.resize(new_size);
86 return index == other.
index && data == other.
data;
90 const T&
operator*()
const {
return (*data)[index].data; }
110 #endif // CORE_CONTAINER_SHARED_DATA_H_
The SharedData class avoids false sharing between threads.
constexpr std::size_t hardware_destructive_interference_size
constexpr std::size_t hardware_constructive_interference_size
const Iterator begin() const
void resize(size_t new_size)
Resize the SharedData.data_ vector.
std::vector< AlignedT > Data
Wrapper for a chacheline-size aligned T.
T & operator[](size_t index)
const T & operator[](size_t index) const
bool operator==(const Iterator &other)
bool operator!=(const Iterator &other)
size_t size() const
Get the size of the SharedData.data_ vector.
const T & operator*() const
SharedData(size_t size, const T &value=T())
#define BDM_CLASS_DEF_NV(class_name, class_version_id)
const Iterator end() const