10#ifndef IMPACTX_ELEMENTS_MIXIN_DYNAMICDATA_H
11#define IMPACTX_ELEMENTS_MIXIN_DYNAMICDATA_H
13#include "impactx_export.H"
83 IMPACTX_EXPORT
static std::map<int, std::shared_ptr<T>>
s_registry;
97 static std::shared_ptr<T>
const &
101 auto it = reg.find(
id);
102 if (it == reg.end() || !it->second)
103 throw std::runtime_error(
104 "GPUDataRegistry::get failed for id=" + std::to_string(
id));
113 static void store (
int id, std::shared_ptr<T> data)
124 template<
typename... Args>
127 auto ptr = std::shared_ptr<T>(
new T{std::forward<Args>(args)...});
169#define IMPACTX_GPUDATA_EXTERN(ElementType) \
170 extern template struct impactx::elements::mixin::GPUDataRegistry< \
171 ElementType::DynamicData::DataType>;
180#define IMPACTX_GPUDATA_INSTANTIATE(ElementType) \
181 template struct impactx::elements::mixin::GPUDataRegistry< \
182 ElementType::DynamicData::DataType>;
Definition alignment.H:23
Definition dynamicdata.H:54
static void store(int id, std::shared_ptr< T > data)
Definition dynamicdata.H:113
static IMPACTX_EXPORT std::map< int, std::shared_ptr< CFbendCoefficients > > s_registry
Definition dynamicdata.H:83
static std::map< int, std::shared_ptr< T > > & registry()
Definition dynamicdata.H:86
static std::shared_ptr< T > const & get(int id)
Definition dynamicdata.H:98
static int allocate_id()
Definition dynamicdata.H:89
static T & emplace(int id, Args &&... args)
Definition dynamicdata.H:125
static int & next_id()
Definition dynamicdata.H:85
CFbendCoefficients DataType
Definition dynamicdata.H:55
static IMPACTX_EXPORT int s_next_id
Definition dynamicdata.H:82
static void clear()
Definition dynamicdata.H:133