ImpactX
Loading...
Searching...
No Matches
dynamicdata.H File Reference
#include "impactx_export.H"
#include <AMReX_Gpu.H>
#include <map>
#include <memory>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

struct  impactx::elements::mixin::GPUDataRegistry< T >
 

Namespaces

namespace  impactx
 
namespace  impactx::elements
 
namespace  impactx::elements::mixin
 

Macros

#define IMPACTX_GPUDATA_EXTERN(ElementType)
 
#define IMPACTX_GPUDATA_INSTANTIATE(ElementType)
 

Variables

template<typename T>
int impactx::elements::mixin::GPUDataRegistry< T >::s_next_id = 0
 
template<typename T>
std::map< int, std::shared_ptr< T > > impactx::elements::mixin::GPUDataRegistry< T >::s_registry
 

Macro Definition Documentation

◆ IMPACTX_GPUDATA_EXTERN

#define IMPACTX_GPUDATA_EXTERN ( ElementType)
Value:
ElementType::DynamicData::DataType>;

Suppress implicit instantiation of GPUDataRegistry for an element type.

GPUDataRegistry holds its registry map and ID counter in exported static data members (s_next_id, s_registry) declared inside the class and defined out-of-line in this header. Without explicit instantiation control, different translation units, especially downstream shared libraries built with -fvisibility=hidden and/or LTO (e.g. the Python bindings module), could materialize a separate copy of these statics, causing elements to be registered in one registry instance but looked up in another (ODR violation).

Use IMPACTX_GPUDATA_EXTERN in headers and IMPACTX_GPUDATA_INSTANTIATE in the corresponding .cpp file to ensure a single shared registry across the program.

Parameters
ElementTypeThe element class (must define using DynamicData = ...)

◆ IMPACTX_GPUDATA_INSTANTIATE

#define IMPACTX_GPUDATA_INSTANTIATE ( ElementType)
Value:
ElementType::DynamicData::DataType>;

Explicit instantiation of GPUDataRegistry for an element type.

Provides the single definition of the registry's s_next_id / s_registry static data members. Pair with IMPACTX_GPUDATA_EXTERN in the header.

Parameters
ElementTypeThe element class (must define using DynamicData = ...)