API Reference#

Note

This page lists the full C++ API generated from source. Interactive class inheritance and collaboration diagrams (rendered with Graphviz) are available in the raw Doxygen output: Doxygen class index.

template<size_t INPUT_DIM_1, size_t INPUT_DIM_2, size_t OUTPUT_DIM>
struct AbstractBinaryArrayTransform#

Abstract base class encapsulating a binary transformation of two std::arrays.

Template Parameters:
  • INPUT_DIM_1 – Size of the first (lhs) array

  • INPUT_DIM_2 – Size of the second (lhs) array

  • OUTPUT_DIM – Size of the output (rhs) array

Public Functions

inline std::array<REAL, OUT_DIM> apply(const std::array<REAL, IN_DIM_1> &input_1, const std::array<REAL, IN_DIM_2> &input_2) const#

Function to apply a binary transform to two arrays.

@input_1 First (lhs) REAL-valued array @input_2 Second (lhs) REAL-valued array

Returns:

REAL-valued array of size OUT_DIM that’s the result of the binary transformation on the two input arrays.

Public Static Attributes

static const size_t IN_DIM_1 = INPUT_DIM_1#
static const size_t IN_DIM_2 = INPUT_DIM_2#
static const size_t OUT_DIM = OUTPUT_DIM#
struct AbstractCrossSection#
#include <reaction_data.hpp>

An abstract base class for cross-section objects. All classes derived from this class should be device copyable in order to be used within ReactionData classes.

Subclassed by VANTAGE::Reactions::AMJUELFitCrossSection< num_coeffs, num_l_coeffs, num_r_coeffs >, VANTAGE::Reactions::ConstantRateCrossSection

Public Functions

inline REAL get_value_at(const REAL &relative_vel) const#

Get the value of the cross section for a given relative velocity value of projectile and target.

Parameters:

relative_vel – Magnitude of relative velocity of target and projectile

Returns:

REAL-valued cross-section at requested relative vel magnitude

inline REAL get_max_rate_val() const#

Get the maximum value of sigma*v_r where sigma is this cross-section evaluated at v_r and v_r is the relative speed of the projectile and target.

Returns:

REAL-valued maximum rate

inline bool accept_reject(REAL relative_vel, REAL uniform_rand, REAL value_at, REAL max_rate_val) const#

Accept-reject function for when this cross-section is used in rejection methods. Accepts if the uniform random number on (0,1) is less than the ratio of sigma*v evaluated at a given relative speed to the maximum value of sigma*v.

Parameters:
  • relative_vel – Magnitude of relative velocity of the projectile and target

  • uniform_rand – Uniformly sampled random number on (0,1)

  • value_at – Value of cross section for a given relative velocity value of projectile and target (NOTE this is currently a workaround due to the limitation on calling get_value_at(…) inside this function.)

  • max_rate_val – Maximum value of sigma*v_r (NOTE this is currently a workaround due to the limitation on calling get_max_rate_val(…) inside this function.)

Returns:

true if relative_vel value is accepted, false otherwise

struct AbstractDataCalculator#

A dummy struct to derive DataCalculator from for the purposes of type-checking of DataCalculator (when it’s passed as a typename template parameter - see LinearReactionBase)

Subclassed by VANTAGE::Reactions::DataCalculator< EnergyRateData >, VANTAGE::Reactions::DataCalculator<>, VANTAGE::Reactions::DataCalculator< DATATYPE >

Public Functions

virtual ~AbstractDataCalculator() = default#
struct AbstractReaction : public VANTAGE::Reactions::ProfilingBase#
#include <reaction_base.hpp>

Abstract base class for reactions. All reactions operate on particles in a NP::ParticleSubGroup in a given cell and modify the NP::ParticleSubGroup and, depending on the reaction, produce and process descendants.

Subclassed by VANTAGE::Reactions::LinearReactionBaseImpl< num_products_per_parent, RateData, IoniseReactionKernels< 2 > >, VANTAGE::Reactions::LinearReactionBaseImpl< num_products_per_parent, RateData, RecombReactionKernels< ndim > >, VANTAGE::Reactions::LinearReactionBaseImpl< num_products_per_parent, ReactionData, ReactionKernels >

Public Functions

AbstractReaction(NP::SYCLTargetSharedPtr sycl_target, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for AbstractReaction.

Parameters:
  • sycl_target – Compute device used by the instance. This must be the same sycl_target that is assigned to the NP::ParticleGroup that the Reaction is to be applied to.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (weight and total_reaction_rate).

virtual ~AbstractReaction() = default#
virtual void calculate_rates_v(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end) = 0#

Virtual functions to be overidden by an implementation in a derived struct.

virtual void calculate_rates(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end)#

Specialisations should override calculate_rates_v not calculate_rates.

virtual void apply_v(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end, double dt, NP::ParticleGroupSharedPtr child_group, bool full_weight = false) = 0#
virtual void apply(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end, double dt, NP::ParticleGroupSharedPtr child_group, bool full_weight = false)#

Specialisations should override apply_v not apply.

inline virtual std::vector<int> get_in_states()#
inline virtual std::vector<int> get_out_states()#
virtual void flush_buffer(size_t buffer_size) = 0#
virtual void flush_weight_buffer(size_t buffer_size) = 0#
virtual void flush_pre_req_data() = 0#
inline void set_max_buffer_size(size_t max_size)#

Set the maximum size for data buffers on this reaction.

Parameters:

max_size – Maximum size (per dimension) of data buffers on this reaction

inline const NP::Sym<REAL> &get_weight_sym() const#
inline void set_weight_sym(const NP::Sym<REAL> &weight_sym)#

Protected Functions

inline const NP::Sym<REAL> &get_total_reaction_rate()#

Setters and getters for private members.

inline void set_total_reaction_rate(const NP::Sym<REAL> &total_reaction_rate)#
inline const NP::LocalArraySharedPtr<REAL> &get_device_rate_buffer()#
inline const NP::LocalArraySharedPtr<REAL> &get_device_weight_buffer()#
inline void set_device_weight_buffer(NP::LocalArraySharedPtr<REAL> &device_weight_buffer)#
inline const size_t &get_device_rate_buffer_size()#
inline void set_device_rate_buffer(NP::LocalArraySharedPtr<REAL> &device_rate_buffer)#
inline const NP::SYCLTargetSharedPtr &get_sycl_target()#
inline const NP::NDLocalArraySharedPtr<REAL, 2> &get_pre_req_data()#
inline void set_pre_req_data(NP::NDLocalArraySharedPtr<REAL, 2> &pre_req_data)#
inline size_t get_max_buffer_size()#

Private Members

NP::Sym<REAL> total_reaction_rate#
NP::LocalArraySharedPtr<REAL> device_rate_buffer#
NP::LocalArraySharedPtr<REAL> device_weight_buffer#
NP::SYCLTargetSharedPtr sycl_target_stored#
NP::NDLocalArraySharedPtr<REAL, 2> pre_req_data#

Real-valued local matrix for storing any pre-requisite data relating to a derived reaction.

NP::Sym<REAL> weight_sym#
size_t max_buffer_size#

max buffer size for data on the reactions object

template<size_t INPUT_DIM, size_t OUTPUT_DIM>
struct AbstractUnaryArrayTransform#

Abstract base class encapsulating a unary transformation of a std::array.

Template Parameters:
  • INPUT_DIM – Expected input size

  • OUTPUT_DIM – Expected output_size

Public Functions

inline std::array<REAL, OUT_DIM> apply(const std::array<REAL, IN_DIM> &input) const#

Public Static Attributes

static const size_t IN_DIM = INPUT_DIM#
static const size_t OUT_DIM = OUTPUT_DIM#
template<int num_coeffs>
struct AMJUEL1DData : public VANTAGE::Reactions::ReactionDataBase<AMJUEL1DDataOnDevice<num_coeffs>>#
#include <AMJUEL_1D_data.hpp>

Reaction rate data calculation based on AMJUEL fits against ion/plasma temperature.

Template Parameters:

num_coeffs – The number of coefficients needed for 1D AMJUEL reaction rate calculation.

Public Functions

inline AMJUEL1DData(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const std::array<REAL, num_coeffs> &coeffs, std::map<int, std::string> properties_map = get_default_map())#

Constructor for AMJUEL1DData.

Parameters:
  • evolved_quantity_normalisation – Normalisation of the evolved quantity (the one evolved with this rate)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • coeffs – A real-valued array of coefficients to be used in a 1D AMJUEL reaction rate calculation.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline virtual void index_on_device_object()#

Index the fluid density, temperature, and particle weight on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 3> required_simple_real_props = {props.fluid_density, props.fluid_temperature, props.weight}#
template<int num_coeffs>
struct AMJUEL1DDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#
#include <AMJUEL_1D_data.hpp>

On device: Reaction rate data calculation based on AMJUEL fits against ion/plasma temperature.

Template Parameters:

num_coeffs – The number of coefficients needed for 1D AMJUEL reaction rate calculation.

Public Functions

AMJUEL1DDataOnDevice() = default#
inline AMJUEL1DDataOnDevice(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const std::array<REAL, num_coeffs> &coeffs)#

Constructor for AMJUEL1DDataOnDevice.

Parameters:
  • evolved_quantity_normalisation – Normalisation constant for the evolved quantity (for default rates should be 1)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • coeffs – A real-valued array of coefficients to be used in a 1D AMJUEL reaction rate calculation.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for a 1D AMJUEL-based reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Public Members

int fluid_density_ind#
int fluid_temperature_ind#
int weight_ind#
REAL temperature_normalisation#
REAL mult_const#
std::array<REAL, num_coeffs> coeffs#
template<int num_coeffs_T, int num_coeffs_n>
struct AMJUEL2DData : public VANTAGE::Reactions::ReactionDataBase<AMJUEL2DDataOnDevice<num_coeffs_T, num_coeffs_n>>#
#include <AMJUEL_2D_data.hpp>

Reaction rate data calculation based on 2D AMJUEL rate calculation against ion/plasma density and ion/plasma temperature. Handles Coronal approximation correctly.

Template Parameters:
  • num_coeffs_T – The number of fit parameters in the T direction needed for 2D AMJUEL reaction rate calculation.

  • num_coeffs_n – The number of fit parameters in the n direction needed for 2D AMJUEL reaction rate calculation.

Public Functions

inline AMJUEL2DData(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const std::array<std::array<REAL, num_coeffs_n>, num_coeffs_T> &coeffs, std::map<int, std::string> properties_map = get_default_map())#

Constructor for AMJUEL2DData.

Parameters:
  • evolved_quantity_normalisation – Normalisation constant for the evolved quantity (for default rates should be 1)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • coeffs – A real-valued 2D array of coefficients to be used in a 2D AMJUEL reaction rate calculation.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline virtual void index_on_device_object()#

Index the fluid density, temperature, and particle weight on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 3> required_simple_real_props = {props.fluid_density, props.fluid_temperature, props.weight}#
template<size_t num_coeffs_T, size_t num_coeffs_E, size_t dim = 2>
struct AMJUEL2DDataH3 : public VANTAGE::Reactions::ReactionDataBase<AMJUEL2DDataH3OnDevice<num_coeffs_T, num_coeffs_E, 2>>#

Reaction rate data calculation based on AMJUEL H.3 fits against neutral particle energy and ion/plasma temperature.

Template Parameters:
  • num_coeffs_T – The number of fit parameters in the T direction needed for 2D AMJUEL reaction rate calculation.

  • num_coeffs_E – The number of fit parameters in the n direction needed for 2D AMJUEL reaction rate calculation.

  • dim – The number of dimensions for the particle velocity property and background fluid flow (default value of 2)

Public Functions

inline AMJUEL2DDataH3(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const REAL &velocity_normalisation, const REAL &mass_amu, const std::array<std::array<REAL, num_coeffs_E>, num_coeffs_T> &coeffs, std::map<int, std::string> properties_map = get_default_map())#

Constructor for AMJUEL2DDataH3.

Parameters:
  • evolved_quantity_normalisation – Normalisation constant for the evolved quantity (for default rates should be 1)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • velocity_normalisation – Velocity normalisation in m/s

  • mass_amu – Mass of the neutral particle in amus

  • coeffs – A real-valued 2D array of coefficients to be used in a 2D AMJUEL reaction rate calculation.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline virtual void index_on_device_object()#

Index the fluid density, temperature, flow speed, and particle weight and velocity on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 5> required_simple_real_props = {props.fluid_density, props.fluid_temperature, props.fluid_flow_speed, props.weight, props.velocity}#
template<size_t num_coeffs_T, size_t num_coeffs_E, size_t dim>
struct AMJUEL2DDataH3OnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#

On device: Reaction rate data calculation based on AMJUEL H.3 fits against neutral particle energy and ion/plasma temperature.

Template Parameters:
  • num_coeffs_T – The number of fit parameters in the T direction needed for 2D AMJUEL reaction rate calculation.

  • num_coeffs_E – The number of fit parameters in the n direction needed for 2D AMJUEL reaction rate calculation.

  • dim – The number of dimensions for the particle velocity property and background fluid flow.

Public Functions

AMJUEL2DDataH3OnDevice() = default#
inline AMJUEL2DDataH3OnDevice(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const REAL &velocity_normalisation, const REAL &mass_amu, const std::array<std::array<REAL, num_coeffs_E>, num_coeffs_T> &coeffs)#

Constructor for AMJUEL2DDataH3OnDevice.

Parameters:
  • evolved_quantity_normalisation – Normalisation constant for the evolved quantity (for default rates should be 1)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • velocity_normalisation – Velocity normalisation in m/s

  • mass_amu – Mass of the neutral particle in amus

  • coeffs – A real-valued 2D array of coefficients to be used in a 2D AMJUEL reaction rate calculation.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for a 2D H.3 AMJUEL-based reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Public Members

int fluid_density_ind#
int fluid_temperature_ind#
int fluid_flow_speed_ind#
int velocity_ind#
int weight_ind#
REAL temperature_normalisation#
REAL en_mult_const#
REAL mult_const#
std::array<std::array<REAL, num_coeffs_E>, num_coeffs_T> coeffs#
template<int num_coeffs_T, int num_coeffs_n>
struct AMJUEL2DDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#
#include <AMJUEL_2D_data.hpp>

On device: Reaction rate data calculation based on 2D AMJUEL rate calculation against ion/plasma density and ion/plasma temperature. Handles Coronal approximation correctly.

Template Parameters:
  • num_coeffs_T – The number of fit parameters in the T direction needed for 2D AMJUEL reaction rate calculation.

  • num_coeffs_n – The number of fit parameters in the n direction needed for 2D AMJUEL reaction rate calculation.

Public Functions

AMJUEL2DDataOnDevice() = default#
inline AMJUEL2DDataOnDevice(const REAL &evolved_quantity_normalisation, const REAL &density_normalisation, const REAL &temperature_normalisation, const REAL &time_normalisation, const std::array<std::array<REAL, num_coeffs_n>, num_coeffs_T> &coeffs)#

Constructor for AMJUEL2DDataOnDevice.

Parameters:
  • evolved_quantity_normalisation – Normalisation constant for the evolved quantity (for default rates should be 1)

  • density_normalisation – Density normalisation constant in m^{-3}

  • temperature_normalisation – Temperature normalisation in eV

  • time_normalisation – Time normalisation in seconds

  • coeffs – A real-valued 2D array of coefficients to be used in a 2D AMJUEL reaction rate calculation.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for a 2D AMJUEL-based reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Public Members

int fluid_density_ind#
int fluid_temperature_ind#
int weight_ind#
REAL density_normalisation#
REAL temperature_normalisation#
REAL mult_const#
std::array<std::array<REAL, num_coeffs_n>, num_coeffs_T> coeffs#
template<size_t num_coeffs, size_t num_l_coeffs, size_t num_r_coeffs>
struct AMJUELFitCrossSection : public VANTAGE::Reactions::AbstractCrossSection#
#include <AMJUEL_fit_cs.hpp>

A struct that defines a general H.1 AMJUEL cross section fit, with left and right asymptotic treatment. Assumes monotonically decreasing cross-sections, and takes as the maximum value the evaluated rate at some maximum lab frame impact energy.

Template Parameters:
  • num_coeffs – Number of coefficients in the bulk of the validity range (usually 9).

  • num_l_coeffs – Number of fit coefficients in the left (low-energy) asymptotic fit (usually 3).

  • num_r_coeffs – Number of fit coefficients in the right (high-energy) asymptotic fit (usually 3).

Public Functions

AMJUELFitCrossSection() = default#
inline AMJUELFitCrossSection(REAL vel_norm, REAL cs_norm, REAL mass_amu, std::array<REAL, num_coeffs> coeffs, std::array<REAL, num_l_coeffs> l_coeffs, std::array<REAL, num_r_coeffs> r_coeffs, REAL lab_E_min, REAL lab_E_max, REAL max_E)#

Constructor for AMJUELFitCrossSection.

Parameters:
  • vel_norm – Velocity normalisation in m/s

  • cs_norm – Cross-section normalisation in m^2

  • mass_amu – Reduced mass of the collision partners in the H.1 reaction in amus

  • coeffs – Bulk fit coefficients

  • l_coeffs – Left asymptote coefficients (size 0 if no low-energy treatment)

  • r_coeffs – Right asymptote coefficients (size 0 if no high-energy treatment)

  • lab_E_min – Energy value below which the left asymptote fit is used (if there are any coefficients)

  • lab_E_max – Energy value above which the right asymptote fit is used (if there are any coefficients)

  • max_E – Highest energy for which the cross-section is evaluated. This is where the maximum value of the rate is assumed to be. After this value, the cross section is of the form max_val/v_r.

inline REAL get_value_at(const REAL &relative_vel) const#

Get value of H.1 AMJUEL cross section at given relative velocity of projectile and target.

Parameters:

relative_vel – Relative projectile and target velocity (in normalised units)

Returns:

Value of the cross section (in normalised units) at the given velocity value, obeying the fit asymptotic rules

inline REAL get_max_rate_val() const#

Returns maximum value of the rate sigma*v of for this cross-section.

Returns:

REAL-valued maximum value.

Private Members

REAL max_val#
REAL mult_const#
REAL cs_norm#
REAL max_E#
REAL lab_E_min#
REAL lab_E_max#
REAL scaled_inverse_cs_norm#
std::array<REAL, num_coeffs> coeffs#
std::array<REAL, num_l_coeffs> l_coeffs#
std::array<REAL, num_r_coeffs> r_coeffs#
template<typename PROP_TYPE>
struct ArgumentNameSet#

Wrapper type for holding a set of NP::Sym names that can be derived from Properties.

Template Parameters:

PROP_TYPE – INT or REAL, used in constructing the corresponding SymVector

Public Functions

ArgumentNameSet() = default#
inline ArgumentNameSet(Properties<PROP_TYPE> properties, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ArgumentNameSet using a Properties object.

Parameters:
  • properties – Properties object used to retrieve the names of the properties

  • properties_map – Property map used to map property enums in the Properties object to strings

inline ArgumentNameSet<PROP_TYPE> merge_with(const ArgumentNameSet<PROP_TYPE> &other)#

Merge this set with another.

Parameters:

other – ArgumentNameSet of the same type to merge with

Returns:

ArgumentNameSet containing union of argument names

inline void add(std::string elem)#

Add a name directly to the set.

Parameters:

elem – String representing a NP::Sym name of the corresponding type

inline std::vector<std::string> to_string_vector()#

Convert the set into a vector of strings.

Returns:

std::vector<std::string>> containing the names in the set

inline std::vector<NP::Sym<PROP_TYPE>> to_sym_vector()#

Convert the set into a vector of Syms.

Returns:

std::vector of Syms of the corresponding type

inline int find_index(std::string name)#

Return the index of the name in the set. Throws an error if the name isn’t in the set.

Parameters:

name – String to search for in the set

Returns:

Integer index - distance from first element in the set

Private Members

std::set<std::string> name_set#
template<size_t N, bool ephemeral_dat = false>
struct ArrayLookupData : public VANTAGE::Reactions::ReactionDataBase<ArrayLookupDataOnDevice<N, false>, N>#

Host reaction data returning an array based on lookup table for integer-valued key.

Template Parameters:
  • N – The size of the REAL-valued array stored in the lookup table

  • ephemeral_dat – True if the NP::Sym storing the key value is an ephemeral dat

Param key_comp:

The key dat component index to use as the lookup key

Public Functions

inline ArrayLookupData(const NP::Sym<INT> &key_sym, int key_sym_comp, const std::map<int, std::array<REAL, N>> &lookup_table, const std::array<REAL, N> &default_values, NP::SYCLTargetSharedPtr sycl_target)#

Constructor for ArrayLookupData.

Parameters:
  • key_sym – NP::Sym<INT> that designates which NP::ParticleDat to use for the key.

  • key_sym_comp – The component of the NP::ParticleDat signified by key_sym to be used as the key.

  • lookup_table – A map between int and std::array<REAL, N> that contains the lookup table (this will be used to fill a NP::BlockedBinaryNode). @default_values The default array to be returned in case the lookup key cannot be found. @sycl_target SYCL target shared pointer used for initialization of NP::BlockedBinaryTree.

inline virtual void index_on_device_object()#

Index the lookup table key variable on the on-device object.

Private Members

NP::Sym<INT> key_sym#
std::shared_ptr<NP::BlockedBinaryTree<int, std::array<REAL, N>, 8>> lut#
template<size_t N, bool ephemeral_dat>
struct ArrayLookupDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<N>#

Device reaction data returning an array based on lookup table for integer-valued key.

Template Parameters:
  • N – The size of the REAL-valued array stored in the lookup table

  • ephemeral_dat – True if the NP::Sym storing the key value is an ephemeral dat

Public Functions

ArrayLookupDataOnDevice() = default#
inline ArrayLookupDataOnDevice(const int &key_comp, const std::array<REAL, N> &default_data)#

Constructor for ArrayLookupDataOnDevice.

Parameters:
  • key_comp – The component of the NP::ParticleDat to be used as the key

  • default_data – REAL-valued array returned if the key is not found

inline std::array<REAL, N> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice<N>::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to retrieve values from a lookup-table.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

REAL-valued array of size N containing the values from the lookup-table for a given key_val (retrieved from ParticleDat using key_ind).

Public Members

NP::BlockedBinaryNode<int, std::array<REAL, N>, 8> *lut_root#
INT key_ind#

Private Members

std::array<REAL, N> default_data#
INT key_comp#
struct ArrheniusData : public VANTAGE::Reactions::ReactionDataBase<ArrheniusDataOnDevice>#
#include <arrhenius_data.hpp>

Reaction rate data calculation for an Arrhenius rate coefficient reaction. The reaction rate is calculated as a_coeff * temperature ** b_coeff.

  • particle_weight.

Public Functions

ArrheniusData(REAL a_coeff, REAL b_coeff, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ArrheniusData.

Parameters:
  • a_coeff – REAL-valued multiplicative factor for the Arrhenius rate.

  • b_coeff – REAL-valued power for the Arrhenius rate. and the particle weight)

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

virtual void index_on_device_object()#

Index the particle weight and fluid temperature on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.weight, props.fluid_temperature}#
struct ArrheniusDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#
#include <arrhenius_data.hpp>

On device: Reaction rate data calculation for an Arrhenius rate coefficient reaction. The reaction rate is calculated as a*temparture**b * particle_weight.

Public Functions

ArrheniusDataOnDevice() = default#
inline ArrheniusDataOnDevice(REAL a_coeff, REAL b_coeff)#

Constructor for ArrheniusDataOnDevice.

Parameters:
  • a_coeff – REAL-valued multiplicative factor for the Arrhenius rate.

  • b_coeff – REAL-valued power for the Arrhenius rate.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for an Arrhenius rate coefficient reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Public Members

int weight_ind#
int temperature_ind#
REAL a_coeff#
REAL b_coeff#
template<size_t DIM1, size_t DIM2, size_t DIM_OUT, typename OP>
struct BinaryArrayOperatorTransform : public VANTAGE::Reactions::AbstractBinaryArrayTransform<DIM1, DIM2, DIM_OUT>#

Binary full array transform supporting broadcasting from size 1 arrays.

Template Parameters:
  • DIM1 – The size of the first transformed array

  • DIM2 – The size of the second transformed array

  • DIM_OUT – The size of the output array

  • OP – Binary operator to be used (acting on std::arrays)

Public Functions

BinaryArrayOperatorTransform() = default#
inline BinaryArrayOperatorTransform(const OP &op)#

Constructor for BinaryArrayOperatorTransform.

Parameters:

op – Binary operator.

inline std::array<REAL, DIM_OUT> apply(const std::array<REAL, DIM1> &input_1, const std::array<REAL, DIM2> &input_2) const#

Function to apply the transform.

Parameters:
  • input_1 – REAL-valued array of size DIM1 that’s passed to the binary operator.

  • input_2 – REAL-valued array of size DIM2 that’s passed to the binary operator.

Returns:

REAL-valued array of size DIM_OUT that is the transformed array.

Private Members

OP op#
template<typename TRANSFORM, typename DATATYPE1, typename DATATYPE2>
struct BinaryArrayTransformData : public VANTAGE::Reactions::CompositeData<BinaryArrayTransformDataOnDevice<TRANSFORM, DATATYPE1::ON_DEVICE_OBJ_TYPE, DATATYPE2::ON_DEVICE_OBJ_TYPE>, TRANSFORM::OUT_DIM, 0, DATATYPE1, DATATYPE2>#

Composite ReactionData object containing two other ReactionData objects. On calculation of the data, passes the output of the objects to a binary transformation object which is then applied to the two arrays.

Template Parameters:
  • TRANSFORM – The binary transformation object to be applied to the results of the contained data objects

  • DATATYPE1 – The host type of the first (lhs) contained object

  • DATATYPE2 – The host type of the second (rhs) contained object

Public Functions

inline BinaryArrayTransformData(TRANSFORM transform, DATATYPE1 data1, DATATYPE2 data2)#

Constructor for BinaryArrayTransformData.

Parameters:
  • transform – The binary transformation object to be applied to the results of the two data objects

  • data1 – The first (lhs) data object

  • data2 – The secon (rhs) data object

inline virtual void index_on_device_object()#

Reconstruct the composite on-device object (assuming the individual on-device objects have been modified/re-indexed)

Private Members

TRANSFORM transform#
template<typename TRANSFORM, typename DATATYPE1, typename DATATYPE2>
struct BinaryArrayTransformDataOnDevice : public VANTAGE::Reactions::CompositeDataOnDevice<TRANSFORM::OUT_DIM, 0, REAL, REAL, DATATYPE1, DATATYPE2>#

Binary array transform data on device, applying a binary transformation on the outputs of two reaction data objects.

Template Parameters:
  • TRANSFORM – The binary transform type

  • DATATYPE1 – The first (lhs) operand type

  • DATATYPE2 – The second (rhs) operand type

Public Functions

BinaryArrayTransformDataOnDevice() = default#
inline BinaryArrayTransformDataOnDevice(TRANSFORM transform, DATATYPE1 data1, DATATYPE2 data2)#

BinaryArrayTransformDataOnDevice constructor.

Parameters:
  • transform – Transformation object to be applied to the results of the two contained data objects

  • data1 – The first (lhs) contained data object

  • data2 – The second (rhs) contained data object

inline std::array<REAL, TRANSFORM::OUT_DIM> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE1::RNG_KERNEL_TYPE>, std::shared_ptr<typename DATATYPE2::RNG_KERNEL_TYPE>>::KernelType &rng_kernel) const#

Return the result of applying the binary transform on the results of the two contained objects.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernels used in the calculation, a NP::TupleRNG accessor

Returns:

The result of applying the transform on the results of the two contained data objects. REAL-valued array of size TRANSFORM::OUT_DIM

Private Members

TRANSFORM transform#
template<size_t DIM>
struct BinaryDotArrayTransform : public VANTAGE::Reactions::AbstractBinaryArrayTransform<DIM, DIM, 1>#

Binary array transform returning the dot-product of two arrays.

Template Parameters:

DIM – The size of the transformed array

Public Functions

BinaryDotArrayTransform() = default#
inline std::array<REAL, 1> apply(const std::array<REAL, DIM> &input_1, const std::array<REAL, DIM> &input_2) const#

Function to apply the transform.

Parameters:
  • input_1 – REAL-valued array of size DIM.

  • input_2 – REAL-valued array of size DIM.

Returns:

REAL-valued array of size 1 that is the result of the dot product.

template<size_t DIM1, size_t DIM2, typename OP>
struct BinaryElementwiseOperatorTransform : public VANTAGE::Reactions::AbstractBinaryArrayTransform<DIM1, DIM2, std::max(DIM1, DIM2)>#

Binary element-wise transform supporting broadcasting from size 1 arrays.

Template Parameters:
  • DIM1 – The size of the first transformed array

  • DIM2 – The size of the second transformed array

  • OP – Binary operator to be used

Public Functions

BinaryElementwiseOperatorTransform() = default#
inline BinaryElementwiseOperatorTransform(const OP &op)#

Constructor for BinaryElementwiseOperatorTransform.

Parameters:

op – Binary operator.

inline std::array<REAL, std::max(DIM1, DIM2)> apply(const std::array<REAL, DIM1> &input_1, const std::array<REAL, DIM2> &input_2) const#

Function to apply the transform.

Parameters:
  • input_1 – REAL-valued array of size DIM1 that’s passed elementwise to the binary operator.

  • input_2 – REAL-valued array of size DIM2 that’s passed elementwise to the binary operator.

Returns:

REAL-valued array of size max(DIM1, DIM2) that is the transformed array.

Private Members

OP op#
template<size_t DIM>
struct BinaryProjectArrayTransform : public VANTAGE::Reactions::AbstractBinaryArrayTransform<DIM, DIM, DIM>#

Binary array transform projecting the first input onto the second one.

Template Parameters:

DIM – The size of the transformed array

Public Functions

BinaryProjectArrayTransform() = default#
inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input_1, const std::array<REAL, DIM> &input_2) const#

Function to apply the transform.

Parameters:
  • input_1 – Input REAL-valued array of size DIM to project onto input_2.

  • input_2 – Input REAL-valued array of size DIM on which input_1 is projected.

Returns:

REAL-valued array of size DIM, that’s the result of the projection.

template<size_t DIM>
struct BinaryProjectNormalArrayTransform : public VANTAGE::Reactions::AbstractBinaryArrayTransform<DIM, DIM, DIM>#

Binary array transform projecting the first input onto the plane normal to the second one.

Template Parameters:

DIM – The size of the transformed array

Public Functions

BinaryProjectNormalArrayTransform() = default#
inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input_1, const std::array<REAL, DIM> &input_2) const#

Function to apply the transform.

Parameters:
  • input_1 – Input REAL-valued array of size DIM to project onto the plane normal to input_2.

  • input_2 – Input REAL-valued array of size DIM whose plane normal input_1 is projected onto.

Returns:

REAL-valued array of size DIM, that’s the result of the projection.

struct CartesianBasisReflectionData : public VANTAGE::Reactions::ReactionDataBase<CartesianBasisReflectionDataOnDevice, 3, DEFAULT_RNG_KERNEL, 3>#

ReactionData calculating reflected velocity from components in the cartesian coordinate system derived from the surface normal and the velocity vector of the particle. The vectors of the local basis are:

x - in the direction along the projection of the velocity onto the surface y - in the plane of the surface, perpendicular to x z - along the surface normal pointing into the domain

The input array is expected to be a size 3 array with entries for velocities in the three directions.

Public Functions

CartesianBasisReflectionData(std::map<int, std::string> properties_map = get_default_map())#

Constructor for CartesianBasisReflectionData.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

virtual void index_on_device_object()#

Index the particle velocity and surface normal properties on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.velocity, props.boundary_intersection_normal}#
struct CartesianBasisReflectionDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<3, DEFAULT_RNG_KERNEL, 3>#

On device: ReactionData calculating a reflected velocity vector in a cartesian basis determined by the ingoing velocity and the normal.

The expected inputs are a size 3 array with entries for the velocities. The first two components are the components parallel to the surface (with the first component in the direction determined by the projection of the ingoing particle velocity). The final component is in the direction of the surface normal (directed back into the domain).

Works only for 3D

Public Functions

CartesianBasisReflectionDataOnDevice() = default#
inline std::array<REAL, 3> calc_data(const std::array<REAL, 3> input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename DEFAULT_RNG_KERNEL::KernelType &kernel) const#

Function to calculate the reflected velocities.

Parameters:
  • input – The v_x, v_y, v_z components of the reflected vector (see class docstring)

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 3 that contains the calculated reflected velocities.

Public Members

int normal_ind#
int vel_ind#
template<int input_ndim>
struct CartesianGridData : public VANTAGE::Reactions::ReactionDataBase<CartesianGridDataOnDevice<input_ndim>>#

Reaction rate data calculation managing buffers for grid, coords, and dims, enabling on-device grid evaluation.

The grid evaluation works with the NP::BufferDevice objects that are constructed for the input vectors (grid, coords_vec, dims_vec). As such, there are constraints on the format of the vectors. All input vectors are 1D vectors and are accessed using the logic in the on-device calc_data(…). For a given input coordinate, the index in each dimension is found by locating the index of the closest point in the coordinates for that dimension that is less than the input coordinate value. These per-dimension indices are then flattened via row-major ordering into a single index, and the corresponding value is retrieved from d_grid_ptr (a pointer to a NP::BufferDevice that is constructed from std::vector<REAL> grid).

Template Parameters:

input_ndim – The number of input dimensions for the grid lookup.

Public Functions

inline CartesianGridData(const std::vector<REAL> &grid, const std::vector<REAL> &coords_vec, const std::vector<size_t> &dims_vec, NP::SYCLTargetSharedPtr sycl_target)#

Constructor for CartesianGridData.

Parameters:
  • grid – Flat vector of grid values (tabulated data).

  • coords_vec – Coordinate boundaries for each dimension (used for index computation).

  • dims_vec – Grid dimensions (number of grid points per axis).

  • sycl_target – SYCL target shared pointer used for buffer allocation.

inline CartesianGridData(const GridDescriptor<input_ndim> &grid_descriptor, NP::SYCLTargetSharedPtr sycl_target)#

Constructor using a GridDescriptor object.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Public Members

std::shared_ptr<NP::BufferDevice<REAL>> d_grid#
std::shared_ptr<NP::BufferDevice<REAL>> d_coords#
std::shared_ptr<NP::BufferDevice<size_t>> d_dims#
template<int input_ndim>
struct CartesianGridDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<1, DEFAULT_RNG_KERNEL, input_ndim>#

On device: Reaction rate data calculation evaluating a lookup grid by computing grid indices and returning the grid value at the flat index.

An input coordinate is mapped to a flat grid index as follows. The coordinate vector for dimension idim begins at an offset: sum(d_dims[jdim] for jdim = 0 to idim-1) and contains d_dims[idim] elements. Given an input value (input[idim]), the index (grid_indices[idim]), is calculated. This is the largest index satisfying input[idim] >= d_coords[offset + grid_indices[idim]]. The per-dimension grid_indices are combined via row-major ordering into a single flat index, and the returned value is d_grid[grid_flat_index].

Template Parameters:

input_ndim – The number of input dimensions for the grid lookup.

Public Functions

CartesianGridDataOnDevice() = default#
inline CartesianGridDataOnDevice(const std::shared_ptr<NP::BufferDevice<REAL>> &d_grid, const std::shared_ptr<NP::BufferDevice<REAL>> &d_coords, const std::shared_ptr<NP::BufferDevice<size_t>> &d_dims)#

Constructor for CartesianGridDataOnDevice.

Parameters:
  • d_grid – Shared pointer to a device buffer containing the tabulated data.

  • d_coords – Shared pointer to a device buffer containing coordinate boundaries for the interpolation dimensions.

  • d_dims – Shared pointer to a device buffer containing grid dimensions for the interpolation axes.

inline std::array<REAL, 1> calc_data(const std::array<REAL, input_ndim> &input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, DEFAULT_RNG_KERNEL::KernelType &rng_kernel) const#

Function to compute grid indices from the input coordinate and return the grid value at the computed index.

Parameters:
  • input – The input coordinate array of size input_ndim.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called (unused for this data type).

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation (unused for this data type).

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation (unused for this data type).

  • rng_kernel – The random number generator kernel potentially used in the calculation (unused for this data type).

Returns:

A REAL-valued array of size 1 containing the grid value at the computed flat index.

Public Members

size_t const *d_dims_ptr#
REAL const *d_coords_ptr#
REAL const *d_grid_ptr#
template<typename T>
struct CellwiseAccumulator : public VANTAGE::Reactions::TransformationStrategy#

Transfomation strategy that accumulates values of certain particle dats and provides access to the cell-wise accumulated data.

Template Parameters:

T – REAL or INT

Public Functions

CellwiseAccumulator() = delete#
inline CellwiseAccumulator(NP::ParticleGroupSharedPtr template_group, std::vector<std::string> dat_names)#

Constructor for CellwiseAccumulator.

Parameters:
  • template_group – A template particle group used to provide the ParticleDats specified by dat_names for the created CellDatConsts.

  • dat_names – A vector of strings specifying the names of the dats to be accumulated cell-wise.

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Accumulate the dats registered in this transform. Does not modify the particles.

Parameters:

target_subgroup – Subgroup containing particles whose dats should be accumulated

inline std::vector<NP::CellData<T>> get_cell_data(std::string data_name)#

Extract the cell-wise accumulated data as a standard vector of NP::CellData objects.

Parameters:

data_name – Name of the particle dat to be extracted

inline NP::CellDatConstSharedPtr<T> get_value_pointer(std::string data_name)#

Get the pointer to underlying NP::CellDatConst for given named data.

Parameters:

data_name – Name of the particle dat to be extracted

inline void set_cell_data(std::string data_name, NP::CellDatConstSharedPtr<T> cell_dat_const_ptr)#

Set the underlying NP::CellDatConst pointer for given named data.

Parameters:
  • data_name – Name of the particle dat to be set

  • cell_dat_const_ptr – Shared pointer to NP::CellDatConst<T>

inline void set_cell_data(std::string data_name, std::vector<NP::CellData<T>> &cell_data)#

Sets cell-wise accumulated data from a standard vector of NP::CellData objects.

Parameters:
  • data_name – Name of the particle dat to be set

  • cell_data – Standard vector of NP::CellData objects with data to be assigned

inline void zero_buffer(std::string data_name)#

Zero out the accumulation buffer for a given particle dat.

Parameters:

data_name – Name of the dat whose associated buffer should be zeroed out

inline void zero_all_buffers()#

Zero out all accumulation buffers.

Private Members

std::vector<NP::Sym<T>> dats#
std::map<NP::Sym<T>, std::shared_ptr<NP::CellDatConst<T>>> values#
template<typename T>
struct CellwiseDistributor : public VANTAGE::Reactions::TransformationStrategy#

Transfomation strategy that accumulates distributes values of certain particle dats from provided cell-wise data.

Template Parameters:

T – REAL or INT

Public Functions

CellwiseDistributor() = delete#
inline CellwiseDistributor(NP::ParticleGroupSharedPtr template_group, std::vector<std::string> dat_names)#

Constructor for CellwiseDistributor.

Parameters:
  • template_group – A template particle group used to provide the ParticleDats specified by dat_names for the created CellDatConsts.

  • dat_names – A vector of strings specifying the names of the dats to be distributed cell-wise.

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Distribute the dats registered in this transform.

Parameters:

target_subgroup – Subgroup containing particles among which the dats will be distributed.

inline NP::CellDatConstSharedPtr<T> get_value_pointer(std::string data_name)#

Get the pointer to underlying NP::CellDatConst for given named data.

Parameters:

data_name – Name of the particle dat to be extracted

inline void set_value_pointer(std::string data_name, NP::CellDatConstSharedPtr<T> cell_dat_const_ptr)#

Set the underlying NP::CellDatConst pointer for given named data.

Parameters:
  • data_name – Name of the particle dat to be set

  • cell_dat_const_ptr – Shared pointer to NP::CellDatConst<T>

inline std::vector<NP::CellData<T>> get_cell_data(std::string data_name)#

Extract the cell-wise data as a standard vector of NP::CellData objects.

Parameters:

data_name – Name of the particle dat to be extracted

inline void set_cell_data(std::string data_name, std::vector<NP::CellData<T>> &cell_data)#

Sets cell-wise data from a standard vector of NP::CellData objects.

Parameters:
  • data_name – Name of the particle dat to be set

  • cell_data – Standard vector of NP::CellData objects with data to be assigned

inline void zero_buffer(std::string data_name)#

Zero out the distribution buffer for a given particle dat.

Parameters:

data_name – Name of the dat whose associated buffer should be zeroed out

inline void zero_all_buffers()#

Zero out all buffers.

Private Members

std::vector<NP::Sym<T>> dats#
std::map<NP::Sym<T>, std::shared_ptr<NP::CellDatConst<T>>> values#
std::shared_ptr<NP::LocalArray<INT>> comp_nums#
template<typename ReactionData>
struct CellwiseReactionDataAccumulator : public VANTAGE::Reactions::TransformationStrategy#

Transformation evaluating a ReactionData object and reducing the results cellwise.

Template Parameters:

ReactionData – Type of object whose outputs are to be reduced cellwise (must be derived from ReactionDataBase).

Public Functions

CellwiseReactionDataAccumulator() = delete#
inline CellwiseReactionDataAccumulator(NP::ParticleGroupSharedPtr template_group, ReactionData reaction_data)#

Constructor for CellwiseReactionDataAccumulator.

Parameters:
  • template_group – A template particle group used to provide the CellDatConsts for the dats specified by dat_names.

  • reaction_data – ReactionData whose outputs are to be reduced cellwise

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Accumulate the results of evaluating the stored ReactionData object.

Parameters:

target_subgroup – Subgroup containing particles whose dats should be accumulated

inline NP::CellDatConstSharedPtr<REAL> get_value_pointer()#

Get the pointer to underlying NP::CellDatConst object.

inline void set_value_pointer(NP::CellDatConstSharedPtr<REAL> cell_dat_const_ptr)#

Set the underlying NP::CellDatConst pointer for given named data.

Parameters:

cell_dat_const_ptr – Shared pointer to NP::CellDatConst<REAL>

inline std::vector<NP::CellData<typename ReactionData::ON_DEVICE_OBJ_TYPE::VALUE_TYPE>> get_cell_data()#

Extract the cell-wise accumulated data as a standard vector of NP::CellData objects.

inline void zero_buffer()#

Zero out the accumulation buffer.

Private Members

ReactionData reaction_data#
std::vector<NP::Sym<INT>> required_int_sums#
std::vector<NP::Sym<REAL>> required_real_syms#
std::shared_ptr<NP::CellDatConst<typename ReactionData::ON_DEVICE_OBJ_TYPE::VALUE_TYPE>> values#
template<typename ON_DEVICE_TYPE, size_t dim, size_t input_dim, typename ...DATATYPE>
struct CompositeData : public VANTAGE::Reactions::ReactionDataBase<ON_DEVICE_TYPE, dim, NP::TupleRNG<std::shared_ptr<DATATYPE::RNG_KERNEL_TYPE>...>, input_dim>#
#include <composite_data.hpp>

Composite ReactionData object containing multiple other ReactionData objects.

Template Parameters:
  • ON_DEVICE_TYPE – Type of the on-device object

  • dim – Used to set the size of the array that calc_data returns

  • input_dim – The dimension of the input array

  • DATATYPE – ReactionData derived types contained within this composite object

Subclassed by VANTAGE::Reactions::InterpolateData< output_ndim, interp_ndim, DATATYPE, non_interp_ndim >

Public Functions

inline CompositeData(DATATYPE... data)#

Constructor for CompositeData.

Parameters:

data – Variadic argument with all of the contained ReactionData objects

inline void post_init()#

To be called by derived class constructors to access virtual index_on_device_object() table.

inline virtual void index_on_device_object()#

To be implemented by each derived class in order to handle required property indexing on the on-device object.

inline std::tuple<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>...> get_rng_kernels_children()#
inline ArgumentNameSet<REAL> get_required_real_props_children()#
inline ArgumentNameSet<INT> get_required_int_props_children()#

Getter for the merged set of required integer properties of all of the contained ReactionData objects.

inline virtual void set_required_int_props(const ArgumentNameSet<INT> &props)#

Setter of the required integer properties for all of the contained ReactionData objects.

inline virtual void set_required_real_props(const ArgumentNameSet<REAL> &props)#

Setter of the required REAL properties for all of the contained ReactionData objects.

Protected Attributes

std::tuple<DATATYPE...> data#
template<size_t dim, size_t input_dim, typename VAL_TYPE, typename IN_TYPE, typename ...DATATYPE>
struct CompositeDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<dim, NP::TupleRNG<std::shared_ptr<DATATYPE::RNG_KERNEL_TYPE>...>, input_dim, VAL_TYPE, IN_TYPE>#
#include <composite_data.hpp>

On device composite data base class.

Template Parameters:
  • dim – Used to set the size of the array that calc_data returns

  • input_dim – The dimension of the optional input array (for use in pipelines)

  • VAL_TYPE – Return type of this objects calc_data routine

  • IN_TYPE – Input type of array required by this object (if input_dim >0)

  • DATATYPE – ReactionDataOnDevice variadic parameters whose calc_data is called from this object

Public Functions

CompositeDataOnDevice() = default#
inline CompositeDataOnDevice(DATATYPE... data)#

Constructor for CompositeDataOnDevice.

Parameters:

data – Variadic argument with all of the contained ReactionDataOnDevice objects

Protected Attributes

NP::Tuple::Tuple<DATATYPE...> data#
struct CompositeTransform : public VANTAGE::Reactions::TransformationStrategy#

Transformation Strategy containing multiple other transformations, applied in order of addition.

Public Functions

CompositeTransform() = default#

Default constructor for CompositeTransform.

CompositeTransform(std::vector<std::shared_ptr<TransformationStrategy>> components)#

Constructor for CompositeTransform that allows for initializing the member variable components.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

components – A vector of TransformationStrategy shared pointers. These define the transformations that are to be applied when calling the transform member function.

virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Apply all children of this transform in order of addition.

Parameters:

target_subgroup – Particle subgroup to apply the transform to

void add_transformation(std::shared_ptr<TransformationStrategy> strat)#

Add a transformation to the composite.

Parameters:

strat – TransformationStrategy to be added (will be applied after previously added strategies are added)

Private Members

std::vector<std::shared_ptr<TransformationStrategy>> components#
template<typename ...DATATYPE>
struct ConcatenatorData : public VANTAGE::Reactions::CompositeData<ConcatenatorDataOnDevice<DATATYPE::ON_DEVICE_OBJ_TYPE...>, total_dim<DATATYPE...>(), 0, DATATYPE...>#

Composite ReactionData object constaining multiple other ReactionData objects. On calculation of the data, returns the concatenated (in the template order) results of the contained data objects.

Template Parameters:

DATATYPE – ReactionData derived types contained within this composite object

Public Functions

inline ConcatenatorData(DATATYPE... data)#

Constructor for ConcatenatorData.

Parameters:

data – Variadic argument with all of the contained ReactionData objects

inline virtual void index_on_device_object()#

Reconstruct the composite on-device object (assuming the individual on-device objects have been modified/re-indexed)

template<typename ...DATATYPE>
struct ConcatenatorDataOnDevice : public VANTAGE::Reactions::CompositeDataOnDevice<total_dim<DATATYPE...>(), 0, REAL, REAL, DATATYPE...>#

On device recursive concatenator data - calc_data returns the concatenated result of all contained ReactionDataOnDevice objects.

Template Parameters:

DATATYPE – ReactionDataOnDevice variadic parameters whose calc_data is called from this object

Public Functions

ConcatenatorDataOnDevice() = default#
inline ConcatenatorDataOnDevice(DATATYPE... data)#

Constructor for ConcatenatorDataOnDevice.

Parameters:

data – Variadic argument with all of the contained ReactionDataOnDevice objects

inline std::array<REAL, DIM> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>...>::KernelType &rng_kernel) const#

Function to calculate the concatenated data.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernels used in the calculation, a NP::TupleRNG accessor

Returns:

Concatenated return arrays of all the contained device types

template<std::size_t I>
inline void calc_data_recurse(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>...>::KernelType &rng_kernel, std::array<REAL, DIM> &result, size_t dat_dim_idx) const#

Public Static Attributes

static const size_t DIM = total_dim<DATATYPE...>()#
struct ConstantRateCrossSection : public VANTAGE::Reactions::AbstractCrossSection#

A struct that defines a cross section evaluating to K/v_r where K is a constant rate and v_r is the relative velocity. Leads to always accepting in rejection algorithms weighted by this cross-section.

Public Functions

ConstantRateCrossSection() = default#
inline ConstantRateCrossSection(REAL constant_sigma_v)#

Constructor for ConstantRateCrossSection.

Parameters:

constant_sigma_v – Constant collision rate

inline REAL get_value_at(const REAL &relative_vel) const#

Returns the cross-section value at given relative velocity.

Parameters:

relative_vel – Relative velocity of projectile and target

Returns:

REAL-valued cross-section = K/v_r

inline REAL get_max_rate_val() const#

Returns maximum value of the rate sigma*v of for this cross-section. This is constant in this class.

Returns:

REAL-valued constant (plus floating point error to account for potential use in explicit rejection methods).

inline bool accept_reject(REAL relative_vel, REAL uniform_rand, REAL value_at, REAL max_rate_val) const#

Always accepts the relative velocity, regardless of uniform random number.

Parameters:
  • relative_vel – Relative velocity of projectile and target

  • uniform_rand – Uniformly distributed random number

  • value_at – Cross-section value at a given relative velocity

  • max_rate_val – Maximum value of the rate, sigma*v, for this cross-section.

Returns:

true

Private Members

REAL constant_sigma_v#
template<int ndim_velocity = 2, int ndim_source_momentum = ndim_velocity>
struct CXReactionKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for charge-exchange kernels.

Template Parameters:
  • ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

  • ndim_source_momentum – Optional number of dimensions for source momentum property (default value of ndim_velocity)

Public Functions

inline CXReactionKernels(const Species &target_species, const Species &projectile_species, std::map<int, std::string> properties_map = get_default_map())#

Constructor for CXReactionKernels.

Parameters:
  • target_species – Species object representing the charge exchange target - the ingoing ion and outgoing neutral

  • projectile_species – Species object representing the projectile species - the outgoing ion and ingoing neutral

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline CXReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum> get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.weight, props.velocity}#
static constexpr std::array<int, 3> required_species_real_props = {props.source_density, props.source_energy, props.source_momentum}#
static constexpr std::array<int, 1> required_descendant_simple_int_props = {props.internal_state}#
static constexpr std::array<int, 2> required_descendant_simple_real_props = {props.velocity, props.weight}#

Private Members

CXReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum> cx_reaction_kernels_on_device#
template<int ndim_velocity, int ndim_source_momentum>
struct CXReactionKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<1>#

Device type for charge-exchange kernels.

Template Parameters:
  • ndim_velocity – The number of dimensions for the particle velocity property.

  • ndim_source_momentum – The number of dimensions for source momentum property.

Public Functions

CXReactionKernelsOnDevice() = default#
inline void scattering_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

CX scattering kernel - assumes that pre_req_data stores ion velcocities sampled from the ion distribution and sets the product’s velocity components to those values.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void weight_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

CX weight kernel - simply sets the product’s weight to the weight change due to the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void transformation_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

CX transformation kernel - simply sets the product’s ID the target ID.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

CX feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

Public Members

INT velocity_ind#
INT projectile_source_density_ind#
INT projectile_source_energy_ind#
INT projectile_source_momentum_ind#
INT target_source_density_ind#
INT target_source_momentum_ind#
INT target_source_energy_ind#
INT weight_ind#
INT descendant_internal_state_ind#
INT descendant_velocity_ind#
INT descendant_weight_ind#
REAL target_mass#
REAL projectile_mass#
template<typename ...DATATYPE>
struct DataCalculator : public VANTAGE::Reactions::AbstractDataCalculator#

A static container class for ReactionData objects.

Template Parameters:

DATATYPE – ReactionData types

Public Functions

inline DataCalculator(DATATYPE... data)#

Constructor for DataCalculator.

Parameters:

data – List of ReactionData objects (as multiple arguments).

inline void fill_buffer(const NP::NDLocalArraySharedPtr<REAL, 2> &buffer, NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end)#

Fills an NP::NDLocalArray buffer by invoking the stored ReactionData objects for a given cell index.

Parameters:
  • buffer – NP::NDLocalArray buffer - size should conform to the stored ReactionData tuple size

  • particle_sub_group – Particle subgroup used to fill out the buffer

  • cell_idx_start – Starting cell index for which to invoke the corresponding particle loops

  • cell_idx_end – Ending cell index for which to invoke the corresponding particle loops

inline size_t get_data_size() const#

Getter for the total number of dimensions of the objects in the ReactionData tuple.

inline size_t get_data_tuple_size() const#

Getter of the total number of objects in the ReactionData tuple.

Private Members

std::tuple<DATATYPE...> data#
std::vector<std::vector<NP::Sym<INT>>> data_loop_int_syms#
std::vector<std::vector<NP::Sym<REAL>>> data_loop_real_syms#
template<DownsamplingMode mode, typename REDUCTION_KERNEL_ON_DEVICE, typename DOWNSAMPLING_KERNEL_ON_DEVICE>
struct DownsamplingKernelBase#

Base host type for downsampling kernels, containing the on-device reduction and sampling kernels.

Template Parameters:
  • mode – The downsampling mode of the kernel, determining downstream behaviour (e.g. merging vs thinning etc.)

  • REDUCTION_KERNEL_ON_DEVICE – On device object type responsible for the calculation of the various reduction quantities needed for downsampling algorithms

  • DOWNSAMPLING_KERNEL_ON_DEVICE – On device object type responsible for the application of the downsampling algorithm in conjunction with any calculated reduced quantities

Public Types

using RNG_TYPE = typename DOWNSAMPLING_KERNEL_ON_DEVICE::RNG_KERNEL_TYPE#

Public Functions

inline DownsamplingKernelBase(Properties<INT> required_int_props, Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Base host-side downsampling kernel type constructor.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

inline DownsamplingKernelBase(Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for DownsamplingKernelBase that sets only required real properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

inline std::vector<NP::Sym<INT>> get_required_int_sym_vector()#

Return all required integer properties as a vector of Syms.

inline std::vector<NP::Sym<REAL>> get_required_real_sym_vector()#

Return all required real properties as a vector of Syms.

inline DOWNSAMPLING_KERNEL_ON_DEVICE get_downsampling_kernel_on_device()#
inline REDUCTION_KERNEL_ON_DEVICE get_reduction_kernel_on_device()#
inline virtual void pre_calculate(NP::CellDatConstSharedPtr<REAL> reductions, NP::CellDatConstSharedPtr<INT> pre_num_parts)#

Perform any operations required before the application of the downsampling.

Parameters:
  • reductions – Additive reduction values

  • pre_num_parts – The number of particles per cell

inline std::shared_ptr<RNG_TYPE> get_rng_kernel()#
inline void set_rng_kernel(std::shared_ptr<RNG_TYPE> rng_kernel)#

Public Static Attributes

static const DownsamplingMode DOWNSAMPLING_MODE = mode#
static constexpr size_t DOWNSAMPLING_DIM = DOWNSAMPLING_KERNEL_ON_DEVICE::DOWNSAMPLING_DIM#
static constexpr size_t REDUCTION_PLUS_DIM = REDUCTION_KERNEL_ON_DEVICE::REDUCTION_PLUS_DIM#
static constexpr size_t REDUCTION_MIN_DIM = REDUCTION_KERNEL_ON_DEVICE::REDUCTION_MIN_DIM#
static constexpr size_t REDUCTION_MAX_DIM = REDUCTION_KERNEL_ON_DEVICE::REDUCTION_MAX_DIM#
static constexpr size_t TOTAL_REDUCTION_DIM = REDUCTION_KERNEL_ON_DEVICE::TOTAL_REDUCTION_DIM#

Protected Attributes

std::optional<REDUCTION_KERNEL_ON_DEVICE> reduction_on_device_obj#
std::optional<DOWNSAMPLING_KERNEL_ON_DEVICE> downsampling_on_device_obj#
ArgumentNameSet<INT> required_int_props#
ArgumentNameSet<REAL> required_real_props#
std::map<int, std::string> properties_map#
std::shared_ptr<RNG_TYPE> rng_kernel#
template<size_t downsampling_dim, typename RNG_TYPE = DEFAULT_RNG_KERNEL>
struct DownsamplingKernelOnDeviceBase#

Base on-device downsampling kernel, meant to apply the downsampling transformation on each particle on-device.

Template Parameters:
  • downsampling_dim – The downsampling dimensionality, e.g. post-downsampling number of particles or other measure

  • RNG_TYPE – Type of rng kernel, if needed

Public Types

using RNG_KERNEL_TYPE = RNG_TYPE#

Public Functions

DownsamplingKernelOnDeviceBase() = default#
inline void apply(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Write<REAL> &req_real_props, NP::Access::CellDatConst::Read<REAL> &reduction, NP::Access::CellDatConst::Read<REAL> &reduction_min, NP::Access::CellDatConst::Read<REAL> &reduction_max, const size_t &reduction_idx, const size_t &linear_idx, typename RNG_TYPE::KernelType &rng_kernel) const#

Apply the downsampling algorithm, assuming reduction has happened prior to the application.

Parameters:
  • index – LoopIndex accessor used for linear indexing

  • req_int_props – SymVector Write access to required integer properties

  • req_real_props – SymVector Write access to required real properties

  • reduction – Read access to additive cellwise reduction data

  • reduction_min – Read access to cellwise min reduction data

  • reduction_max – Read access to cellwise max reduction data

  • reduction_idx – Index determining which downsampling/reduction group the particle belongs to, in principle used to access the corresponding column of the reduction data

  • linear_idx – Linear index determining which of the post-downsampling particles the current particle is

  • rng_kernel – RNG kernel, if required

inline void apply_no_red(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Write<REAL> &req_real_props, typename RNG_TYPE::KernelType &rng_kernel) const#

Apply the downsampling algorithm, assuming no reductions are needed.

Parameters:
  • index – LoopIndex accessor used for linear indexing

  • req_int_props – SymVector Write access to required integer properties

  • req_real_props – SymVector Write access to required real properties

  • rng_kernel – RNG kernel, if required

Public Static Attributes

static constexpr size_t DOWNSAMPLING_DIM = downsampling_dim#
template<size_t reduction_plus_dim, size_t reduction_min_dim, size_t reduction_max_dim>
struct DownsamplingReductionKernelOnDeviceBase#

Base on-device reduction kernel, responsible for performing reduction operations on particle data needed in downsampling algorithms.

Template Parameters:
  • reduction_plus_dim – Number of additive reduction quantities

  • reduction_min_dim – Number of max reduction quantities

  • reduction_max_dim – Number of min reduction quantities

Public Functions

DownsamplingReductionKernelOnDeviceBase() = default#
inline void reduce(const NP::Access::SymVector::Read<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, NP::Access::CellDatConst::Add<REAL> &reduction, NP::Access::CellDatConst::Min<REAL> &reduction_min, NP::Access::CellDatConst::Max<REAL> &reduction_max, const size_t &reduction_idx) const#

Calculate the contributions to the various reduction quantities needed for downsampling.

Parameters:
  • req_int_props – SymVector Read access to required integer properties

  • req_real_props – SymVector Read access to required real properties

  • reduction – Add access to additive cellwise reduction data

  • reduction_min – Min access to cellwise min reduction data

  • reduction_max – Max access to cellwise max reduction data

  • reduction_idx – Index determining which downsampling/reduction group the particle belongs to, in principle used to access the corresponding column of the reduction data

Public Static Attributes

static constexpr size_t REDUCTION_PLUS_DIM = reduction_plus_dim#
static constexpr size_t REDUCTION_MIN_DIM = reduction_min_dim#
static constexpr size_t REDUCTION_MAX_DIM = reduction_max_dim#
static constexpr size_t TOTAL_REDUCTION_DIM = reduction_min_dim + reduction_max_dim + reduction_plus_dim#
template<typename DOWNSAMPLING_KERNEL>
struct DownsamplingStrategy : public VANTAGE::Reactions::TransformationStrategy#

Transformation strategy performing downsampling based on the contained downsampling kernels.

Template Parameters:

DOWNSAMPLING_KERNEL – Host-side downsampling kernel type, determining the reduction and downsampling application algorithms

Public Functions

inline DownsamplingStrategy(NP::ParticleGroupSharedPtr template_group, DOWNSAMPLING_KERNEL downsampling_kernels, size_t num_downsampling_groups, const std::map<int, std::string> &properties_map = get_default_map())#

DownsamplingStrategy constructor.

Parameters:
  • template_group – Particle group with the same domain and sycl_target as the group this strategy is to be applied to

  • downsampling_kernels – The kernels containing the reduction and downsampling strategy algorithms

  • num_downsampling_groups – The number of distinct downsampling groups (such as velocity/phase space bins) - determines the dimensionality of the NP::CellDatConst objects storing cell-wise and downsampling group-wise reductions of the properties needed for the downsampling algorithm

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names, in particular the grouping index, linear index, and particle weights

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Perform downsampling on given subgroup.

Parameters:

target_subgroup –

Private Members

NP::Sym<INT> group_index_sym#
NP::Sym<INT> linear_index_sym#
NP::Sym<REAL> weight_sym#
DOWNSAMPLING_KERNEL downsampling_kernels#
NP::CellDatConstSharedPtr<REAL> reduction_cell_dats#
NP::CellDatConstSharedPtr<INT> num_part_cell_dats#
NP::CellDatConstSharedPtr<REAL> min_reduction_cell_dats#
NP::CellDatConstSharedPtr<REAL> max_reduction_cell_dats#
template<typename RateData, typename EnergyRateData, int ndim = 2>
struct ElectronImpactIonisation : public VANTAGE::Reactions::LinearReactionBase<0, RateData, IoniseReactionKernels<2>, DataCalculator<EnergyRateData>>#

A struct defining a reaction representing electron impact ionisation, allowing for separate rate and energy rate calculation.

Template Parameters:
  • RateData – ReactionData template parameter used for the rate calculation

  • EnergyRateData – ReactionData template parameter used for the energy rate calculation,

  • ndim – Optional template parameter defining the ndim_velocity template parameter to use with IoniseReactionKernels

Public Functions

inline ElectronImpactIonisation(NP::SYCLTargetSharedPtr sycl_target, RateData rate_data, EnergyRateData energy_rate_data, Species target_species, Species electron_species, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ElectronImpactIonisation.

Parameters:
  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • rate_data – ReactionData object used to calculate the ionisation rate

  • energy_rate_data – ReactionData object used to calculate the electron energy loss rate

  • target_species – Species object representing the ionisation target (and the corresponding ion fluid)

  • electron_species – Species object corresponding to the electrons

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

template<size_t ncomp>
struct ExtractorData : public VANTAGE::Reactions::ReactionDataBase<ExtractorDataOnDevice<ncomp>, ncomp>#
#include <extractor_data.hpp>

Reaction data used to extract real valued NP::ParticleDat.

Template Parameters:

ncomp – Number of components of the dat to be extracted

Public Functions

inline ExtractorData(const NP::Sym<REAL> &extracted_sym)#

Constructor for ExtractorData.

Parameters:

extracted_sym – The NP::Sym<REAL> corresponding to the NP::ParticleDat whose components should be extracted

inline virtual void index_on_device_object()#

Index the particle weight on the on-device object.

Private Members

NP::Sym<REAL> extracted_sym#
template<size_t ncomp>
struct ExtractorDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<ncomp>#
#include <extractor_data.hpp>

On device: Reaction data that just extracts values of a real particle dat.

Template Parameters:

ncomp – Number of components of the dat to be extracted

Public Functions

ExtractorDataOnDevice() = default#
inline std::array<REAL, ncomp> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice<ncomp>::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to extract particle dat values into an array.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size ncomp containing the extracted data

Public Members

int prop_ind#
template<size_t ndim, typename CROSS_SECTION>
struct FilteredMaxwellianOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<ndim, NP::HostAtomicBlockKernelRNG<REAL>>#

On device: Reaction data class for calculating velocity samples from a filtered Maxwellian distribution given a fluid temperature and flow speed. The sampled distribution is formally sigma(|v-u|)f_M(v), where sigma is a cross-section evaluated at the relative speed |v-u| of the neutrals (v) and ions (u). The filtering is performed using a rejection method.

Template Parameters:
  • ndim – The velocity space dimensionality for both the particles and the fields

  • CROSS_SECTION – The typename corresponding to the cross-section class used

Public Functions

FilteredMaxwellianOnDevice() = default#
inline FilteredMaxwellianOnDevice(const REAL &norm_ratio, CROSS_SECTION cross_section)#

Constructor for FilteredMaxwellianOnDevice.

Parameters:
  • norm_ratio – The ratio of the temperature and kinetic energy normalisations. Specifically kT/mv^2 where m is the mass of the ions, and T and v are the temperature and velocity normalisation constants

  • cross_section – Cross section object to be used in the rejection method sampling

inline std::array<REAL, ndim> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::HostAtomicBlockKernelRNG<REAL>::KernelType &kernel) const#

Function to calculate the sampled ion velocities from a filtered Maxwellian.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel - assumed uniform

Returns:

A REAL-valued array of size ndim that contains the calculated sampled ion velocities.

Public Members

int fluid_temperature_ind#
int fluid_flow_speed_ind#
int velocity_ind#
int panic_ind#
REAL norm_ratio#
CROSS_SECTION cross_section#
template<size_t ndim, typename CROSS_SECTION = ConstantRateCrossSection>
struct FilteredMaxwellianSampler : public VANTAGE::Reactions::ReactionDataBase<FilteredMaxwellianOnDevice<ndim, ConstantRateCrossSection>, ndim, NP::HostAtomicBlockKernelRNG<REAL>>#

Reaction data class for calculating velocity samples from a filtered Maxwellian distribution given a fluid temperature and flow speed. The sampled distribution is formally sigma(|v-u|)f_M(v), where sigma is a cross-section evaluated at the relative speed |v-u| of the neutrals (v) and ions (u). The filtering is performed using a rejection method.

Template Parameters:
  • ndim – The velocity space dimensionality for both the particles and the fields

  • CROSS_SECTION – The typename corresponding to the cross-section class used

Public Functions

inline FilteredMaxwellianSampler(const REAL &norm_ratio, CROSS_SECTION cross_section, std::shared_ptr<NP::HostAtomicBlockKernelRNG<REAL>> rng_kernel, std::map<int, std::string> properties_map = get_default_map())#

Constructor for FilteredMaxwellianSampler.

Parameters:
  • norm_ratio – The ratio of the temperature and kinetic energy normalisations. Specifically kT/mv^2 where m is the mass of the ions, and T and v are the temperature and velocity normalisation constants

  • cross_section – Cross section object to be used in the rejection method sampling

  • rng_kernel – A shared pointer of a NP::HostAtomicBlockKernelRNG<REAL> to be set as the rng_kernel in ReactionDataBase.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

template<typename FUNC = void, std::enable_if_t<std::is_same_v<CROSS_SECTION, ConstantRateCrossSection> && std::is_void_v<FUNC>, int> = 0>
inline FilteredMaxwellianSampler(const REAL &norm_ratio, std::shared_ptr<NP::HostAtomicBlockKernelRNG<REAL>> rng_kernel)#

Constructor which sets default values for the cross_section and properties_map.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • norm_ratio – The ratio of the temperature and kinetic energy normalisations. Specifically kT/mv^2 where m is the mass of the ions, and T and v are the temperature and velocity normalisation constants

  • rng_kernel – A shared pointer of a NP::HostAtomicBlockKernelRNG<REAL> to be set as the rng_kernel in ReactionDataBase.

inline virtual void index_on_device_object()#

Index the fluid temperature, flow speed, particle velocity, and the panic flag on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr auto required_simple_real_props = std::array<int, 3>{props.fluid_temperature, props.fluid_flow_speed, props.velocity}#
static constexpr auto required_simple_int_props = std::array<int, 1>{props.panic}#
template<size_t ndim>
struct FixedArrayData : public VANTAGE::Reactions::ReactionDataBase<FixedArrayDataOnDevice<ndim>, ndim>#

Reaction data returning a fixed array.

Template Parameters:

ndim – The size of the returned array

Public Functions

inline FixedArrayData(const std::array<REAL, ndim> &data)#

Constructor for FixedArrayData.

Parameters:

data – REAL-valued array to always return.

inline virtual void index_on_device_object()#

No-op since there are no required properties to index.

template<size_t ndim>
struct FixedArrayDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<ndim>#

On device: Reaction data calculation returning a fixed array.

Template Parameters:

ndim – The dimension of the returned array

Public Functions

FixedArrayDataOnDevice() = default#
inline FixedArrayDataOnDevice(const std::array<REAL, ndim> &data)#

Constructor for FixedArrayDataOnDevice.

Parameters:

data – REAL-valued array this object will returns.

inline std::array<REAL, ndim> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename DEFAULT_RNG_KERNEL::KernelType &kernel) const#

Returns fixed array.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction data calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction data calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

Fixed REAL-valued array of size ndim.

Private Members

std::array<REAL, ndim> data#
struct FixedCoefficientData : public VANTAGE::Reactions::ReactionDataBase<FixedCoefficientDataOnDevice>#

Reaction rate data calculation for a fixed rate coefficient reaction. The reaction rate is calculated as rate_coefficient*particle_weight.

Public Functions

FixedCoefficientData(REAL rate_coefficient, std::map<int, std::string> properties_map = get_default_map())#

Constructor for FixedCoefficientData.

Parameters:
  • rate_coeff – A real-valued rate coefficient (rate proportional to this and the particle weight)

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

virtual void index_on_device_object()#

Index the particle weight on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 1> required_simple_real_props = {props.weight}#
struct FixedCoefficientDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#

On device: Reaction rate data calculation for a fixed rate coefficient reaction. The reaction rate is calculated as rate_coefficient*particle_weight.

Public Functions

FixedCoefficientDataOnDevice() = default#
inline FixedCoefficientDataOnDevice(REAL rate)#

Constructor for FixedCoefficientDataOnDevice.

Parameters:

rate – REAL-valued rate to be used in reaction rate calculation.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for a fixed rate coefficient reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Public Members

int weight_ind#
REAL rate#
struct FixedRateData : public VANTAGE::Reactions::ReactionDataBase<FixedRateDataOnDevice>#

Reaction rate data calculation for a fixed rate reaction.

Public Functions

FixedRateData(const REAL &rate)#

Constructor for FixedRateData.

Parameters:

rate – REAL-valued rate to be used in reaction rate calculation.

virtual void index_on_device_object()#

No-op since there are no required properties to index.

struct FixedRateDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<>#

On device: Reaction rate data calculation for a fixed rate reaction.

Public Functions

FixedRateDataOnDevice() = default#
inline FixedRateDataOnDevice(const REAL &rate)#

Constructor for FixedRateDataOnDevice.

Parameters:

rate – REAL-valued rate to be used in reaction rate calculation.

inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the reaction rate for a fixed rate reaction.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 1 containing the calculated reaction rate.

Private Members

REAL rate#
template<int ndim_velocity = 2>
struct GeneralAbsorptionKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for general absorption kernels.

Template Parameters:

ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

Public Functions

inline GeneralAbsorptionKernels(const Species &absorbed_species, std::map<int, std::string> properties_map = get_default_map())#

Constructor for GeneralAbsorptionKernels.

Parameters:
  • absorbed_species – Species object corresponding to the absorbed particle

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline GeneralAbsorptionKernelsOnDevice<ndim_velocity> get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 5> required_simple_real_props = {props.weight, props.source_density, props.velocity, props.source_momentum, props.source_energy}#

Private Members

GeneralAbsorptionKernelsOnDevice<ndim_velocity> absorption_kernels_on_device#
template<int ndim_velocity>
struct GeneralAbsorptionKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<0>#

Device type for general absorption kernels.

Template Parameters:

ndim_velocity – The number of dimensions for the particle velocity property.

Public Functions

GeneralAbsorptionKernelsOnDevice() = default#
inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 0> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

General absorption feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data (none expected)

  • dt – The current time step size.

Public Members

INT velocity_ind#
INT source_density_ind#
INT source_momentum_ind#
INT source_energy_ind#
INT weight_ind#
REAL mass#
template<int interp_ndim, int output_ndim = 0>
struct GridDescriptor#

Struct for describing the underlying grid that will be used by either CartesianGridData or TrimEvalData. It generates the grid at construction and it also handles flattening of data relating to interpolation coordinates, interpolation dimensions, trim dimensions, and the nested per-point tables (depending on the value of output_ndim).

When output_ndim = 0, the struct operates in “CartesianGridData” mode where the func that is passed to the constructor is expected to provide a single REAL value and the grid that is calculated has a single value at each grid point.

When output_ndim = 3, the struct operates in “TrimEvalData” mode where the func that is passed is expected to provide a std::array<REAL, (trim_dim0

  • (trim_dim0 * trim_dim1) + (trim_dim0 * trim_dim1 * trim_dim2)> where trim_dim0, trim_dim1, trim_dim2 are the 3 trim dimensions (eg. 5, 5, 5 for EIRENE TRIM data so the size of the function result array would be 155) as an output and subsequently the grid that is calculated will have multiple values per grid point.

Template Parameters:
  • interp_ndim – Number of interpolation dimensions.

  • output_ndim – Number of output dimensions (default is 0).

Public Functions

template<typename FUNC, typename ...Context, std::enable_if_t<(output_ndim == 0) && std::is_same_v<FUNC, FUNC>, int> = 0>
inline GridDescriptor(const std::array<std::vector<REAL>, interp_ndim> &coords_in, const FUNC &func, const Context&... context)#

Construct from interpolation coordinates and a generator function (with optional additional context).

The generator function is called once per interpolation point in row-major order. It must return a REAL value. Each value is appended to the internal flat grid buffer.

Template Parameters:
  • FUNC – Generator callable type.

  • Context – Type names of any additional context data needed for the generator.

Parameters:
  • coords_in – Per-dimension interpolation coordinate vectors.

  • func – Generator callable with signature auto(const std::array<REAL, interp_ndim> &coords, Context… context) returning a REAL value.

  • context – Argument pack with types defined by Context… that may need to be passed to func.

template<typename FUNC, typename ...Context, std::enable_if_t<(output_ndim == 3) && std::is_same_v<FUNC, FUNC>, int> = 0>
inline GridDescriptor(const std::array<std::vector<REAL>, interp_ndim> &coords, const std::array<size_t, output_ndim> &trim_dims_arr, const FUNC &func, const Context&... context)#

Construct from interpolation coordinates, trim dimensions, and a generator function (with optional additional context).

The generator function is called once per interpolation point in row-major order. It must return a REAL std::array/std::vector of size (trim_dim0

  • (trim_dim0 * trim_dim1) + (trim_dim0 * trim_dim1 * trim_dim2)) . Each array/vector is appended to the flat grid buffer.

Template Parameters:
  • FUNC – Generator callable type.

  • Context – Type names of any additional context data needed for the generator.

Parameters:
  • coords – Per-dimension interpolation coordinate vectors.

  • trim_dims_arr – TRIM grid dimensions per output axis.

  • func – Generator callable with signature auto(const std::array<REAL, interp_ndim> &coords, Context… context) returning a REAL std::array

  • context – Argument pack with types defined by Context… that may need to be passed to func.

inline const std::vector<REAL> &get_flat_coords() const#

Return the flattened vector of all of the coordinates for each dimension of the grid.

inline const std::vector<size_t> &get_interp_dims() const#

Return the vector containing the sizes of each dimension of the grid.

inline const std::vector<size_t> &get_output_dims() const#

Return the vector containing the per-interpolation point output dimensions. (Disabled if output_ndim != 3)

inline const std::vector<REAL> &get_flat_grid() const#

Return the flat grid data vector.

Private Functions

inline void flatten_coords()#

Flatten the per-dimension interpolation coordinate vectors into a single contiguous vector.

inline void flatten_interp_dims()#

Fills the interp_dims vector.

inline void flatten_output_dims()#

Fills the output dimensions vector. (Disabled if output_ndim != 3)

Private Members

std::array<std::vector<REAL>, interp_ndim> coords#

Array containing vectors that define coordinates for each dimension of the grid.

std::vector<REAL> flat_coords#

Vector containing the contiguous per-dimension coordinates

std::vector<size_t> interp_dims_vec#

Vector containing the size of each interpolation dimension for the grid.

std::array<size_t, output_ndim> output_dims#

Array containing the size of each output dimension for tables at each interpolation point (eg. {5, 5, 5} for EIRENE-style TRIM tables).

std::vector<size_t> output_dims_vec#
std::vector<REAL> grid#

Vector containing the flat grid.

template<size_t output_ndim, size_t interp_ndim, typename DATATYPE, size_t non_interp_ndim = 0>
struct InterpolateData : public VANTAGE::Reactions::CompositeData<InterpolateDataOnDevice<output_ndim, interp_ndim, 0, DATATYPE::ON_DEVICE_OBJ_TYPE>, output_ndim, interp_ndim + 0, DATATYPE>#

ReactionData calculating an interpolated function evaluation given a set of interpolation points and a ReactionDataBase derived object.

The input vector contains both the interpolation points and the pass-through values. The interpolation points are selected using interp_indices. The remaining entries in the input vector are passed through unchanged to the underlying reaction data object.

Template Parameters:
  • output_ndim – The number of dimensions that correspond to the output of calc_data from DATATYPE.

  • interp_ndim – The number of dimensions that correspond to the number of interpolation points.

  • DATATYPE – ReactionDataBase derived type corresponding to the grid-function evaluation reaction data object.

  • non_interp_ndim – The number of dimensions that are not interpolated and are used by calc_data from DATATYPE. (default is 0)

Public Functions

inline InterpolateData(const std::vector<size_t> &dims_vec, const std::vector<REAL> &coords_vec, const std::array<size_t, interp_ndim> &interp_indices, NP::SYCLTargetSharedPtr sycl_target, const DATATYPE &interp_data, const ExtrapolationType &extrapolation_type)#

Constructor for InterpolateData.

Parameters:
  • dims_vec – A vector containing the lengths of each dimension that defines the grid of pre-computed values.

  • coords_vec – A vector that contains the coordinate values for each axis that defines the grid of pre-computed values. The values in coords_vec can be thought of as a set of concatenated arrays where each segment’s length within the 1D coords_vec is defined in dims_vec.

  • interp_indices – An array of indices that correspond to the indices of the full input array that will be passed to calc_data that are to be interpolated.

  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • interp_data – ReactionDataBase derived object corresponding to the grid-function evaluation reaction data object.

  • extrapolation_type – The extrapolation type to fall back on if interpolation is not possible for a set of points. Either continue_linear, clamp_to_zero or clamp_to_edge.

inline InterpolateData(const std::vector<size_t> &dims_vec, const std::vector<REAL> &coords_vec, const std::array<size_t, interp_ndim> &interp_indices, NP::SYCLTargetSharedPtr sycl_target, const DATATYPE &interp_data)#

Constructor for InterpolateData that takes the usual arguments but without extrapolation_type (set to continue_linear)

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • dims_vec – A vector containing the lengths of each dimension that defines the grid of pre-computed values.

  • coords_vec – A vector that contains the coordinate values for each axis that defines the grid of pre-computed values. The values in coords_vec can be thought of as a set of concatenated arrays where each segment’s length within the 1D coords_vec is defined in dims_vec.

  • interp_indices – An array of indices that correspond to the indices of the full input array that will be passed to calc_data that are to be interpolated.

  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • interp_data – ReactionDataBase derived object corresponding to the grid-function evaluation reaction data object.

inline InterpolateData(const std::vector<size_t> &dims_vec, const std::vector<REAL> &coords_vec, NP::SYCLTargetSharedPtr sycl_target, const DATATYPE &interp_data)#

Constructor for InterpolateData that takes the usual arguments but without interp_indices (set to an array with values from 0 to inter_ndim, ie. all dimensions are to be interpolated) and extrapolation_type (set to continue_linear).

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • dims_vec – A vector containing the lengths of each dimension that defines the grid of pre-computed values.

  • coords_vec – A vector that contains the coordinate values for each axis that defines the grid of pre-computed values. The values in coords_vec can be thought of as a set of concatenated arrays where each segment’s length within the 1D coords_vec is defined in dims_vec.

  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • interp_data – ReactionDataBase derived object corresponding to the grid-function evaluation reaction data object.

inline InterpolateData(const std::vector<size_t> &dims_vec, const std::vector<REAL> &coords_vec, NP::SYCLTargetSharedPtr sycl_target, const DATATYPE &interp_data, const ExtrapolationType &extrapolation_type)#

Constructor for InterpolateData that takes the usual arguments but without interp_indices (set to an array with values from 0 to inter_ndim, ie. all dimensions are to be interpolated).

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • dims_vec – A vector containing the lengths of each dimension that defines the grid of pre-computed values.

  • coords_vec – A vector that contains the coordinate values for each axis that defines the grid of pre-computed values. The values in coords_vec can be thought of as a set of concatenated arrays where each segment’s length within the 1D coords_vec is defined in dims_vec.

  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • interp_data – ReactionDataBase derived object corresponding to the grid-function evaluation reaction data object.

  • extrapolation_type – The extrapolation type to fall back on if interpolation is not possible for a set of points. Either continue_linear, clamp_to_zero or clamp_to_edge.

inline virtual void index_on_device_object() override#

To be implemented by each derived class in order to handle required property indexing on the on-device object.

Public Members

NP::SYCLTargetSharedPtr sycl_target#
std::vector<size_t> dims_vec#
std::vector<REAL> coords_vec#
std::array<size_t, interp_ndim> interp_indices#
ExtrapolationType extrapolation_type#
std::shared_ptr<NP::BufferDevice<size_t>> d_dims_vec#
std::shared_ptr<NP::BufferDevice<REAL>> d_coords_vec#
std::shared_ptr<NP::BufferDevice<REAL>> d_extended_coords_vec#
std::shared_ptr<NP::BufferDevice<size_t>> d_extended_dims_vec#
std::shared_ptr<NP::BufferDevice<size_t>> d_coords_strides#
std::shared_ptr<NP::BufferDevice<size_t>> d_extended_coords_strides#
std::shared_ptr<NP::BufferDevice<size_t>> d_hypercube_vertices#
template<size_t output_ndim, size_t interp_ndim, size_t non_interp_ndim, typename DATATYPE>
struct InterpolateDataOnDevice : public VANTAGE::Reactions::CompositeDataOnDevice<output_ndim, interp_ndim + non_interp_ndim, REAL, REAL, DATATYPE>#

On device: ReactionData calculating an interpolated function evaluation given a set of interpolation points and a ReactionDataBaseOnDevice derived object.

Template Parameters:
  • output_ndim – The number of dimensions that correspond to the output of calc_data from DATATYPE.

  • interp_ndim – The number of dimensions that correspond to the number of interpolation points.

  • non_interp_ndim – The number of dimensions that are not interpolated and are used by calc_data from DATATYPE.

  • DATATYPE – ReactionDataBaseOnDevice derived type corresponding to the on-device grid-function evaluation reaction data object.

Public Functions

InterpolateDataOnDevice() = default#
inline InterpolateDataOnDevice(DATATYPE interp_data, const std::array<size_t, interp_ndim> &interp_indices, ExtrapolationType extrapolation_type = ExtrapolationType::continue_linear)#

Constructor for InterpolateDataOnDevice.

Parameters:
  • interp_data – ReactionDataBaseOnDevice derived object corresponding to the grid-function evaluation reaction data.

  • interp_indices – Indices that correspond to interpolation dimensions of the full input array that will be passed to calc_data.

  • extrapolation_type – The extrapolation type to fall back on if interpolation is not possible for a set of points.

inline std::array<REAL, output_ndim> calc_data(const std::array<REAL, interp_ndim + non_interp_ndim> &input_array, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>>::KernelType &kernel) const#

Function to calculate interpolated function evaluations.

Parameters:
  • input_array – An array containing all of the values needed for grid-function evaluation. (Both the interpolation points as well as pass-through values)

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation (the kernel type is inherited from the kernel type for DATATYPE)

Returns:

A REAL-valued array of size output_ndim that contains the interpolated function evaluation at the given interpolation points.

Public Members

size_t const *d_hypercube_vertices_ptr#
size_t const *d_dims_vec_ptr#
REAL const *d_coords_vec_ptr#
REAL const *d_extended_coords_vec_ptr#
size_t const *d_extended_dims_vec_ptr#
size_t const *d_coords_strides_ptr#
size_t const *d_extended_coords_strides_ptr#
std::array<size_t, interp_ndim> interp_indices#
std::array<size_t, non_interp_ndim> non_interp_indices#
bool continue_linear = false#
bool clamp_to_zero = false#
bool clamp_to_edge = false#

Public Static Attributes

static constexpr size_t initial_num_points = 1 << interp_ndim#
static constexpr size_t total_ndim = interp_ndim + non_interp_ndim#
template<int ndim_velocity = 2, int ndim_source_momentum = ndim_velocity, bool has_momentum_req_data = false>
struct IoniseReactionKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for ionisation kernels.

Template Parameters:
  • ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

  • ndim_source_momentum – Optional number of dimensions for electron source momentum property (default value of ndim_veloctiy)

  • has_momentum_req_data – Optional boolean specifying whether a projectile momentum req_data is available (default value of false)

Public Functions

inline IoniseReactionKernels(const Species &target_species, const Species &electron_species, const Species &projectile_species, std::map<int, std::string> properties_map = get_default_map())#

Constructor for IonisationReactionKernels.

Parameters:
  • target_species – Species object representing the ionisation target (and the corresponding ion field!)

  • electron_species – Species object representing the electrons

  • projectile_species – Species object representing the projectile species

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline IoniseReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum, has_momentum_req_data> get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.weight, props.velocity}#
static constexpr std::array<int, 3> required_species_real_props = {props.source_density, props.source_energy, props.source_momentum}#

Private Members

IoniseReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum, has_momentum_req_data> ionise_reaction_kernels_on_device#
template<int ndim_velocity, int ndim_source_momentum, bool has_momentum_req_data>
struct IoniseReactionKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<0>#

Device type for ionisation kernels.

Template Parameters:
  • ndim_velocity – The number of dimensions for the particle velocity property.

  • ndim_source_momentum – The number of dimensions for electron source momentum property.

  • has_momentum_req_data – The boolean specifying whether a projectile momentum req_data is available.

Public Functions

IoniseReactionKernelsOnDevice() = default#
inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 0> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

Public Members

INT velocity_ind#
INT electron_source_density_ind#
INT projectile_source_energy_ind#
INT projectile_source_momentum_ind#
INT target_source_density_ind#
INT target_source_momentum_ind#
INT target_source_energy_ind#
INT weight_ind#
REAL target_mass#
template<typename T>
struct is_std_array_of_real : public std::false_type#

Type trait to check if a type is a std::array of REAL.

Primary template: yields std::false_type for all other types.

Template Parameters:

T – Type to check.

template<std::size_t N>
struct is_std_array_of_real : public std::true_type#

Partial specialization for std::array<REAL, N>.

Yields std::true_type when std::array of REAL values is inferred implicitly.

Template Parameters:

N – Number of elements in the array.

template<class F, size_t DIM = 1>
struct LambdaWrapper#
#include <utils.hpp>

Wrapper class to provide default constructible lambdas for templating device types that need them.

Template Parameters:
  • F – Class of wrapped function

  • DIM – The size of the output array of the wrapped function.

Public Functions

LambdaWrapper() = default#
inline explicit LambdaWrapper(F &f)#

Constructor for LambdaWrapper.

Parameters:

f – The lambda function to wrap.

inline const F &get() const#
template<class ...Args>
inline auto operator()(Args&... args) const -> decltype(std::declval<const F&>()(std::forward<Args>(args)...))#

Overload of the call operator.

Parameters:

args – Arguments to pass to the wrapped lambda function.

Public Static Attributes

static const size_t OUTPUT_DIM = DIM#

Private Members

unsigned char buf[sizeof(F)]#
template<int num_products_per_parent, typename ReactionData, typename ReactionKernels, typename DataCalc = DataCalculator<>>
struct LinearReactionBase : public VANTAGE::Reactions::LinearReactionBaseImpl<num_products_per_parent, ReactionData, ReactionKernels>#
#include <reaction_base.hpp>

Base linear reaction type. Specifically meant for reactions that only involve a single particle at the start of the reaction.

Template Parameters:
  • num_products_per_parent – The number of products produced per parent by the derived linear reaction.

  • ReactionData – typename for reaction_data constructor argument

  • ReactionKernels – template class for reaction_kernels constructor argument

  • DataCalc – typename for the DataCalculator object used to calculate prerequisite data (defaults to DataCalculator<>)

Subclassed by VANTAGE::Reactions::ElectronImpactIonisation< RateData, EnergyRateData, ndim >

Public Functions

inline LinearReactionBase(NP::SYCLTargetSharedPtr sycl_target, int in_state, std::array<int, num_products_per_parent> out_states, ReactionData reaction_data, ReactionKernels reaction_kernels, DataCalc data_calculator, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for LinearReactionBase.

Parameters:
  • sycl_target – Compute device used by the instance.

  • in_state – Integer specifying the ID of the species on which the derived reaction is acting on.

  • out_states – Array of integers specifying the species IDs of the descendants produced by the derived reaction.

  • reaction_data – ReactionData object defining the reaction rate (used in calculate_rates)

  • reaction_kernels – ReactionKernels object defining the properties of the products and the feedback on the parent particle and fields (used in apply)

  • data_calculator – DataCalculator object defining any additional required data for the kernels, in addition to the rate

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (weight and total_reaction_rate).

template<typename U = DataCalc, std::enable_if_t<std::is_default_constructible_v<U>, int> = 0>
inline LinearReactionBase(NP::SYCLTargetSharedPtr sycl_target, int in_state, std::array<int, num_products_per_parent> out_states, ReactionData reaction_data, ReactionKernels reaction_kernels, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor with no explicit DataCalculator.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • sycl_target – Compute device used by the instance.

  • in_state – Integer specifying the ID of the species on which the derived reaction is acting on.

  • out_states – Array of integers specifying the species IDs of the descendants produced by the derived reaction.

  • reaction_data – ReactionData object defining the reaction rate (used in calculate_rates)

  • reaction_kernels – ReactionKernels object defining the properties of the products and the feedback on the parent particle and fields (used in apply)

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (weight and total_reaction_rate).

inline virtual void fill_pre_req_data(NP::NDLocalArraySharedPtr<REAL, 2> &pre_req_data, NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end) override#

Function to fill pre_req_data.

Parameters:
  • pre_req_data – NP::NDLocalArraySharedPtr<REAL, 2> object to contain pre calculated data needed for reaction_kernels.

  • particle_sub_group – Shared pointer of a ParticleSubGroup to apply the ReactionData objects in data_calculator to.

  • cell_idx_start – The id of the first cell over which to run the NP::ParticleLoop in data_calculator.

  • cell_idx_end – The cell id up to which to run the loop in data_calculator.

Private Members

DataCalc data_calculator#
template<int num_products_per_parent, typename ReactionData, typename ReactionKernels>
struct LinearReactionBaseImpl : public VANTAGE::Reactions::AbstractReaction#
#include <reaction_base.hpp>

Non-template implementation base for linear reaction type. Specifically meant for reactions that only involve a single particle at the start of the reaction. A thinner implementation version of LinearReactionBase (Open-ended DataCalculator template parameter is omitted here.)

Template Parameters:
  • num_products_per_parent – The number of products produced per parent by the derived linear reaction.

  • ReactionData – typename for reaction_data constructor argument

  • ReactionKernels – template class for reaction_kernels constructor argument

Subclassed by VANTAGE::Reactions::LinearReactionBase< 0, RateData, IoniseReactionKernels< 2 >, DataCalculator< EnergyRateData > >, VANTAGE::Reactions::LinearReactionBase< 1, RateData, RecombReactionKernels< ndim >, DataCalcType >, VANTAGE::Reactions::LinearReactionBase< num_products_per_parent, ReactionData, ReactionKernels, DataCalc >

Public Functions

inline LinearReactionBaseImpl(NP::SYCLTargetSharedPtr sycl_target, int in_state, std::array<int, num_products_per_parent> out_states, ReactionData reaction_data, ReactionKernels reaction_kernels, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for LinearReactionBaseImpl.

Parameters:
  • sycl_target – Compute device used by the instance.

  • in_state – Integer specifying the ID of the species on which the derived reaction is acting on.

  • out_states – Array of integers specifying the species IDs of the descendants produced by the derived reaction.

  • reaction_data – ReactionData object defining the reaction rate (used in calculate_rates)

  • reaction_kernels – ReactionKernels object defining the properties of the products and the feedback on the parent particle and fields (used in apply)

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (weight and total_reaction_rate).

inline virtual void calculate_rates_v(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end) override#

Calculates the reaction rates for all particles in the given particle sub group and cell cell block. Stores the total rate for all particles within a property assigned to each particle (all particles know the total reaction rate) and stores the rate for each particle within a buffer.

Parameters:
  • particle_sub_group – A NP::ParticleSubGroupSharedPtr that contains particles with the relevant species ID out of the full NP::ParticleGroup

  • cell_idx_start – The id of the first cell over which to run the principle NP::ParticleLoop to calculate reaction rates.

  • cell_idx_end – The cell id up to which to run the rate loop over

inline virtual void apply_v(NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end, double dt, NP::ParticleGroupSharedPtr child_group, bool full_weight = false) override#

Creates and processes any descendant products from the reaction and modifies the appropriate background fields and/or parent particle properties based on a weight modification calculation that utilises results from calculate_rates(…)

Parameters:
  • particle_sub_group – NP::ParticleSubGroupSharedPtr that contains particles with the relevant species ID out of the full NP::ParticleGroup

  • cell_idx_start – The id of the first cell over which to run the principle NP::ParticleLoop to determine the effect of reactions.

  • cell_idx_end – The cell id up to which to run the product loop over

  • dt – The current time step size.

  • child_group – NP::ParticleGroupSharedPtr that contains a particle group into which descendants are placed after generation.

  • full_weight – If true, will consume the full weight of the particles, regardless of timestep

inline virtual void flush_buffer(size_t buffer_size) override#

Creates an empty rate buffer of a specified size.

Parameters:

buffer_size – Size of the empty buffer that needs to be created and stored.

inline virtual void flush_weight_buffer(size_t buffer_size) override#

Creates an empty weight buffer of a specified size.

Parameters:

buffer_size – Size of the empty buffer that needs to be created and stored.

inline void blockwise_flush_buffer(NP::ParticleSubGroupSharedPtr particle_sub_group, int cell_idx_start, int cell_idx_end)#

Flushes the rate and weight buffers blockwise, allocating extra memory if necessary.

Parameters:
  • particle_sub_group – Particle subgroup used to infer the number of particles in the cell

  • cell_idx_start – Index of the first cell for which the buffer flush is performed

  • cell_idx_end – Loop end index - cell up to which the buffer is flushed

inline virtual void flush_pre_req_data() override#

Flushes the stored pre_req_data by setting all values to 0.0.

inline void flush_pre_req_data(size_t buffer_size)#

Creates an empty pre_req_data buffer of a specified size, keeping the current number of columns.

Parameters:

buffer_size – Number of the empty buffer rows that need to be created and stored.

inline void blockwise_flush_pre_req_data(NP::ParticleSubGroupSharedPtr particle_sub_group, int cell_idx_start, int cell_idx_end)#

Flushes the pre_req_data buffer blockwise, allocating extra memory if necessary.

Parameters:
  • particle_sub_group – Particle subgroup used to infer the number of particles in the cell

  • cell_idx_start – Index of the first cell for which the buffer flush is performed

  • cell_idx_end – Loop end index - cell up to which the buffer is flushed

inline virtual std::vector<int> get_in_states() override#

Getter for in_states that define which species the reaction is to be applied to.

Returns:

std::vector<int> Integer vector of species IDs.

inline virtual std::vector<int> get_out_states() override#

Getter for out_states that define which species the reaction is to produce.

Returns:

std::vector<int> Integer vector of species IDs.

virtual void fill_pre_req_data(NP::NDLocalArraySharedPtr<REAL, 2> &pre_req_data, NP::ParticleSubGroupSharedPtr particle_sub_group, INT cell_idx_start, INT cell_idx_end) = 0#
virtual ~LinearReactionBaseImpl() = default#

Protected Attributes

int in_state#
std::array<int, num_products_per_parent> out_states#
ReactionData reaction_data#
ReactionKernels reaction_kernels#
std::shared_ptr<NP::DescendantProducts> descendant_particles#
std::vector<NP::Sym<INT>> calculate_rates_int_syms#
std::vector<NP::Sym<REAL>> calculate_rates_real_syms#
std::vector<NP::Sym<INT>> apply_int_syms#
std::vector<NP::Sym<REAL>> apply_real_syms#
template<int ndim_velocity = 2, bool with_sources = true>
struct LinearScatteringKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for linear scattering kernels - general kernels with post-collision velocities defined by data calculator outputs.

Template Parameters:
  • ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

  • with_sources – If true will track sources (defaults to true)

Public Functions

inline LinearScatteringKernels(const Species &scattered_species, std::map<int, std::string> properties_map = get_default_map())#

Constructor for LinearScatteringKernels.

Parameters:
  • scattered_species – Species object corresponding to the scattered particle

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline LinearScatteringKernelsOnDevice<ndim_velocity, with_sources> get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props_with_sources = {props.source_momentum, props.source_energy}#
static constexpr std::array<int, 2> required_simple_real_props = {props.weight, props.velocity}#
static constexpr std::array<int, 1> required_descendant_simple_int_props = {props.internal_state}#
static constexpr std::array<int, 2> required_descendant_simple_real_props = {props.velocity, props.weight}#

Private Members

LinearScatteringKernelsOnDevice<ndim_velocity, with_sources> linear_scattering_kernels_on_device#
template<int ndim_velocity, bool with_sources>
struct LinearScatteringKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<1>#

Device type for general linear scattering kernels.

Template Parameters:
  • ndim_velocity – The number of dimensions for the particle velocity property.

  • with_sources – If true will attempt to write to source properties (defaults to true)

Public Functions

LinearScatteringKernelsOnDevice() = default#
inline void scattering_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

General scattering kernel - assumes that pre_req_data stores ion velcocities sampled from the ion distribution and sets the product’s velocity components to those values.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void weight_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Linear scattering weight kernel - simply sets the product’s weight to the weight change due to the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void transformation_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Linear scattering transformation kernel - simply sets the product’s ID the target ID.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Linear scattering feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

Public Members

INT velocity_ind#
INT source_momentum_ind#
INT source_energy_ind#
INT weight_ind#
INT descendant_internal_state_ind#
INT descendant_velocity_ind#
INT descendant_weight_ind#
REAL mass#
template<typename MarkingFunctionWrapperDerived>
struct MarkingFunctionWrapperBase#

Device type associated with classes derived from MarkingStrategyBase. Classes derived from this and other device types should never be constructable outside of their corresponding host type.

Template Parameters:

MarkingFunctionWrapperDerived – CRTP template argument

Public Functions

MarkingFunctionWrapperBase() = default#
inline bool marking_condition(NP::Access::SymVector::Read<REAL> &real_vars, NP::Access::SymVector::Read<INT> &int_vars) const#

Marking condition applied particle-by-particle. To be overriden by the derived function following SYCL CRTP.

Parameters:
  • real_vars – Read-only accessor to a list of real-valued ParticleDats. Use real_vars.at(v_idx,c_idx) to access the c_idx-th component of v_idx-th NP::ParticleDat in the list

  • int_vars – Accessor to a list of integer-valued ParticleDats. Use int_vars.at(v_idx,c_idx) to access the c_idx-th component of v_idx-th NP::ParticleDat in the list

Returns:

bool The return value of the marking_condition function on the derived type.

struct MarkingStrategy : public VANTAGE::Reactions::ProfilingBase#

Abstract base class for marking strategies. All marking strategies produce a NP::ParticleSubGroupSharedPtr from another NP::ParticleSubGroupSharedPtr using some selection criterion.

Subclassed by VANTAGE::Reactions::MarkingStrategyBase< MarkingStrategyDerived >, VANTAGE::Reactions::MarkingStrategyDirect< KERNEL, ARGS >, VANTAGE::Reactions::MinimumNPartInCellMarker, VANTAGE::Reactions::PanickedParticleMarker

Public Functions

virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup_v(NP::ParticleSubGroupSharedPtr particle_group)#

Create the marker sub group.

Parameters:

particle_group – Parent NP::ParticleSubGroup to create marker sub group from.

Returns:

Marker sub group.

virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup(NP::ParticleSubGroupSharedPtr particle_group)#

Create the marker sub group. Specialisations should override make_marker_subgroup_v instead of this method.

Parameters:

particle_group – Parent NP::ParticleSubGroup to create marker sub group from.

Returns:

Marker sub group.

virtual ~MarkingStrategy() = default#
template<typename MarkingStrategyDerived>
struct MarkingStrategyBase : public VANTAGE::Reactions::MarkingStrategy#

SYCL CRTP base marking strategy host type. Each derived type should be paired with a device type derived from MarkingFunctionWrapperBase which contains only device copyable types.

Template Parameters:

MarkingStrategyDerived – CRTP template argument

Public Functions

MarkingStrategyBase() = default#
inline MarkingStrategyBase(const std::vector<NP::Sym<REAL>> required_dats_real_read, const std::vector<NP::Sym<INT>> required_dats_int_read)#

Constructor for MarkingStrategyBase.

Parameters:
  • required_dats_real_read – Standard vector of NP::Sym<REAL>s representing those real-valued NESO-Particles ParticleDats to be passed to device type for determining marking function return

  • required_dats_int_read – Standard vector of NP::Sym<INT>s representing those integer-valued NESO-Particles ParticleDats to be passed to device type for determining marking function return

inline virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup_v(NP::ParticleSubGroupSharedPtr particle_sub_group) override#

Create the marker sub group.

Parameters:

particle_group – Parent NP::ParticleSubGroup to create marker sub group from.

Returns:

Marker sub group.

Private Members

std::vector<NP::Sym<REAL>> required_particle_dats_real#

vector of symbols associated with real-valued read-only ParticleDats needed to determine which particles get marked

std::vector<NP::Sym<INT>> required_particle_dats_int#

vector of symbols associated with integer-valued read-only ParticleDats needed to determine which particles get marked

template<typename KERNEL, typename ...ARGS>
struct MarkingStrategyDirect : public VANTAGE::Reactions::MarkingStrategy#

Direct marking strategy, providing an escape hatch to the NESO-Particles subgroup constructor interface, and acting as a closure in everything other than the iteration set.

Template Parameters:
  • KERNEL – The NESO-Particle subgroup construction lambda kernel, should return a bool

  • ARGS – Variadic arguments for the NESO-Particle kernel (access descriptors)

Public Functions

MarkingStrategyDirect() = default#
inline MarkingStrategyDirect(const std::string &name, KERNEL &&kernel, ARGS&&... args)#

Constructor for the direct marking strategy.

Parameters:
  • name – Name of the marking strategy (for profiling)

  • kernel – Body of the NESO-Particles marking function

  • args – Accessor arguments for the NP marking function

inline virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup_v(NP::ParticleSubGroupSharedPtr target) override#

Create the marker sub group.

Parameters:

particle_group – Parent NP::ParticleSubGroup to create marker sub group from.

Returns:

Marker sub group.

inline virtual std::string get_profiling_name() override#
Returns:

A name of the class that is being profiled. Override for a better name.

Private Members

std::string name#
std::tuple<ARGS...> stored_args#
KERNEL kernel#
template<int ndim>
struct MergeTransformationStrategy : public VANTAGE::Reactions::TransformationStrategy#

Implementation of simplified merging algorithm from M. Vranic et al. Computer Physics Communications 191 2015.

The assumption is that all particles being merged are of the same species, i.e. have the same mass and that they are non-relativistic.

Instead of merging cell-wise in momentum space, the entire space is treated as one cell. In 3D the bounding box of the subgroup in momentum space is used to compute the plane in which the momenta of the merged particles will lie.

Particles are merged cell-wise into 2 particles. The properties modified are the positions, weights, and momenta/velocities. Other properties are sampled from 2 other particles in the passed subgroup, i.e. things like cell or particle ids will be copied consistently, but there is no reduction of other real quantities. This means that those values will be lost, so this algorithm should be called only AFTER they are no longer needed.

Template Parameters:

ndim – dimension parameter - 2 and 3 supported

Public Functions

inline MergeTransformationStrategy(const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for MergeTransformationStrategy.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used to remap the syms for the position, weight and velocity properties.

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Perform merging on given subgroup. Will remove the subgroup and add 2 particles per cell.

Parameters:

target_subgroup –

Private Members

NP::Sym<REAL> position#
NP::Sym<REAL> weight#
NP::Sym<REAL> momentum#
struct MinimumNPartInCellMarker : public VANTAGE::Reactions::MarkingStrategy#
#include <common_markers.hpp>

Marking strategy that selects only those particles in cells containing some minimum number of particles.

Public Functions

MinimumNPartInCellMarker() = delete#
MinimumNPartInCellMarker(INT min_npart)#

Constructor for MinimumNPartInCellMarker.

Parameters:

min_npart – Minimum number of particles in a cell.

virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup_v(NP::ParticleSubGroupSharedPtr particle_group)#

Helper function to construct a particle sub group that’s generated via application of a marking strategy that selects only those particles in cells containing min_npart particles.

Parameters:

particle_group – The particle group to apply the marking strategy to.

Returns:

A shared pointer of a ParticleSubGroup that contains the selected particles.

Private Members

INT min_npart#
struct NoOpTransformationStrategy : public VANTAGE::Reactions::TransformationStrategy#

No operations transformation strategy.

Public Functions

NoOpTransformationStrategy() = default#
struct OneWayMaxwellianFluxOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<3, NP::HostAtomicBlockKernelRNG<REAL>>#

On device: Reaction data class for calculating velocity samples from a one way / truncated Maxwellian distribution given a fluid temperature and flow speed. The one way / truncated distribution is generated using a rejection sampling method outlined in https://doi.org/10.1088/0031-8949/90/1/015204.

Public Functions

OneWayMaxwellianFluxOnDevice() = default#
inline OneWayMaxwellianFluxOnDevice(const REAL &norm_ratio)#

Constructor for OneWayMaxwellianFluxOnDevice.

Parameters:

norm_ratio – The ratio of the temperature and kinetic energy normalisations. Specifically kT/mv^2 where m is the mass of the ions, and T and v are the temperature and velocity normalisation constants.

inline REAL sample_positive_maxwellian(REAL drift, REAL thermal_sigma, const NP::Access::LoopIndex::Read &index, typename NP::HostAtomicBlockKernelRNG<REAL>::KernelType &kernel, int &sample_counter, bool &is_kernel_valid) const#

Samples a single value from a positive Maxwellian.

Parameters:
  • drift – Drift velocity due to fluid flow speed in the basis_pi direction.

  • thermal_sigma – Thermal velocity (derived from fluid temperature).

  • index – Read-only accessor to a loop index (used by kernel.at()).

  • kernel – The random number generator kernel.

  • sample_counter – Marker used to select which component of the kernel to access in kernel.at().

  • is_kernel_valid – Boolean that stores the validity of the kernel as returned by kernel.at(). If this is false then a value of 0.0 is returned.

Returns:

The sampled velocity value.

inline std::array<REAL, 3> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::HostAtomicBlockKernelRNG<REAL>::KernelType &kernel) const#

Function to calculate the sampled ion velocities from a one way / truncated Maxwellian.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel

Returns:

A REAL-valued array of size 3 that contains the calculated sampled ion velocities.

Public Members

int fluid_flow_speed_ind#
int fluid_temperature_ind#
int basis_e1_ind#
int basis_e2_ind#
int basis_pi_ind#
int panic_ind#
REAL norm_ratio#

Public Static Functions

static inline REAL cardano_cubic_solver(REAL d)#

Solves the cubic equation used to find the maximum of the rejection sampling function for the one way / truncated maxwellian distribution.

Parameters:

d – Ratio of flow speed to sigma (thermal spread) of the distribution

Returns:

Solution of cubic equation of the form x^3 + p * x + q = 0 (where p and q are calculated within this function).

static inline REAL rejection_function(REAL d, REAL t)#

Gives the unnormalized value used in the one way / truncated maxwellian rejection sampling algorithm.

Parameters:
  • d – Ratio of flow speed to sigma (thermal spread) of the distribution

  • t – Result of cardano_cubic_solver(d) or a sampled random number.

Returns:

maximum of the rejection sampling function

struct OneWayMaxwellianFluxSampler : public VANTAGE::Reactions::ReactionDataBase<OneWayMaxwellianFluxOnDevice, 3, NP::HostAtomicBlockKernelRNG<REAL>>#

Reaction data class for sampling a velocity vector from a drifting Maxwellian in the tangential directions and a one way / truncated Maxwellian along the surface-normal direction. surface_basis_e1, surface_basis_e2, surface_basis_pi: The three basis vectors that define the surface tangential and normal directions. These are assumed to be orthonormal. See EIRENE docs section 1.5 Recycling surface sources for more details.

Public Functions

OneWayMaxwellianFluxSampler(const REAL &norm_ratio, std::shared_ptr<NP::HostAtomicBlockKernelRNG<REAL>> rng_kernel, std::map<int, std::string> properties_map = get_default_map())#

Constructor for OneWayMaxwellianFluxSampler.

Parameters:
  • norm_ratio – The ratio of the temperature and kinetic energy normalisations. Specifically kT/mv^2 where m is the mass of the ions, and T and v are the temperature and velocity normalisation constants

  • rng_kernel – A shared pointer of a NP::HostAtomicBlockKernelRNG<REAL> to be set as the rng_kernel in ReactionDataBase.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

virtual void index_on_device_object()#

Index the fluid flow speed, fluid temperature, surface basis functions and the panic flag on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr auto required_simple_real_props = std::array<int, 5>{props.fluid_flow_speed, props.fluid_temperature, props.surface_basis_e1, props.surface_basis_e2, props.surface_basis_pi}#
static constexpr auto required_simple_int_props = std::array<int, 1>{props.panic}#
struct PanickedParticleMarker : public VANTAGE::Reactions::MarkingStrategy#
#include <common_markers.hpp>

Marking strategy that selects only those particles with a panic flag > 0.

Public Functions

PanickedParticleMarker() = delete#
PanickedParticleMarker(const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for PanickedParticleMarker.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used to remap the NP::Sym for the Panic property.

virtual NP::ParticleSubGroupSharedPtr make_marker_subgroup_v(NP::ParticleSubGroupSharedPtr particle_group)#

Helper function to construct a particle sub group that’s generated via application of a marking strategy that selects only those particles that have panicked.

Parameters:

particle_group – The particle group to apply the marking strategy to.

Returns:

A shared pointer of a ParticleSubGroup that contains the selected particles.

Private Members

NP::Sym<INT> panic_sym#
template<typename T>
struct ParticleDatZeroer : public VANTAGE::Reactions::TransformationStrategy#

Transformation strategy that zeroes out a set of particle dats.

Template Parameters:

T – REAL or INT

Public Functions

ParticleDatZeroer() = delete#
inline ParticleDatZeroer(std::vector<std::string> dat_names)#

Constructor for ParticleDatZeroer.

Parameters:

dat_names – A vector of strings specifying the names of the dats to be zeroed.

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Zero all particle dats with names stored in the transform.

Parameters:

target_subgroup – Particle subgroup to apply the transform to

Private Members

std::vector<NP::Sym<T>> dats#
struct ParticleSpecBuilder#

Helper struct to build custom particle specs based on user provided particle properties (or if necessary extend existing particle specs.)

Public Functions

ParticleSpecBuilder() = delete#
ParticleSpecBuilder(NP::ParticleSpec particle_spec)#

Constructor for ParticleSpecBuilder.

Parameters:

particle_spec – NP::ParticleSpec that is to be extended (optional pass via a non-recommended constructor for ParticleSpecBuilder).

ParticleSpecBuilder(int ndim, const std::map<int, std::string> &properties_map = get_default_map())#

Recommended constructor, populating the generally required properties in Reactions.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • ndim – Dimensionality of vector quantities

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

template<typename PROP_TYPE>
inline void add_particle_prop(Properties<PROP_TYPE> properties, int ndim = 1, bool positions = false, const std::map<int, std::string> &properties_map = get_default_map())#

Method to add particle properties to member particle_spec.

Template Parameters:

PROP_TYPE – Specifier for type of property (INT or REAL)

Parameters:
  • properties – Properties object containing names of the particle properties to be added.

  • ndim – Number of dimensions for the properties to be added (note this will apply to all properties from properties_)

  • positions – Boolean to indicate whether the properties to be added are particle position or cell id or not.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

void add_particle_spec(NP::ParticleSpec new_particle_spec)#

Method to merge an existing NP::ParticleSpec into the particle_spec member inside the struct.

Parameters:

new_particle_spec – NP::ParticleSpec to merge into internal particle_spec member.

const NP::ParticleSpec &get_particle_spec()#

Private Members

NP::ParticleSpec particle_spec#
template<typename ...DATATYPE>
struct PipelineData : public VANTAGE::Reactions::CompositeData<PipelineDataOnDevice<DATATYPE::ON_DEVICE_OBJ_TYPE...>, last_dim<DATATYPE...>(), 0, DATATYPE...>#
#include <pipeline_data.hpp>

Composite ReactionData object containing multiple other ReactionData objects. On calculation of the data, passes the output of each data object to the next in the template order, returning the final result.

Template Parameters:

DATATYPE – ReactionData derived types contained within this composite object

Public Functions

inline PipelineData(DATATYPE... data)#

Constructor for PipelineData.

Parameters:

data – Variadic argument with all of the contained ReactionData objects

inline virtual void index_on_device_object() override#

Reconstruct the composite on-device object (assuming the individual on-device objects have been modified/re-indexed)

template<typename ...DATATYPE>
struct PipelineDataOnDevice : public VANTAGE::Reactions::CompositeDataOnDevice<last_dim<DATATYPE...>(), 0, REAL, REAL, DATATYPE...>#
#include <pipeline_data.hpp>

On device recursive pipeline data - calc_data returns the composition of all contained ReactionDataOnDevice objects, passing on the output from left to right.

Template Parameters:

DATATYPE – ReactionDataOnDevice variadic parameters whose calc_data is called from this object

Public Functions

PipelineDataOnDevice() = default#
inline PipelineDataOnDevice(DATATYPE... data)#

Constructor for PipelineDataOnDevice.

Parameters:

data – Variadic argument with all of the contained ReactionDataOnDevice objects

inline std::array<REAL, DIM> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>...>::KernelType &rng_kernel) const#

Function to calculate the composed data.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernels used in the calculation, a NP::TupleRNG accessor

Returns:

A return array containing the result of the calc_data of the last ReactionDataOnDevice object in DATATYPE.

template<size_t I, typename T, typename ...ARGS>
inline std::array<REAL, DIM> calc_data_recurse(const std::array<typename T::INPUT_TYPE, T::INPUT_DIM> input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>...>::KernelType &rng_kernel) const#

Public Static Attributes

static const size_t DIM = last_dim<DATATYPE...>()#
template<size_t DIM, size_t POLY_ORDER>
struct PolynomialArrayTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM, DIM>#

Unary array transform taking each element of the input array and calculating the value of its polynomial with given coefficients.

Template Parameters:
  • DIM – The expected input/output size

  • POLY_ORDER – The order of the applied polynomial

Public Functions

PolynomialArrayTransform() = default#
inline PolynomialArrayTransform(const std::array<REAL, POLY_ORDER + 1> &coeffs)#

Constructor of PolynomialArrayTransform.

Parameters:

coeffs – The array of polynomial coefficients, given in ascending order from 0

inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

std::array<REAL, POLY_ORDER + 1> coeffs#
struct ProfilingBase#
#include <profiling_base.hpp>

Mix-in class to provide profiling to downstream classes.

Subclassed by VANTAGE::Reactions::AbstractReaction, VANTAGE::Reactions::MarkingStrategy, VANTAGE::Reactions::TransformationStrategy

Public Functions

ProfilingBase() = default#
virtual ~ProfilingBase() = default#
virtual std::string get_profiling_name()#
Returns:

A name of the class that is being profiled. Override for a better name.

std::optional<NP::ProfileRegion> start_profiling_region(NP::ParticleSubGroupSharedPtr &subgroup, const std::string key1)#

Start a region to be profiled. The object returned from this call should be passed to end_profiling_region.

Parameters:
  • subgroup – NP::ParticleSubGroup to extract NP::SYCLTarget from.

  • key1 – Name of region that is being profiled.

Returns:

Region object to pass to end_profiling_region.

void end_profiling_region(NP::ParticleSubGroupSharedPtr &subgroup, std::optional<NP::ProfileRegion> &region)#

End a region to be profiled.

Parameters:
  • subgroup – NP::ParticleSubGroup to extract NP::SYCLTarget from.

  • region – Region that is being profiled.

template<typename PROP_TYPE>
struct Properties#

Struct for defining the Properties that a ReactionData or ReactionKernel object might need.

Template Parameters:

PROP_TYPE – Property type of the properties to be stored in this struct (either INT or REAL).

Public Functions

Properties() = default#
inline Properties(std::vector<int> simple_props, std::vector<Species> species, std::vector<int> species_props)#

Constructor for Properties.

Parameters:
  • simple_props – An integer vector defining the required simple properties (either particle or field properties that don’t depend on species). The values in the vector will be enums from a StandardPropertiesEnum (or derived) struct.

  • species – A vector of Species structs that contain the species(plural) that the species_props_ need to be combined with in order to produce the correct property names.

  • species_props – An integer vector defining the required species properties that are to be combined with species_ to produce property names.

inline Properties(std::vector<int> simple_props)#

Constructor for Properties that only sets the simple props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

simple_props – An integer vector defining the required simple properties (either particle or field properties that don’t depend on species). The values in the vector will be enums from a StandardPropertiesEnum (or derived) struct.

inline Properties(std::vector<Species> species, std::vector<int> species_props)#

Constructor for Properties that only sets Species props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • species – A vector of Species structs that contain the species(plural) that the species_props_ need to be combined with in order to produce the correct property names.

  • species_props – An integer vector defining the required species properties that are to be combined with species_ to produce property names.

template<size_t N, size_t M>
inline Properties(const std::array<int, N> &simple_props, std::vector<Species> species, const std::array<int, M> &species_props)#

Constructor for Properties that uses std::arrays instead of std::vectors for the props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters:
  • N – Size of simple props array.

  • M – Size of species props array.

Parameters:
  • simple_props – An integer array defining the required simple properties (either particle or field properties that don’t depend on species). The values in the array will be enums from a StandardPropertiesEnum (or derived) struct.

  • species – A vector of Species structs that contain the species(plural) that the species_props_ need to be combined with in order to produce the correct property names.

  • species_props – An integer array defining the required species properties that are to be combined with species_ to produce property names.

template<size_t N>
inline Properties(const std::array<int, N> &simple_props)#

Constructor for Properties that only sets the simple props using std::array.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters:

N – Size of simple props array.

Parameters:

simple_props – An integer array defining the required simple properties (either particle or field properties that don’t depend on species). The values in the array will be enums from a StandardPropertiesEnum (or derived) struct.

template<size_t M>
inline Properties(std::vector<Species> species, const std::array<int, M> &species_props)#

Constructor for Properties that only sets Species props using std::array.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Template Parameters:

M – Size of species props array.

Parameters:
  • species – A vector of Species structs that contain the species(plural) that the species_props_ need to be combined with in order to produce the correct property names.

  • species_props – An integer array defining the required species properties that are to be combined with species_ to produce property names.

inline Properties<PROP_TYPE> merge_with(Properties<PROP_TYPE> other)#

Merge with another property, taking care of duplicates. The properties of this object are inserted first.

Parameters:

other – The Properties object to merge with

Returns:

Merged Properties object.

inline std::vector<std::string> simple_prop_names(const std::map<int, std::string> &properties_map = get_default_map())#

Function to return a vector of strings containing the names of the required simple properties.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used in remapping the property names.

Returns:

simple_prop_names

inline int simple_prop_index(int prop, const std::map<int, std::string> &properties_map = get_default_map())#

Function that return the index of the property in all_props given a requested property.

Parameters:
  • prop – An integer that corresponds to a value from the enumerator in a StandardPropertiesEnum (or derived) struct (eg. for “VELOCITY” this would be the variable name - velocity - which corresponds to 1.)

  • properties_map – (Optional) A std::map<int, std::string> object to be used in remapping the property indices.

Returns:

simple_prop_index

inline std::vector<std::string> species_prop_names(const std::map<int, std::string> &properties_map = get_default_map())#

Function to return a vector of strings containing the names of the required species props combined with the species as a prefix. (eg. “ELECTRON” + “_” + “DENSITY”)

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used in remapping the property names.

Returns:

species_prop_names

inline int species_prop_index(std::string species_name, int prop, const std::map<int, std::string> &properties_map = get_default_map())#

Function that returns the index of the property in all_props given a species name and a requested property.

Parameters:
  • species_name – Requested species name (eg. “ELECTRON”)

  • prop – An integer that corresponds to a value from the enumerator in a StandardPropertiesEnum (or derived) struct (eg. for “DENSITY” this would be the variable name - density - which corresponds to 8).

  • properties_map – (Optional) A std::map<int, std::string> object to be used in remapping the property indices.

Returns:

species_prop_index

inline const std::vector<std::string> get_prop_names(const std::map<int, std::string> &properties_map = get_default_map())#

Getter for combined prop_names vector.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used in remapping the property names.

inline const std::vector<int> get_simple_props() const#

Getters for simple_props, species and species_props and all props.

inline const std::vector<Species> get_species() const#
inline const std::vector<int> get_species_props() const#
inline const std::vector<int> get_props() const#

Private Members

std::vector<int> simple_props#
std::vector<Species> species#
std::vector<int> species_props#
std::vector<int> all_props#
struct PropertiesMap#

Used to define mappings between integer indices defined in an enumerator from a StandardPropertiesEnum to NP::Sym names.

Public Functions

PropertiesMap() = default#
PropertiesMap(std::map<int, std::string> custom_map)#

Constructor for PropertiesMap.

Parameters:

custom_map – User-provided custom map to replace the default private_map.

std::map<int, std::string> get_map()#
std::string &at(const int &key)#
std::string &operator[](const int &key)#

Private Members

std::map<int, std::string> private_map{{default_properties.reacted_flag, "PARTICLE_REACTED_FLAG"}, {default_properties.grouping_index, "REACTIONS_GROUPING_INDEX"}, {default_properties.linear_index, "REACTIONS_LINEAR_INDEX"}, {default_properties.panic, "REACTIONS_PANIC_FLAG"}, {default_properties.position, "POSITION"}, {default_properties.velocity, "VELOCITY"}, {default_properties.cell_id, "CELL_ID"}, {default_properties.id, "ID"}, {default_properties.tot_reaction_rate, "TOT_REACTION_RATE"}, {default_properties.weight, "WEIGHT"}, {default_properties.internal_state, "INTERNAL_STATE"}, {default_properties.boundary_intersection_point, NP::BoundaryInteractionSpecification::intersection_point.name}, {default_properties.boundary_intersection_normal, NP::BoundaryInteractionSpecification::intersection_normal.name}, {default_properties.boundary_intersection_metadata, NP::BoundaryInteractionSpecification::intersection_metadata.name}, {default_properties.temperature, "TEMPERATURE"}, {default_properties.density, "DENSITY"}, {default_properties.flow_speed, "FLOW_SPEED"}, {default_properties.source_energy, "SOURCE_ENERGY"}, {default_properties.source_momentum, "SOURCE_MOMENTUM"}, {default_properties.source_density, "SOURCE_DENSITY"}, {default_properties.surface_basis_e1, "SURFACE_BASIS_E1"}, {default_properties.surface_basis_e2, "SURFACE_BASIS_E2"}, {default_properties.surface_basis_pi, "SURFACE_BASIS_PI"}, {default_properties.fluid_density, "FLUID_DENSITY"}, {default_properties.fluid_temperature, "FLUID_TEMPERATURE"}, {default_properties.fluid_flow_speed, "FLUID_FLOW_SPEED"}}#
struct ReactionController#

A reaction controller that orchestrates the application of reactions to a given NP::ParticleGroup or NP::ParticleSubGroup.

Public Functions

ReactionController(std::vector<std::shared_ptr<TransformationWrapper>> parent_transform, std::vector<std::shared_ptr<TransformationWrapper>> child_transform, bool auto_clean_tot_rate_buffer = true, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ReactionController.

Parameters:
  • parent_transform – Vector of TransformationWrappers informing how parent particles are to be handled

  • child_transform – Vector of TransformationWrappers informing how descendant products are to be handled

  • auto_clean_tot_rate_buffer – Automatically flush the total rate buffer. Defaults to true.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (eg. panic flag, internal_state, and total rate)

ReactionController(bool auto_clean_tot_rate_buffer = true, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ReactionController with no parent and child transformation strategies.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • auto_clean_tot_rate_buffer – Automatically flush the total rate buffer. Defaults to true.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (eg. panic flag, internal_state, and total rate)

ReactionController(std::shared_ptr<TransformationWrapper> child_transform, bool auto_clean_tot_rate_buffer = true, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ReactionController with no parent transformation strategies.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • child_transform – A TransformationWrapper informing how descendant products are to be handled

  • auto_clean_tot_rate_buffer – Automatically flush the total rate buffer. Defaults to true.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (eg. panic flag, internal_state, and total rate)

ReactionController(std::shared_ptr<TransformationWrapper> parent_transform, std::shared_ptr<TransformationWrapper> child_transform, bool auto_clean_tot_rate_buffer = true, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for ReactionController.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • parent_transform – A TransformationWrapper informing how parent particles are to be handled

  • child_transform – A TransformationWrapper informing how descendant products are to be handled

  • auto_clean_tot_rate_buffer – Automatically flush the total rate buffer. Defaults to true.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (eg. panic flag, internal_state, and total rate)

void controller_pre_process()#

Function to populate the sub_group_selectors map and parent_ids, child_ids sets, as well as set the buffer sizes used.

void add_reaction(std::shared_ptr<AbstractReaction> reaction)#

Function to add reactions to a stored vector of AbstractReaction pointers.

Parameters:

reaction – Shared pointer of the reaction to be added

inline void set_max_particles_per_cell(size_t max_num_parts)#

Set the maximum number of particles per cell (used in determining the buffer size for reaction data.

Parameters:

max_num_parts – Maximum number of particles per cell

inline void set_cell_block_size(size_t cell_block_size)#

Set the number of cells per cell block, determines how many cells each reaction runs its loops over at a time, and determines the maximum reaction data buffer size together with the maximum number of particles per cell (block size times maximum number of particles per cell)

Parameters:

cell_block_size – Number of cells to apply reactions to at a time (set to a lower number in case of memory issues)

inline void set_auto_clean_tot_rate_buffer(const bool &auto_clean_setting)#

Setter and getter for auto_clean_tot_rate_buffer setting.

inline const bool &get_auto_clean_tot_rate_buffer()#
template<typename PARENT>
inline void apply_parent_transforms(std::shared_ptr<PARENT> target)#

Apply parent transform on the target group or subgroup.

Parameters:

target – The NP::ParticleGroup or NP::ParticleSubGroup to apply the transforms to

template<typename PARENT>
inline void apply(std::shared_ptr<PARENT> target, double dt, NP::ParticleGroupSharedPtr product_group, ControllerMode controller_mode = ControllerMode::standard_mode)#

Applies all reactions that have been added prior to calling this function. The reactions are effectively applied at the same time and the result should not depend on the ordering of the reactions. Any reaction products are added to the designated group (can be different to the parent group) and they are transformed according to the child_transform transformation wrapper. Parents are transformed according to the parent_transform transformation wrapper.

Parameters:
  • target – The NP::ParticleGroup or NP::ParticleSubGroup to apply the reactions to.

  • dt – The current time step size.

  • product_group – The NP::ParticleGroup into which to add the products, should have the same spec as the parent.

  • controller_mode – The mode to run the controller in. Either standard_mode (default) or semi_dsmc_mode.

template<typename PARENT>
inline void apply(std::shared_ptr<PARENT> target, double dt, ControllerMode controller_mode = ControllerMode::standard_mode)#

Applies all reactions that have been added prior to calling this function. The reactions are effectively applied at the same time and the result should not depend on the ordering of the reactions. Any reaction products are added and they are transformed according to the child_transform transformation wrapper. Parents are transformed according to the parent_transform transformation wrapper.

Parameters:
  • target – The NP::ParticleGroup or NP::ParticleSubGroup to apply the reactions to.

  • dt – The current time step size.

  • controller_mode – The mode to run the controller in. Either standard_mode (default) or semi_dsmc_mode.

inline void set_rng_kernel(std::shared_ptr<NP::HostPerParticleBlockRNG<REAL>> rng_kernel)#
inline std::shared_ptr<NP::HostPerParticleBlockRNG<REAL>> get_rng_kernel()#

Private Functions

void apply_parent_transforms_impl(NP::ParticleSubGroupSharedPtr target, NP::ParticleGroupSharedPtr particle_group)#

Non-templated code from apply_parent_transforms to allow for definition/declaration separation.

Parameters:
  • target – The NP::ParticleSubGroup to apply the transforms to

  • particle_group – A reference NP::ParticleGroup.

void apply_impl(NP::ParticleSubGroupSharedPtr target, NP::ParticleGroupSharedPtr particle_group, double dt, NP::ParticleGroupSharedPtr product_group, ControllerMode controller_mode, bool is_particle_group)#

Non-templated code from apply to allow for definition/declaration separation.

Parameters:
  • target – The NP::ParticleSubGroup to apply the reactions to.

  • particle_group – A reference NP::ParticleGroup.

  • dt – The current time step size.

  • product_group – The NP::ParticleGroup into which to add the products, should have the same spec as the parent.

  • controller_mode – The mode to run the controller in. Either standard_mode (default) or semi_dsmc_mode.

  • is_particle_group – A boolean that specifies if the PARENT template parameter passed to apply is NP::ParticleGroup.

inline void setup_particle_group_temporary()#

Private Members

std::map<int, std::shared_ptr<MarkingStrategy>> sub_group_selectors#
std::map<int, NP::ParticleSubGroupSharedPtr> species_groups#
std::map<int, NP::ParticleSubGroupSharedPtr> reacted_species_groups#
NP::ParticleGroupSharedPtr reference_particle_group = nullptr#
std::set<int> parent_ids#
std::set<int> child_ids#
std::vector<std::shared_ptr<AbstractReaction>> reactions#
std::vector<std::shared_ptr<TransformationWrapper>> parent_transform#
std::vector<std::shared_ptr<TransformationWrapper>> child_transform#
std::shared_ptr<MarkingStrategy> reacted_marker#
NP::Sym<INT> id_sym#
NP::Sym<INT> panic_flag#
NP::Sym<INT> reacted_flag#
NP::Sym<REAL> tot_rate_buffer#
NP::Sym<REAL> weight_sym#
std::shared_ptr<TransformationWrapper> rate_buffer_zeroer#
bool auto_clean_tot_rate_buffer#
std::shared_ptr<NP::HostPerParticleBlockRNG<REAL>> rng_kernel#
size_t cell_block_size = 256#
size_t max_particles_per_cell = 16384#
std::shared_ptr<NP::ParticleGroupTemporary> particle_group_temporary#
template<typename ON_DEVICE_TYPE, size_t dim = 1, typename RNG_TYPE = DEFAULT_RNG_KERNEL, size_t input_dim = 0>
struct ReactionDataBase : public VANTAGE::Reactions::ReactionDataBaseImpl#
#include <reaction_data.hpp>

Base reaction data object.

Template Parameters:
  • ON_DEVICE_TYPE – Type of the on-device object

  • dim – Used to set the size of the array that calc_data returns (Optional).

  • RNG_TYPE – Sets the type of RNG that is used for sampling (Optional).

  • input_dim – The size of the input array (Optional, defaults to 0, not defining the corresponding calc_data)

Subclassed by VANTAGE::Reactions::CompositeData< BinaryArrayTransformDataOnDevice< TRANSFORM, DATATYPE1::ON_DEVICE_OBJ_TYPE, DATATYPE2::ON_DEVICE_OBJ_TYPE >, TRANSFORM::OUT_DIM, 0, DATATYPE1, DATATYPE2 >, VANTAGE::Reactions::CompositeData< ConcatenatorDataOnDevice< DATATYPE::ON_DEVICE_OBJ_TYPE… >, total_dim< DATATYPE… >(), 0, DATATYPE… >, VANTAGE::Reactions::CompositeData< InterpolateDataOnDevice< output_ndim, interp_ndim, 0, DATATYPE::ON_DEVICE_OBJ_TYPE >, output_ndim, interp_ndim+0, DATATYPE >, VANTAGE::Reactions::CompositeData< PipelineDataOnDevice< DATATYPE::ON_DEVICE_OBJ_TYPE… >, last_dim< DATATYPE… >(), 0, DATATYPE… >, VANTAGE::Reactions::AMJUEL2DDataH3< num_coeffs_T, num_coeffs_E, dim >, VANTAGE::Reactions::ArrayLookupData< N, ephemeral_dat >, VANTAGE::Reactions::FilteredMaxwellianSampler< ndim, CROSS_SECTION >

Public Types

using RNG_KERNEL_TYPE = RNG_TYPE#
using ON_DEVICE_OBJ_TYPE = ON_DEVICE_TYPE#

Public Functions

inline ReactionDataBase(Properties<INT> required_int_props, Properties<REAL> required_real_props, Properties<INT> required_int_props_ephemeral, Properties<REAL> required_real_props_ephemeral, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBase.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • required_int_props_ephemeral – Properties<INT> object containing information regarding the required INT-based ephemeral properties for the reaction data.

  • required_real_props_ephemeral – Properties<REAL> object containing information regarding the required REAL-based ephemeral properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

inline ReactionDataBase(std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBase that sets no required properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

inline ReactionDataBase(Properties<INT> required_int_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBase that sets only required int properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

inline ReactionDataBase(Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBase that sets only required real properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

inline ReactionDataBase(Properties<INT> required_int_props, Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBase that sets only required int and real properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

inline void set_rng_kernel(std::shared_ptr<RNG_TYPE> rng_kernel)#
inline std::shared_ptr<RNG_TYPE> get_rng_kernel()#
inline const ON_DEVICE_TYPE &get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Functions

static inline constexpr bool validate_on_device_type()#

Validate that the on-device type defines calc_data with the parameter signature and return type expected by this host base class.

static inline constexpr size_t get_dim()#

Public Static Attributes

static const size_t DIM = dim#
static const size_t INPUT_DIM = input_dim#

Protected Attributes

std::optional<ON_DEVICE_TYPE> on_device_obj#
std::shared_ptr<RNG_TYPE> rng_kernel#
struct ReactionDataBaseImpl#
#include <reaction_data.hpp>

Non-template implementation base for reaction data objects.

Holds the required properties, property maps and constructors that do not depend on the on-device type, dimension or RNG type.

Subclassed by VANTAGE::Reactions::ReactionDataBase< AMJUEL1DDataOnDevice< num_coeffs > >, VANTAGE::Reactions::ReactionDataBase< AMJUEL2DDataOnDevice< num_coeffs_T, num_coeffs_n > >, VANTAGE::Reactions::ReactionDataBase< AMJUEL2DDataH3OnDevice< num_coeffs_T, num_coeffs_E, 2 > >, VANTAGE::Reactions::ReactionDataBase< ArrayLookupDataOnDevice< N, false >, N >, VANTAGE::Reactions::ReactionDataBase< ArrheniusDataOnDevice >, VANTAGE::Reactions::ReactionDataBase< BinaryArrayTransformDataOnDevice< TRANSFORM, DATATYPE1::ON_DEVICE_OBJ_TYPE, DATATYPE2::ON_DEVICE_OBJ_TYPE >, dim, NP::TupleRNG< std::shared_ptr< DATATYPE::RNG_KERNEL_TYPE >… >, input_dim >, VANTAGE::Reactions::ReactionDataBase< CartesianBasisReflectionDataOnDevice, 3, DEFAULT_RNG_KERNEL, 3 >, VANTAGE::Reactions::ReactionDataBase< CartesianGridDataOnDevice< input_ndim > >, VANTAGE::Reactions::ReactionDataBase< ON_DEVICE_TYPE, dim, NP::TupleRNG< std::shared_ptr< DATATYPE::RNG_KERNEL_TYPE >… >, input_dim >, VANTAGE::Reactions::ReactionDataBase< ConcatenatorDataOnDevice< DATATYPE::ON_DEVICE_OBJ_TYPE… >, dim, NP::TupleRNG< std::shared_ptr< DATATYPE::RNG_KERNEL_TYPE >… >, input_dim >, VANTAGE::Reactions::ReactionDataBase< ExtractorDataOnDevice< ncomp >, ncomp >, VANTAGE::Reactions::ReactionDataBase< FilteredMaxwellianOnDevice< ndim, ConstantRateCrossSection >, ndim, NP::HostAtomicBlockKernelRNG< REAL > >, VANTAGE::Reactions::ReactionDataBase< FixedArrayDataOnDevice< ndim >, ndim >, VANTAGE::Reactions::ReactionDataBase< FixedCoefficientDataOnDevice >, VANTAGE::Reactions::ReactionDataBase< FixedRateDataOnDevice >, VANTAGE::Reactions::ReactionDataBase< InterpolateDataOnDevice< output_ndim, interp_ndim, 0, DATATYPE::ON_DEVICE_OBJ_TYPE >, dim, NP::TupleRNG< std::shared_ptr< DATATYPE::RNG_KERNEL_TYPE >… >, input_dim >, VANTAGE::Reactions::ReactionDataBase< OneWayMaxwellianFluxOnDevice, 3, NP::HostAtomicBlockKernelRNG< REAL > >, VANTAGE::Reactions::ReactionDataBase< PipelineDataOnDevice< DATATYPE::ON_DEVICE_OBJ_TYPE… >, dim, NP::TupleRNG< std::shared_ptr< DATATYPE::RNG_KERNEL_TYPE >… >, input_dim >, VANTAGE::Reactions::ReactionDataBase< SamplerDataOnDevice< RNG_KERNEL >, 1, RNG_KERNEL >, VANTAGE::Reactions::ReactionDataBase< SpecularReflectionDataOnDevice< ndim >, ndim, DEFAULT_RNG_KERNEL, ndim >, VANTAGE::Reactions::ReactionDataBase< SphericalBasisReflectionDataOnDevice, 3, DEFAULT_RNG_KERNEL, 3 >, VANTAGE::Reactions::ReactionDataBase< TrimEvalDataOnDevice< input_ndim > >, VANTAGE::Reactions::ReactionDataBase< UnaryArrayTransformDataOnDevice< TRANSFORM >, TRANSFORM::OUT_DIM, DEFAULT_RNG_KERNEL, TRANSFORM::IN_DIM >, VANTAGE::Reactions::ReactionDataBase< ON_DEVICE_TYPE, dim, RNG_TYPE, input_dim >

Public Functions

ReactionDataBaseImpl(Properties<INT> required_int_props, Properties<REAL> required_real_props, Properties<INT> required_int_props_ephemeral, Properties<REAL> required_real_props_ephemeral, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBaseImpl.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • required_int_props_ephemeral – Properties<INT> object containing information regarding the required INT-based ephemeral properties for the reaction data.

  • required_real_props_ephemeral – Properties<REAL> object containing information regarding the required REAL-based ephemeral properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionDataBaseImpl(std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBaseImpl that sets no required properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionDataBaseImpl(Properties<INT> required_int_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBaseImpl that sets only required int properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionDataBaseImpl(Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBaseImpl that sets only required real properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionDataBaseImpl(Properties<INT> required_int_props, Properties<REAL> required_real_props, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionDataBaseImpl that sets only required int and real properties.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction data.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction data.

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ArgumentNameSet<INT> get_required_int_props()#

Return all required integer properties, including ephemeral.

virtual void set_required_int_props(const ArgumentNameSet<INT> &props)#

Setter for required integer properties.

Parameters:

props – ArgumentNameSet to use

std::vector<NP::Sym<INT>> get_required_int_sym_vector()#

Return all required integer properties as a vector of Syms.

ArgumentNameSet<REAL> get_required_real_props()#

Return all required real properteis, including ephemeral properties.

std::vector<NP::Sym<REAL>> get_required_real_sym_vector()#

Return all required real properties as a vector of Syms.

virtual void set_required_real_props(const ArgumentNameSet<REAL> &props)#

Setter for required real properties.

Parameters:

props – ArgumentNameSet to use

virtual ~ReactionDataBaseImpl()#
virtual void index_on_device_object()#

To be implemented by each derived class in order to handle required property indexing on the on-device object.

Protected Attributes

ArgumentNameSet<INT> required_int_props#
ArgumentNameSet<REAL> required_real_props#
std::map<int, std::string> properties_map#
template<size_t dim = 1, typename RNG_TYPE = DEFAULT_RNG_KERNEL, size_t input_dim = 0, typename VAL_TYPE = REAL, typename IN_TYPE = REAL>
struct ReactionDataBaseOnDevice#
#include <reaction_data.hpp>

Base reaction data object to be used on SYCL devices.

Template Parameters:
  • dim – Used to set the size of the array that calc_data returns (Optional).

  • RNG_TYPE – Sets the type of RNG that is used for sampling (Optional).

  • input_dim – The dimension of the optional input array (for use in pipelines) (Optional, default 0)

  • VAL_TYPE – Return type of this objects calc_data routine (Optional, default REAL)

  • IN_TYPE – Input type of array required by this object (if input_dim >0)

Subclassed by VANTAGE::Reactions::CompositeDataOnDevice< TRANSFORM::OUT_DIM, 0, REAL, REAL, DATATYPE1, DATATYPE2 >, VANTAGE::Reactions::CompositeDataOnDevice< total_dim< DATATYPE… >(), 0, REAL, REAL, DATATYPE… >, VANTAGE::Reactions::CompositeDataOnDevice< output_ndim, interp_ndim+non_interp_ndim, REAL, REAL, DATATYPE >, VANTAGE::Reactions::CompositeDataOnDevice< last_dim< DATATYPE… >(), 0, REAL, REAL, DATATYPE… >, VANTAGE::Reactions::AMJUEL1DDataOnDevice< num_coeffs >, VANTAGE::Reactions::AMJUEL2DDataH3OnDevice< num_coeffs_T, num_coeffs_E, dim >, VANTAGE::Reactions::AMJUEL2DDataOnDevice< num_coeffs_T, num_coeffs_n >, VANTAGE::Reactions::ArrheniusDataOnDevice, VANTAGE::Reactions::FixedCoefficientDataOnDevice, VANTAGE::Reactions::FixedRateDataOnDevice

Public Types

using RNG_KERNEL_TYPE = RNG_TYPE#
using VALUE_TYPE = VAL_TYPE#
using INPUT_TYPE = IN_TYPE#

Public Functions

ReactionDataBaseOnDevice() = default#
template<std::size_t D = INPUT_DIM, std::enable_if_t<(D == 0) && D == INPUT_DIM, int> = 0>
inline std::array<VAL_TYPE, dim> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename RNG_TYPE::KernelType &rng_kernel) const#

Function to calculate the reaction data.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction data calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction data calculation.

  • rng_kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size dim containing the calculated reaction rate.

template<std::size_t D = INPUT_DIM, std::enable_if_t<(D > 0) && D == INPUT_DIM, int> = 0>
inline std::array<VAL_TYPE, dim> calc_data(const std::array<IN_TYPE, INPUT_DIM> &input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename RNG_TYPE::KernelType &rng_kernel) const#

Enabled when there’s an input array for calc_data.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • input_array – An IN_TYPE-valued array of size INPUT_DIM the can be used as an input for calculating reaction rates (eg. with ConcatenatorData or PipelineData)

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction data calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction data calculation.

  • rng_kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size dim containing the calculated reaction rate.

Public Static Functions

static inline constexpr size_t get_dim()#

Public Static Attributes

static const size_t DIM = dim#
static const size_t INPUT_DIM = input_dim#
struct ReactionKernelsBase#

Base reaction kernels object.

Subclassed by VANTAGE::Reactions::IoniseReactionKernels< 2 >, VANTAGE::Reactions::RecombReactionKernels< ndim >, VANTAGE::Reactions::CXReactionKernels< ndim_velocity, ndim_source_momentum >, VANTAGE::Reactions::GeneralAbsorptionKernels< ndim_velocity >, VANTAGE::Reactions::IoniseReactionKernels< ndim_velocity, ndim_source_momentum, has_momentum_req_data >, VANTAGE::Reactions::LinearScatteringKernels< ndim_velocity, with_sources >, VANTAGE::Reactions::RecombReactionKernels< ndim_velocity, ndim_source_momentum >, VANTAGE::Reactions::SpecularReflectionKernels< ndim_velocity >

Public Functions

ReactionKernelsBase(Properties<INT> required_int_props, Properties<REAL> required_real_props, Properties<INT> required_int_props_ephemeral, Properties<REAL> required_real_props_ephemeral, INT pre_req_ndims = 0, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionKernelsBase.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction kernel.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction kernel.

  • required_int_props_ephemeral – Properties<INT> object containing information regarding the required INT-based ephemeral properties for the reaction kernel.

  • required_real_props_ephemeral – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction kernel.

  • pre_req_ndims – (Optional) Integer defining the number of dimensions required by a reaction kernel (this in turn matches the number of ReactionData-derived objects that must be passed to the constructor of a DataCalculator object when this kernel and the DataCalculator object are passed to a LinearReactionBase-derived object constructor).

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionKernelsBase(std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionKernelsBase that by default sets no required props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionKernelsBase(Properties<INT> required_int_props, INT pre_req_ndims = 0, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionKernelsBase that by default only sets required_int_props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction kernel.

  • pre_req_ndims – (Optional) Integer defining the number of dimensions required by a reaction kernel (this in turn matches the number of ReactionData-derived objects that must be passed to the constructor of a DataCalculator object when this kernel and the DataCalculator object are passed to a LinearReactionBase-derived object constructor).

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionKernelsBase(Properties<REAL> required_real_props, INT pre_req_ndims = 0, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionKernelsBase that by default only sets required_real_props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction kernel.

  • pre_req_ndims – (Optional) Integer defining the number of dimensions required by a reaction kernel (this in turn matches the number of ReactionData-derived objects that must be passed to the constructor of a DataCalculator object when this kernel and the DataCalculator object are passed to a LinearReactionBase-derived object constructor).

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

ReactionKernelsBase(Properties<INT> required_int_props, Properties<REAL> required_real_props, INT pre_req_ndims = 0, std::map<int, std::string> properties_map = get_default_map())#

Constructor for ReactionKernelsBase that by default only sets required_int_props and required_real_props.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • required_int_props – Properties<INT> object containing information regarding the required INT-based properties for the reaction kernel.

  • required_real_props – Properties<REAL> object containing information regarding the required REAL-based properties for the reaction kernel.

  • pre_req_ndims – (Optional) Integer defining the number of dimensions required by a reaction kernel (this in turn matches the number of ReactionData-derived objects that must be passed to the constructor of a DataCalculator object when this kernel and the DataCalculator object are passed to a LinearReactionBase-derived object constructor).

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names (in get_required_real_props(…) and get_required_int_props(…)).

virtual ~ReactionKernelsBase() = default#
std::vector<std::string> get_required_int_props()#

Return all required integer property names, including ephemeral properties.

std::vector<std::string> get_required_real_props()#

Return all required real property names, including ephemeral properties.

std::vector<std::string> get_required_int_props_ephemeral()#

Return names of required ephemeral integer properties.

std::vector<std::string> get_required_real_props_ephemeral()#

Return names of required ephemeral real properties.

const Properties<INT> &get_required_descendant_int_props()#
const Properties<REAL> &get_required_descendant_real_props()#
std::shared_ptr<NP::ProductMatrixSpec> get_descendant_matrix_spec()#
const INT &get_pre_ndims() const#

Protected Functions

void set_required_descendant_int_props(const Properties<INT> &required_descendant_int_props)#
void set_required_descendant_real_props(const Properties<REAL> &required_descendant_real_props)#
template<int ndim_velocity = 2, int num_products_per_parent = 0>
inline void set_descendant_matrix_spec()#

Protected Attributes

Properties<INT> required_int_props#
Properties<REAL> required_real_props#
Properties<INT> required_int_props_ephemeral#
Properties<REAL> required_real_props_ephemeral#
Properties<INT> required_descendant_int_props#
Properties<REAL> required_descendant_real_props#
std::shared_ptr<NP::ProductMatrixSpec> descendant_matrix_spec = std::make_shared<NP::ProductMatrixSpec>()#
INT pre_req_ndims#
std::map<int, std::string> properties_map#
template<int num_products_per_parent>
struct ReactionKernelsBaseOnDevice#

Base reaction kernels object to be used on SYCL devices.

Template Parameters:

num_products_per_parent – The number of products produced per parent by a reaction.

Public Functions

ReactionKernelsBaseOnDevice() = default#
inline void scattering_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, num_products_per_parent> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Base scattering kernel for calculating and applying reaction-derived velocity modifications of the particles.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued local array containing pre-requisite data relating to a derived reaction.

  • dt – The current time step size.

inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, num_products_per_parent> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Base feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued local array containing pre-requisite data relating to a derived reaction.

  • dt – The current time step size.

inline void transformation_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, num_products_per_parent> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Base transformation kernel for calculating and applying reaction-derived ID modifications of the particles.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued local array containing pre-requisite data relating to a derived reaction.

  • dt – The current time step size.

inline void weight_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, num_products_per_parent> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Base weight kernel for calculating and applying reaction-derived weight modifications of the particles.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued local array containing pre-requisite data relating to a derived reaction.

  • dt – The current time step size.

template<typename RateData, typename DataCalcType, size_t ndim>
struct Recombination : public VANTAGE::Reactions::LinearReactionBase<1, RateData, RecombReactionKernels<ndim>, DataCalcType>#

A struct defining a reaction representing recombination. Takes in a marker species, which represents the ions, and produces products based on their weights, without reducing them. The user is responsible for setting the weight of the marker species in a way that reproduces the sources they want.

Template Parameters:
  • RateData – ReactionData template parameter used for the rate calculation

  • DataCalcType – DataCalculator template parameter used for calculating, electron source energy loss and the velocities for generated neutrals

  • ndim – Template parameter defining the ndim_velocity template parameter to use with RecombReactionKernels

Public Functions

inline Recombination(NP::SYCLTargetSharedPtr sycl_target, RateData rate_data, DataCalcType data_calc_obj, Species marker_species, Species electron_species, Species neutral_species, const REAL &normalised_potential_energy, const std::map<int, std::string> &properties_map = get_default_map())#

Constructor for Recombination.

Parameters:
  • sycl_target – SYCL target pointer used to interface with NESO-Particles routines

  • rate_data – ReactionData object used to calculate the recombination rate

  • data_calc_obj – DataCalculator that will calculate electron source energy loss and the velocities of the generated neutrals, in that order (so dimensionality 3 or 4, depending on velocity space dim)

  • marker_species – Species object representing the recombination target

    • will only be used as source locations and their weight will impact the rate, but it won’t be changed

  • electron_species – Species object corresponding to the electrons

  • neutral_species – Species object representing the neutrals that will be generated

  • normalised_potential_energy – Used in calculating the electron source energy loss, the rate of which is given by the first data_calc_obj element

    • the potential energy x rate

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

template<int ndim_velocity = 2, int ndim_source_momentum = ndim_velocity>
struct RecombReactionKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for recombination kernels.

Template Parameters:
  • ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

  • ndim_source_momentum – Optional number of dimensions for source momentum property (default value of ndim_velocity)

Public Functions

inline RecombReactionKernels(const Species &target_species, const Species &projectile_species, const REAL &normalised_potential_energy, std::map<int, std::string> properties_map = get_default_map())#

Constructor for RecombReactionKerenls.

Parameters:
  • target_species – Species object representing the recombination target

  • projectile_species – Species object representing the projectile involved in the recombination (eg. electron).

  • normalised_potential_energy – Used in calculating the projectile source energy loss

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline RecombReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum> get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 1> required_simple_real_props = {props.weight}#
static constexpr std::array<int, 3> required_species_real_props = {props.source_density, props.source_momentum, props.source_energy}#
static constexpr std::array<int, 1> required_descendant_simple_int_props = {props.internal_state}#
static constexpr std::array<int, 2> required_descendant_simple_real_props = {props.velocity, props.weight}#

Private Members

RecombReactionKernelsOnDevice<ndim_velocity, ndim_source_momentum> recomb_reaction_kernels_on_device#
template<int ndim_velocity, int ndim_source_momentum>
struct RecombReactionKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<1>#

Device type for recombination kernels.

Template Parameters:
  • ndim_velocity – The number of dimensions for the particle velocity property.

  • ndim_source_momentum – The number of dimensions for source momentum property.

  • has_momentum_req_data – The boolean specifying whether a projectile momentum req_data is available.

Public Functions

RecombReactionKernelsOnDevice() = default#
inline void scattering_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Recombination scattering kernel - assumes that pre_req_data stores the neutral velocities sampled from the existing marker particle distribution and sets the product’s velocity to those values (note that the elements of pre_req_data that are relevant in this case are all but the 0th which is reserved for storing data used for calculating the projectile source energy loss).

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void weight_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Recombination weight kernel - simply sets the product’s weight to the weight change due to the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void transformation_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Recombination transformation kernel - simply sets the product’s ID to the target ID.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 1> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which apply is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to be operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

Public Members

INT weight_ind#
INT projectile_source_density_ind#
INT projectile_source_energy_ind#
INT projectile_source_momentum_ind#
INT target_source_density_ind#
INT target_source_momentum_ind#
INT target_source_energy_ind#
INT descendant_internal_state_ind#
INT descendant_velocity_ind#
INT descendant_weight_ind#
REAL target_mass#
REAL normalised_potential_energy#
template<typename RNG_KERNEL>
struct SamplerData : public VANTAGE::Reactions::ReactionDataBase<SamplerDataOnDevice<RNG_KERNEL>, 1, RNG_KERNEL>#
#include <sampler_data.hpp>

On host reaction data class for sampling one number from an rng_kernel (to be used in pipelines)

Template Parameters:

RNG_KERNEL – The RNG kernel type

Public Functions

inline SamplerData(std::shared_ptr<RNG_KERNEL> rng_kernel, std::map<int, std::string> properties_map = get_default_map())#

Constructor for SamplerData.

Parameters:
  • rng_kernel – Shared pointer to kernel to be used

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline virtual void index_on_device_object()#

Index the panic flag on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr auto required_simple_int_props = std::array<int, 1>{props.panic}#
template<typename RNG_KERNEL>
struct SamplerDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<1, RNG_KERNEL>#
#include <sampler_data.hpp>

On device: ReactionData sampling a single random number from a random kernel.

Template Parameters:

RNG_KERNEL – The RNG kernel type

Public Functions

SamplerDataOnDevice() = default#
inline std::array<REAL, 1> calc_data(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename RNG_KERNEL::KernelType &rng_kernel) const#

Sample one number from the rng_kernel.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • rng_kernel – The random number generator kernel to sample from

Returns:

Sampled random number (in the form of a REAL-valued array of size 1).

Public Members

int panic_ind#
template<size_t DIM>
struct ScalerArrayTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM, DIM>#

Unary array transform multiplying each element of the array with a scalar.

Template Parameters:

DIM – The expected input/output size

Public Functions

ScalerArrayTransform() = default#
inline ScalerArrayTransform(const REAL &mult)#

Constructor of PolynomialArrayTransform.

Parameters:

mult – The multiplicative constant to be used

inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

REAL mult#
struct SimpleRemovalTransformationStrategy : public VANTAGE::Reactions::TransformationStrategy#

Simple transformation strategy that will remove all particles in the passed NP::ParticleSubGroup.

Public Functions

SimpleRemovalTransformationStrategy() = default#
virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Remove all particle in given subgroup.

Parameters:

target_subgroup – ParticleSubgroup to remove

struct SimpleThinningKernels : public VANTAGE::Reactions::DownsamplingKernelBase<DownsamplingMode::thinning, DownsamplingReductionKernelOnDeviceBase<0, 0, 0>, SimpleThinningOnDevice>#

Host-side simple thinning kernels, taking a thinning ratio < 0, representing the probability of a particle being kept after thinning.

Required properties are the particle weight and the panic flag (used to report rng sampling issues)

Public Functions

SimpleThinningKernels(REAL thinning_ratio, std::shared_ptr<NP::HostPerParticleBlockRNG<REAL>> rng_kernel, std::map<int, std::string> properties_map = get_default_map())#

Simple thinning kernels constructor.

Parameters:
  • thinning_ratio – The probability of the particle being kept and its weight increased by 1/thinning_ratio

  • rng_kernel – Shared-pointer to a uniform variate NP::HostPerParticleBlockRNG kernel used to sample the random number for comparison with the thinning ratio

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 1> required_simple_real_props = {props.weight}#
static constexpr std::array<int, 1> required_simple_int_props = {props.panic}#
struct SimpleThinningOnDevice : public VANTAGE::Reactions::DownsamplingKernelOnDeviceBase<0, NP::HostPerParticleBlockRNG<REAL>>#

On-device simple thinning kernel, requires an RNG kernel with a single per particle uniform random variate.

Simple thinning sets particle weights to either k*weight with the probability 1/k, and otherwise deletes the particle. This makes it conserve weight on average, but otherwise does not have any conservation properties.

Public Functions

SimpleThinningOnDevice() = default#
inline SimpleThinningOnDevice(REAL thinning_ratio)#

Constructor for SimpleThinningOnDevice object.

Parameters:

thinning_ratio – The probability of the particle being kept and its weight increased by 1/thinning_ratio

inline void apply_no_red(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Write<REAL> &req_real_props, typename NP::HostPerParticleBlockRNG<REAL>::KernelType &rng_kernel) const#

Apply the thinning algorithm.

Parameters:
  • index – LoopIndex accessor used for linear indexing

  • req_int_props – SymVector Write access to required integer properties

  • req_real_props – SymVector Write access to required real properties

  • rng_kernel – RNG kernel, if required

Public Members

int weight_ind#
int panic_ind#
REAL inverse_thinning_ratio#
REAL thinning_ratio#
struct Species#

Species struct to hold a limited description of a species that may be used in reactions.

Public Functions

Species() = default#
Species(std::string name, REAL mass, REAL charge, INT id)#

Constructor for Species.

Parameters:
  • name – String defining the name of the species.

  • mass – REAL value of the mass of the species (in atomic units).

  • charge – REAL value of the charge of the species (in atomic units).

  • id – INT value that corresponds to the ID of the species.

Species(std::string name)#

Constructor for Species that only sets name.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

name – String defining the name of the species.

Species(std::string name, REAL mass)#

Constructor for Species that only sets name and mass.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • name – String defining the name of the species.

  • mass – REAL value of the mass of the species (in atomic units).

Species(std::string name, REAL mass, REAL charge)#

Constructor for Species that only sets name, mass and charge.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:
  • name – String defining the name of the species.

  • mass – REAL value of the mass of the species (in atomic units).

  • charge – REAL value of the charge of the species (in atomic units).

std::string get_name() const#

Getters and setters for name, mass, charge and id of the species.

INT get_id() const#
REAL get_mass() const#
REAL get_charge() const#
void set_name(const std::string &name)#
void set_id(const INT &id)#
void set_mass(const REAL &mass)#
void set_charge(const REAL &charge)#
bool has_id() const#

Return true if this species has an id associated with it.

Returns:

True if this species has an id associated with it

Private Members

std::optional<std::string> name#
std::optional<INT> id#
std::optional<REAL> mass#
std::optional<REAL> charge#
template<size_t ndim>
struct SpecularReflectionData : public VANTAGE::Reactions::ReactionDataBase<SpecularReflectionDataOnDevice<ndim>, ndim, DEFAULT_RNG_KERNEL, ndim>#

ReactionData calculating specularly reflected velocity given ingoing velocity and surface normal.

Template Parameters:

ndim – The velocity space dimensionality

Public Functions

inline SpecularReflectionData(std::map<int, std::string> properties_map = get_default_map())#

Constructor for SpecularReflectionData.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

inline virtual void index_on_device_object()#

Index the surface normal properties on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 1> required_simple_real_props = {props.boundary_intersection_normal}#
template<size_t ndim>
struct SpecularReflectionDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<ndim, DEFAULT_RNG_KERNEL, ndim>#

On device: ReactionData calculating specularly reflected velocity given ingoing velocity and surface normal.

Template Parameters:

ndim – The velocity space dimensionality

Public Functions

SpecularReflectionDataOnDevice() = default#
inline std::array<REAL, ndim> calc_data(const std::array<REAL, ndim> input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename ReactionDataBaseOnDevice<ndim>::RNG_KERNEL_TYPE::KernelType &kernel) const#

Function to calculate the specularly reflected velocities.

Parameters:
  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size ndim that contains the calculated reflected velocities.

Public Members

int normal_ind#
template<int ndim_velocity = 2>
struct SpecularReflectionKernels : public VANTAGE::Reactions::ReactionKernelsBase#

Host type for simple specular reflection kernels, without any surface feedback.

Template Parameters:

ndim_velocity – Optional number of dimensions for the particle velocity property (default value of 2)

Public Functions

inline SpecularReflectionKernels(std::map<int, std::string> properties_map = get_default_map())#

Specular reflection host type constructor.

Parameters:

properties_map – A std::map<int, std::string> object to be to be passed to ReactionKernelsBase, used in remapping property names.

inline auto get_on_device_obj()#

Getter for the SYCL device-specific struct.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 3> required_simple_real_props = {props.weight, props.velocity, props.boundary_intersection_normal}#

Private Members

SpecularReflectionKernelsOnDevice<ndim_velocity> specular_reflection_kernels_on_device#
template<int ndim_velocity>
struct SpecularReflectionKernelsOnDevice : public VANTAGE::Reactions::ReactionKernelsBaseOnDevice<0>#

Device type for specular reflection surface process.

Template Parameters:

ndim_velocity – The number of dimensions for the particle velocity property.

Public Functions

SpecularReflectionKernelsOnDevice() = default#
inline void feedback_kernel(REAL &modified_weight, NP::Access::LoopIndex::Read &index, NP::Access::DescendantProducts::Write &descendant_products, NP::Access::SymVector::Write<INT> &req_int_props, NP::Access::SymVector::Write<REAL> &req_real_props, const std::array<int, 0> &out_states, NP::Access::NDLocalArray::Read<REAL, 2> &pre_req_data, double dt) const#

Feedback kernel for calculating and applying background field modifications from the reaction.

Parameters:
  • modified_weight – The weight modification needed for calculating the changes to the background fields.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which descendant_product_loop is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • descendant_products – Write accessor to descendant products that may need to operated on

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for operations inside the kernel.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for operations inside the kernel.

  • out_states – Array defining the IDs of descendant particles

  • pre_req_data – Real-valued NP::NDLocalArray containing pre-calculated data

  • dt – The current time step size.

Public Members

INT velocity_ind#
INT normal_ind#
INT weight_ind#
struct SphericalBasisReflectionData : public VANTAGE::Reactions::ReactionDataBase<SphericalBasisReflectionDataOnDevice, 3, DEFAULT_RNG_KERNEL, 3>#

ReactionData calculating reflected velocity from components in the spherical coordinate system derived from the surface normal and the velocity vector of the particle. The vectors of the local basis are:

x - in the direction along the projection of the velocity onto the surface y - in the plane of the surface, perpendicular to x z - along the surface normal pointing into the domain

The input array is expected to be a size 3 array with entries for the reflected velocity magnitude, and two angles, theta and phi, giving angles with the z and x basis vectors, respectively.

Public Functions

SphericalBasisReflectionData(std::map<int, std::string> properties_map = get_default_map())#

Constructor for SphericalBasisReflectionData.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names.

virtual void index_on_device_object()#

Index the particle velocity and surface normal properties on the on-device object.

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.velocity, props.boundary_intersection_normal}#
struct SphericalBasisReflectionDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<3, DEFAULT_RNG_KERNEL, 3>#

On device: ReactionData calculating a reflected velocity vector in a spherical basis determined by the ingoing velocity and the normal, and with the spherical coordinates expected as the input.

The expected inputs are a size 3 array with entries for the reflected v, theta and phi, where theta is the angle wrt to the normal, and phi is the angle with respect to the velocity projection onto the surface

Works only for 3D

Public Functions

SphericalBasisReflectionDataOnDevice() = default#
inline std::array<REAL, 3> calc_data(const std::array<REAL, 3> input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename DEFAULT_RNG_KERNEL::KernelType &kernel) const#

Function to calculate the reflected velocities using post-reflection values in spherical coordinates.

Parameters:
  • input – The v, theta, phi components of the reflected vector

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

A REAL-valued array of size 3 that contains the calculated reflected velocities.

Public Members

int normal_ind#
int vel_ind#
struct StandardPropertiesEnum#

Data from this struct is used to access property names in a map from PropertiesMap.

This can be extended by deriving from this struct and defining a public enum member with the first element being the value of the last element in StandardPropertiesEnum+1. For example:

struct CustomPropertiesEnum : StandardPropertiesEnum {
public:
enum {
      custom_prop_1 = StandardPropertiesEnum::fluid_flow_speed+1,
      custom_prop_2,
      custom_prop_3
    };
};
Further chaining would work on the same principle.

Public Types

enum StandardPropertyID#

Values:

enumerator reacted_flag#
enumerator grouping_index#
enumerator linear_index#
enumerator panic#
enumerator position#
enumerator velocity#
enumerator cell_id#
enumerator id#
enumerator tot_reaction_rate#
enumerator weight#
enumerator internal_state#
enumerator boundary_intersection_point#
enumerator boundary_intersection_normal#
enumerator boundary_intersection_metadata#
enumerator temperature#
enumerator density#
enumerator flow_speed#
enumerator source_energy#
enumerator source_momentum#
enumerator source_density#
enumerator surface_basis_e1#
enumerator surface_basis_e2#
enumerator surface_basis_pi#
enumerator fluid_density#
enumerator fluid_temperature#
enumerator fluid_flow_speed#
struct TransformationStrategy : public VANTAGE::Reactions::ProfilingBase#

Abstract base class for transformation strategies. All transformation strategies take a NP::ParticleSubGroupSharedPtr and perform an arbitrary transformation on it.

Subclassed by VANTAGE::Reactions::CellwiseAccumulator< T >, VANTAGE::Reactions::CellwiseDistributor< T >, VANTAGE::Reactions::CellwiseReactionDataAccumulator< ReactionData >, VANTAGE::Reactions::CompositeTransform, VANTAGE::Reactions::DownsamplingStrategy< DOWNSAMPLING_KERNEL >, VANTAGE::Reactions::MergeTransformationStrategy< ndim >, VANTAGE::Reactions::NoOpTransformationStrategy, VANTAGE::Reactions::ParticleDatZeroer< T >, VANTAGE::Reactions::SimpleRemovalTransformationStrategy, VANTAGE::Reactions::TransformationStrategyDirect< KERNEL, ARGS >, VANTAGE::Reactions::TransformationStrategyLambda< LAMBDA >, VANTAGE::Reactions::WeightedCellwiseAccumulator< T >

Public Functions

TransformationStrategy() = default#
virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup)#

This is the method that downstream specialisations of this class should override. Callers of the transformation strategy should call the transform method.

Parameters:

target_subgroup – NP::ParticleSubGroup to be transformed.

virtual void transform(NP::ParticleSubGroupSharedPtr target_subgroup)#

This is the method which should be called by downstream code to apply a transformation. This method internall calls transform_v to apply the transformation. To implement a transformation in a specialisation class the transform_v method should be overridden.

Parameters:

target_subgroup – NP::ParticleSubGroup to be transformed.

virtual ~TransformationStrategy() = default#
template<typename KERNEL, typename ...ARGS>
struct TransformationStrategyDirect : public VANTAGE::Reactions::TransformationStrategy#

Direct transformation strategy, providing an escape hatch to the NESO-Particles loop constructor interface, and acting as a closure in everything other than the iteration set.

Template Parameters:
  • KERNEL – The NESO-Particle loop construction lambda kernel

  • ARGS – Variadic arguments for the NESO-Particle kernel (access descriptors)

Public Functions

TransformationStrategyDirect() = default#
inline TransformationStrategyDirect(std::string &&name, KERNEL &&kernel, ARGS&&... args)#

Constructor for the direct transformation strategy.

Parameters:
  • name – Name of the transformation strategy - used as the loop name and for profiling

  • kernel – Body of the NESO-Particles loop function

  • args – Accessor arguments for the NP loop function

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target) override#

This is the method that downstream specialisations of this class should override. Callers of the transformation strategy should call the transform method.

Parameters:

target_subgroup – NP::ParticleSubGroup to be transformed.

inline virtual std::string get_profiling_name() override#
Returns:

A name of the class that is being profiled. Override for a better name.

Private Members

std::string loop_name#
std::tuple<ARGS...> stored_args#
KERNEL kernel#
template<typename LAMBDA>
struct TransformationStrategyLambda : public VANTAGE::Reactions::TransformationStrategy#

Transformation strategy allowing for an arbitrary lambda function to be applied to a particle subgroup.

Template Parameters:

LAMBDA – the function object class

Public Functions

TransformationStrategyLambda() = default#
inline TransformationStrategyLambda(std::string name, LAMBDA &&lambda)#

TransformationStrategyLambda constructor.

Parameters:
  • name – Name of the transformation strategy (for profiling)

  • lambda – Function object to be applied to passed particle subgroups

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target) override#

This is the method that downstream specialisations of this class should override. Callers of the transformation strategy should call the transform method.

Parameters:

target_subgroup – NP::ParticleSubGroup to be transformed.

inline virtual std::string get_profiling_name() override#
Returns:

A name of the class that is being profiled. Override for a better name.

Private Members

std::string name#
LAMBDA stored_lambda#
struct TransformationWrapper#

Wrapper class containing a marking and a transformation strategy to be applied to a NP::ParticleGroup. Its responsibility is to apply the two strategies in order to transform those particles in a NP::ParticleGroup that satisfy some condition.

Public Functions

TransformationWrapper() = delete#
TransformationWrapper(std::vector<std::shared_ptr<MarkingStrategy>> marking_strategy, std::shared_ptr<TransformationStrategy> transformation_strategy)#

Constructor for TransformationWrapper.

Parameters:
TransformationWrapper(std::shared_ptr<TransformationStrategy> transformation_strategy)#

Constructor for TransformationWrapper that only sets the transformation strategy.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

Parameters:

transformation_strategy – A shared pointer of a TransformationStrategy.

template<typename PARENT>
inline void transform(std::shared_ptr<PARENT> target)#

Applies the marking and transformation strategies to a given NP::ParticleGroup or NP::ParticleSubGroup, transforming those particles that satisfy some condition.

Parameters:

target – NP::ParticleGroup or NP::ParticleSubGroup to transform

template<typename PARENT>
inline void transform(std::shared_ptr<PARENT> target, int cell_id)#

Applies the marking and transformation strategies to a given NP::ParticleGroup or NP::ParticleSubGroup, transforming those particles that satisfy some condition in a given cell.

Parameters:
  • target – NP::ParticleGroup or NP::ParticleSubGroup to transform

  • cell_id – Local cell id index to restrict the transformation to

template<typename PARENT>
inline void transform(std::shared_ptr<PARENT> target, int cell_id_start, int cell_id_end)#

Applies the marking and transfomation strategies to a given NP::ParticleGroup, transforming those particle that satisfy some condition in a given block of cells.

Parameters:
  • target – NP::ParticleGroup to transform

  • cell_id_start – Local cell id block start index to restrict the transformation to

  • cell_id_end – Local cell id block end index to restrict the transformation to

void add_marking_strategy(std::shared_ptr<MarkingStrategy> marking_strategy)#

Add marking strategy to transfomation wrapper, adding its condition to the wrapper.

Parameters:

marking_strategy – Strategy to be added

virtual ~TransformationWrapper() = default#

Private Members

std::vector<std::shared_ptr<MarkingStrategy>> marking_strat#
std::shared_ptr<TransformationStrategy> transformation_strat#
template<int input_ndim>
struct TrimEvalData : public VANTAGE::Reactions::ReactionDataBase<TrimEvalDataOnDevice<input_ndim>>#
#include <trim_eval_data.hpp>

Reaction rate data calculation managing buffers for grid, coords, dims, and trim_dims, enabling on-device tabulated distribution evaluation.

The evaluation works with the NP::BufferDevice objects that are constructed for the input vectors (grid, coords_vec, dims_vec, trim_dims_vec). All input vectors are 1D vectors and are accessed using the logic in the on-device calc_data(…). The interpolated points are calculated with the same indexing as in CartesianGridDataOnDevice. The TRIM dimensions are uniformly binned. The TRIM grid data for each interpolation point is a concatenation of nested tables whose sizes are determined by cumulative products of trim_dims_vec entries. The grid_stride member stores the total size of this concatenation and is precomputed in the constructor. It’s effectively a two-stage calculation for itrim_dim: sum(product(trim_dims_vec[jtrim_dim] for jtrim_dim= 0 to jtrim_dim = itrim_dim) for itrim_dim = 0 to itrim_dim = output_ndim).

Template Parameters:
  • input_ndim – Total input dimensionality (interpolation plus TRIM dimensions).

  • output_ndim – Number of TRIM dimensions (size of the returned value array).

Public Functions

inline TrimEvalData(const std::vector<REAL> &grid, const std::vector<REAL> &coords_vec, const std::vector<size_t> &dims_vec, const std::vector<size_t> &trim_dims_vec, NP::SYCLTargetSharedPtr sycl_target, std::map<int, std::string> properties_map = get_default_map())#

Constructor for TrimEvalData.

Parameters:
  • grid – Flat vector of grid values (tabulated distribution data).

  • coords_vec – Coordinate boundaries for the interpolation dimensions (used for index computation).

  • dims_vec – Grid dimensions for the interpolation axes.

  • trim_dims_vec – Trim grid dimensions (ie. number of bins per TRIM axis).

  • sycl_target – SYCL target shared pointer used for buffer allocation.

  • properties_map – Map of property indices to names.

inline TrimEvalData(const GridDescriptor<interp_ndim, output_ndim> &grid_descriptor, NP::SYCLTargetSharedPtr sycl_target, std::map<int, std::string> properties_map = get_default_map())#

Construct from a GridDescriptor object.

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

inline void index_on_device_obj()#

Index the panic flag on the on-device object.

Public Members

std::shared_ptr<NP::BufferDevice<REAL>> d_coords#
std::shared_ptr<NP::BufferDevice<size_t>> d_dims#
std::shared_ptr<NP::BufferDevice<size_t>> d_trim_dims#
std::shared_ptr<NP::BufferDevice<REAL>> d_grid#

Public Static Attributes

static constexpr int output_ndim = 3#
static constexpr int interp_ndim = input_ndim - output_ndim#
static constexpr auto props = default_properties#
static constexpr std::array<int, 1> required_simple_int_props = {props.panic}#
template<int input_ndim>
struct TrimEvalDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<3, DEFAULT_RNG_KERNEL, input_ndim>#
#include <trim_eval_data.hpp>

On device: Reaction rate data calculation evaluating a tabulated distribution by computing grid indices for interpolation dimensions and binning the remaining TRIM dimensions against nested table values.

TRIM = TRansport of Ions in Matter.

An input coordinate is split into two parts. The first interp_ndim components (where interp_ndim = input_ndim - output_ndim) are interpolation coordinates. For each such component an index for it in the corresponding coordinate vector is computed, exactly as in CartesianGridDataOnDevice. These per-dimension indices are flattened with row-major ordering into a flat grid index, and the base data offset is flat_index * grid_stride, (details of the grid_stride calculation are in the TrimEvalData docstrings).

The remaining output_ndim components are TRIM coordinates between 0.0 and 1.0. Each is uniformly binned against the corresponding entry in d_trim_dims. The grid data for a single interpolation point is a concatenation of nested arrays. Data corresponding to the first output dimension occupies a 1-D array of length d_trim_dims[0]; the second occupies a 2-D array of size d_trim_dims[0] * d_trim_dims[1] starting immediately after the first; the third occupies a 3-D array of size d_trim_dims[0] * d_trim_dims[1] * d_trim_dims[2] starting immediately after the second; in general the table for output dimension idim has size: product(d_trim_dims[jdim] for jdim = 0 to idim). To read output idim, the flattened nested data at d_grid[grid_access_point] has to be accessed by calculating a field_access_point and a field_stride and adding those to the binned_input[idim]. This total is then added to grid_access_point to get the index of the trim_vals[idim].

The setup of the nested tables and the details of accessing the elements can be found in the EIRENE documentation (in section 4): https://www.eirene.de/old_eirene/trim.pdf

Template Parameters:

input_ndim – Total input dimensionality (interpolation plus TRIM dimensions).

Public Functions

inline TrimEvalDataOnDevice()#
inline TrimEvalDataOnDevice(const std::shared_ptr<NP::BufferDevice<REAL>> &d_grid, const std::shared_ptr<NP::BufferDevice<REAL>> &d_coords, const std::shared_ptr<NP::BufferDevice<size_t>> &d_dims, const std::shared_ptr<NP::BufferDevice<size_t>> &d_trim_dims)#

Constructor for TrimEvalDataOnDevice.

Parameters:
  • d_grid – Shared pointer to a device buffer containing the tabulated distribution data.

  • d_coords – Shared pointer to a device buffer containing coordinate boundaries for the interpolation dimensions.

  • d_dims – Shared pointer to a device buffer containing grid dimensions for the interpolation axes.

  • d_trim_dims – Shared pointer to a device buffer containing TRIM grid dimensions.

inline std::array<REAL, output_ndim> calc_data(const std::array<REAL, input_ndim> &input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, DEFAULT_RNG_KERNEL::KernelType &rng_kernel) const#

Function to evaluate the tabulated TRIM distribution. Computes grid indices for the interpolation dimensions, bins the TRIM dimensions, and returns the values for the computed flat index from the nested data at the interpolation point.

Parameters:
  • input – The input coordinate array of size input_ndim.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation. The panic counter is incremented when a TRIM coordinate falls outside 0.0 and 1.0.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation (unused here).

  • rng_kernel – The random number generator kernel potentially used in the calculation (unused here).

Returns:

A REAL-valued array of size output_ndim containing the TRIM values at the interpolation point.

Public Members

int grid_stride#
REAL const *d_grid_ptr#
REAL const *d_coords_ptr#
size_t const *d_dims_ptr#
size_t const *d_trim_dims_ptr#
int panic_ind#

Public Static Attributes

static constexpr int output_ndim = 3#
static constexpr int interp_ndim = input_ndim - output_ndim#
template<size_t DIM_IN, size_t DIM_OUT, typename OP>
struct UnaryArrayOperatorTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM_IN, DIM_OUT>#

Unary full array transform.

Template Parameters:
  • DIM_IN – The size of the transformed array

  • DIM_OUT – The size of the transformed array

  • OP –

    Unary operator to be used (a struct with operator(const

    std::array<REAL,DIM_IN>& input) defined)

Public Functions

UnaryArrayOperatorTransform() = default#
inline UnaryArrayOperatorTransform(const OP &op)#

Constructor for UnaryArrayOperatorTransform.

Parameters:

op – Unary operator.

inline std::array<REAL, DIM_OUT> apply(const std::array<REAL, DIM_IN> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

OP op#
template<typename TRANSFORM>
struct UnaryArrayTransformData : public VANTAGE::Reactions::ReactionDataBase<UnaryArrayTransformDataOnDevice<TRANSFORM>, TRANSFORM::OUT_DIM, DEFAULT_RNG_KERNEL, TRANSFORM::IN_DIM>#

Host type for data applying a unary transform on an input array.

Template Parameters:

TRANSFORM – The transformation type being applied

Public Functions

inline UnaryArrayTransformData(const TRANSFORM &transform)#

Constructor for UnaryArrayTransformData.

Parameters:

transform – Unary transform object (derived from AbstractUnaryTransform) to be applied on input data

inline virtual void index_on_device_object()#

No-op since there are no required properties to index.

template<typename TRANSFORM>
struct UnaryArrayTransformDataOnDevice : public VANTAGE::Reactions::ReactionDataBaseOnDevice<TRANSFORM::OUT_DIM, DEFAULT_RNG_KERNEL, TRANSFORM::IN_DIM>#

On-device reaction data applying a unary array transform to an input array.

Template Parameters:

TRANSFORM – Transform derived from AbstractUnaryArrayTransform

Public Functions

UnaryArrayTransformDataOnDevice() = default#
inline UnaryArrayTransformDataOnDevice(const TRANSFORM &transform)#

Constructor of UnaryArrayTransformDataOnDevice.

Parameters:

transform – The transform object to be applied

inline std::array<REAL, TRANSFORM::OUT_DIM> calc_data(const std::array<REAL, TRANSFORM::IN_DIM> &input, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename DEFAULT_RNG_KERNEL::KernelType &kernel) const#

Return the result of applying the contained transform on the input.

Parameters:
  • input – Input array

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction rate calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction rate calculation.

  • kernel – The random number generator kernel potentially used in the calculation

Returns:

Result of applying the contained transform

Private Members

TRANSFORM transform#
template<size_t DIM, typename OP>
struct UnaryElementwiseOperatorTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM, DIM>#

Unary element-wise transform.

Template Parameters:
  • DIM – The size of the transformed array

  • OP –

    Unary operator to be used (a struct with operator(const REAL&

    input) defined)

Public Functions

UnaryElementwiseOperatorTransform() = default#
inline UnaryElementwiseOperatorTransform(const OP &op)#

Constructor for UnaryElementwiseOperatorTransform.

Parameters:

op – Unary operator.

inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

OP op#
template<size_t DIM>
struct UnaryProjectArrayTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM, DIM>#

Unary array transform projecting the input on a fixed input vector.

Template Parameters:

DIM – The expected input/output size

Public Functions

UnaryProjectArrayTransform() = default#
inline UnaryProjectArrayTransform(const std::array<REAL, DIM> &dir)#

Constructor of UnaryProjectArrayTransform.

Parameters:

dir – The array representing the projection direction vector

inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

std::array<REAL, DIM> dir#
template<size_t DIM>
struct UnaryProjectNormalArrayTransform : public VANTAGE::Reactions::AbstractUnaryArrayTransform<DIM, DIM>#

Unary array transform projecting the input onto the plane normal to a fixed vector, i.e. (I-P)*x where P is the projection operator and x the input.

Template Parameters:

DIM – The expected input/output size

Public Functions

UnaryProjectNormalArrayTransform() = default#
inline UnaryProjectNormalArrayTransform(const std::array<REAL, DIM> &dir)#

Constructor of UnaryProjectArrayTransform.

Parameters:

dir – The array representing the projection direction vector

inline std::array<REAL, DIM> apply(const std::array<REAL, DIM> &input) const#

Function to apply the transform.

Parameters:

input – REAL-valued array of size DIM to which the transform is applied.

Returns:

REAL-valued array of size DIM that is the transformed array.

Private Members

std::array<REAL, DIM> dir#
template<size_t ndim>
struct VranicMergingKernels : public VANTAGE::Reactions::DownsamplingKernelBase<DownsamplingMode::merging, VranicReductionOnDevice<ndim>, VranicMergingOnDevice<ndim>>#

Host-side Vranic merging algorithm kernels.

Required properties are the particle weights and velocity

Template Parameters:

ndim – The dimensionality of the velocity space

Public Functions

inline VranicMergingKernels(std::map<int, std::string> properties_map = get_default_map())#

Constructor for host-side VranicMergingKernels object.

Parameters:

properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names - here weight and velocity

Public Static Attributes

static constexpr auto props = default_properties#
static constexpr std::array<int, 2> required_simple_real_props = {props.weight, props.velocity}#
template<size_t ndim>
struct VranicMergingOnDevice : public VANTAGE::Reactions::DownsamplingKernelOnDeviceBase<2>#

The on-device merging object, setting the values of post-merge properties on each of the remaining 2 particles.

Implementation of simplified merging algorithm from M. Vranic et al. Computer Physics Communications 191 2015.

The assumption is that all particles being merged are of the same species, i.e. have the same mass and that they are non-relativistic.

Particles are merged group-wise and cell-wise into 2 particles. The properties modified are the positions, weights, and momenta/velocities. Other properties are sampled from 2 other particles in the passed subgroup, i.e. things like cell or particle ids will be copied consistently, but there is no reduction of other real quantities. This means that those values will be lost, so this algorithm should be called only AFTER they are no longer needed.

Template Parameters:

ndim – The dimensionality of the velocity space

Public Functions

VranicMergingOnDevice() = default#
inline void apply(const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Write<REAL> &req_real_props, NP::Access::CellDatConst::Read<REAL> &reduction, NP::Access::CellDatConst::Read<REAL> &reduction_min, NP::Access::CellDatConst::Read<REAL> &reduction_max, const size_t &reduction_idx, const size_t &linear_idx, typename DownsamplingKernelOnDeviceBase<2>::RNG_KERNEL_TYPE::KernelType &rng_kernel) const#

Apply the merging algorithm, assuming reduction has happened prior to the application.

Parameters:
  • index – LoopIndex accessor used for linear indexing

  • req_int_props – SymVector Write access to required integer properties

  • req_real_props – SymVector Write access to required real properties

  • reduction – Read access to additive cellwise reduction data

  • reduction_min – Read access to cellwise min reduction data

  • reduction_max – Read access to cellwise max reduction data

  • reduction_idx – Index determining which downsampling/reduction group the particle belongs to, in principle used to access the corresponding column of the reduction data

  • linear_idx – Linear index determining which of the post-downsampling particles the current particle is

  • rng_kernel – RNG kernel, if required

Public Members

int weight_ind#
int velocity_ind#
template<size_t ndim>
struct VranicReductionOnDevice : public VANTAGE::Reactions::DownsamplingReductionKernelOnDeviceBase<ndim + 2, ndim, ndim>#

The reduction kernels for the Vranic merging algorithm. They will calculate the total momentum and energy of the particles in each downsampling cell, as well as the minimum and maximum values of the particle velocities in each direction - to be used to generate bounding boxes in the above merging algorithm.

Template Parameters:

ndim – The dimensionality of the velocity space

Public Functions

VranicReductionOnDevice() = default#
inline void reduce(const NP::Access::SymVector::Read<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, NP::Access::CellDatConst::Add<REAL> &reduction, NP::Access::CellDatConst::Min<REAL> &reduction_min, NP::Access::CellDatConst::Max<REAL> &reduction_max, const size_t &reduction_idx) const#

Reduce the weight, momentum, and energy of the particles.

Parameters:
  • req_int_props – SymVector Read access to required integer properties

  • req_real_props – SymVector Read access to required real properties

  • reduction – Add access to additive cellwise reduction data

  • reduction_min – Min access to cellwise min reduction data

  • reduction_max – Max access to cellwise max reduction data

  • reduction_idx – Index determining which downsampling/reduction group the particle belongs to, in principle used to access the corresponding column of the reduction data

Public Members

int weight_ind#
int velocity_ind#
template<typename T>
struct WeightedCellwiseAccumulator : public VANTAGE::Reactions::TransformationStrategy#

Accumulates a set of particle dats cell-wise, while weighing them with a particle dat (should be dim 1). Also accumulates the weight separately.

Template Parameters:

T – REAL or INT

Public Functions

WeightedCellwiseAccumulator() = delete#
inline WeightedCellwiseAccumulator(NP::ParticleGroupSharedPtr template_group, std::vector<std::string> dat_names, std::string weight_sym_name)#

Constructor for WeightedCellwiseAccumulator.

Parameters:
  • template_group – A template particle group used to provide the CellDatConsts for the dats specified by dat_names.

  • dat_names – A vector of strings specifying the names of the dats to be accumulated cell-wise.

  • weight_sym_name – Name of the sym associated with the weight property.

inline virtual void transform_v(NP::ParticleSubGroupSharedPtr target_subgroup) override#

Accumulate the dats registered in this transform, weighing them with the particle dat declared as the weight. Also accumulates the weight. Does not modify the particles.

Parameters:

target_subgroup – Subgroup containing particles whose dats should be accumulated

inline NP::CellDatConstSharedPtr<REAL> get_value_pointer(std::string data_name)#

Get the pointer to underlying NP::CellDatConst for given named data.

Parameters:

data_name – Name of the particle dat to be extracted

inline void set_value_pointer(std::string data_name, NP::CellDatConstSharedPtr<REAL> cell_dat_const_ptr)#

Set the underlying NP::CellDatConst pointer for given named data.

Parameters:
  • data_name – Name of the particle dat to be set

  • cell_dat_const_ptr – Shared pointer to NP::CellDatConst<REAL>

inline std::vector<NP::CellData<REAL>> get_cell_data(std::string data_name)#

Extract the cell-wise accumulated data as a standard vector of NP::CellData objects.

Parameters:

data_name – Name of the particle dat to be extracted

inline NP::CellDatConstSharedPtr<REAL> get_weight_pointer()#

Get the pointer to underlying NP::CellDatConst for accumulated weight.

inline void set_weight_pointer(NP::CellDatConstSharedPtr<REAL> cell_dat_const_ptr)#

Set the underlying NP::CellDatConst pointer for given named data.

Parameters:

cell_dat_const_ptr – Shared pointer to NP::CellDatConst<REAL>

inline std::vector<NP::CellData<REAL>> get_weight_cell_data()#

Extract accumulated weight data in a vector of NP::CellData objects.

inline void zero_buffer(std::string data_name)#

Zero out the accumulation buffer for a given particle dat, or the weight, if the weight name is given.

Parameters:

data_name – Name of the dat whose associated buffer should be zeroed out

inline void zero_all_buffers()#

Zero out all accumulation buffers.

Private Members

std::vector<NP::Sym<T>> dats#
std::map<NP::Sym<T>, std::shared_ptr<NP::CellDatConst<REAL>>> values#
std::shared_ptr<NP::LocalArray<INT>> comp_nums#
std::string weight_sym_name#
std::shared_ptr<NP::CellDatConst<REAL>> weight_buffer#
namespace std#
namespace VANTAGE#
namespace Reactions#

The following host and device classes provide a method of interpolating values on an ND grid (represented by evaluations of a given ReactionData derived object). The algorithm used follows the method described in: https://www.nas.nasa.gov/assets/nas/pdf/staff/Murman_S_apnum_jun13.pdf

In short, the algorithm finds where the interpolation points lie in the discretized ND space that the grid is defined on. It then proceeds to construct a hypercube around the interpolation points. The grid values(which may be multi-dimensional) at each vertex of the hypercube are retrieved. With the vertex coordinates and function evaluations at the vertices, a recursive contraction of the hypercube, 1 dimension at a time, is performed. The final interpolated function evaluation is returned.

An illustrative example of contracting from 3D to 0D is shown here. Each vertex is 1 index apart so if V1 is defined as an origin (0,0,0) then V2 is (1,0,0), V3 is (0,1,0), etc. all the way to V8 being (1,1,1). This way only the location of the origin point in the ND space is needed to find the locations of the rest of the vertices. After contraction to 2D, P1 is now the “origin” at (0,0) and P3 is (1,1). This quadritlateral can be thought of as a slice of the preceding 3D hypercube around the point (x). Figure 2 of the provided Murman paper provides another illustration of how the algorithm works.

  V7-----------V8
 /|           / |
V5-----------V6 |
| |    (x)    | |
| V3----------|V4
|/            |/
V1-----------V2

       |
       |
       v

P4-----------P3
 |           |
 |    (x)    |
 |           |
P1-----------P2

       |
       |
       v

L1 ---(x) --- L2

       |
       |
       v

      (x)
The underlying maths of the contraction (simplified here) is: f(P1) = linear_interp(x(2), V1, V5, f(V1), f(V5)) f(P4) = linear_interp(x(2), V3, V7, f(V3), f(V7)) f(P2) = linear_interp(x(2), V2, V6, f(V2), f(V6)) f(P3) = linear_interp(x(2), V4, V8, f(V4), f(V8))

then

f(L1) = linear_interp(x(1), P1, P4, f(P1), f(P4)) f(L2) = linear_interp(x(1), P2, P3, f(P2), f(P3))

finally

f(x) = linear_interp(x(0), L1, L2, f(L1), f(L2))

Note x(0), x(1) and x(2) simply refers to the components of the 3D vector x corresponding to the dimension that’s being contracted.

Typedefs

using INT = NP::INT#
using REAL = NP::REAL#
typedef NP::NullKernelRNG<REAL> DEFAULT_RNG_KERNEL#

The general idea of downsampling is that we might want to reduce the number of particles while maintaining some properties of the ensemble, such as conserving various moments either on average or deterministically.

In general, these algorithms have the following structure:

  1. Reduction - (Optional) Reduce some number of quantities across the particle ensemble, such as weight, momentum, energy, etc.

  2. Downsampling - Change the properties of the particles such that some particles are effectively marked for removal while others have their properties set based on the downsampling algorthm (such as merging or thinning)

  3. Remove particles with 0 weight or otherwise marked for removal

The above algorithm is assumed to be applied for each downsampling group separately, and the downsampling algorithms assume that particles are grouped before the application of the downsampling. An example of downsampling is velocity/phase space binning.

The number of downsampling groups determines the size of the CellDatConsts used to store the group-wise particle property reductions, so all mentions below of reduction dimensionalities or indices refer to these individual downsampling groups.

template<typename T, typename ...Args>
using calc_data_return_t = typename calc_data_traits_defs::calc_data_traits<T, void, Args...>::return_type#

The return type of T::calc_data(Args…) (or void if not callable).

Enums

enum class DownsamplingMode#

Downsampling modes:

  1. merging - always requires reduction strategies, with the post-merge particles being the first downsampling_dim particles, and all of the rest are discarded

  2. thinning - does not require reduction strategies, but can use them, and performs the thinning transformation on all particles, removing those whose weight is set to 0 during the process

Values:

enumerator merging#
enumerator thinning#
enum class ControllerMode#

Enum class containing possible modes for the ReactionController.

Values:

enumerator standard_mode#

Standard mode, where every reaction is applied on part of the ingoing particle’s weight, with some weight potentially not participating in any reaction

enumerator semi_dsmc_mode#

Semi-deterministic Direct Simulation Monte Carlo (DSMC) method, where MC is used to get which particles go through a reaction, and then all possible reactions are applied to those particles, consuming them completely.

enumerator surface_mode#

Surface reaction mode, where every reaction is applied to all particles in the passed subgroup, with 100% of the weight of each particle participating

enum class ExtrapolationType#

Enum class containing possible modes for extrapolation for InterpolateData.

Values:

enumerator continue_linear#
enumerator clamp_to_zero#
enumerator clamp_to_edge#

Functions

bool panicked(NP::ParticleSubGroupSharedPtr particle_group, const std::map<int, std::string> &properties_map = get_default_map())#

Helper function to check if there are any panicked particles in a particle group.

Parameters:
  • particle_group – The particle group that contains the particles to be counted.

  • properties_map – (Optional) A std::map<int, std::string> object to be used to remap the NP::Sym for the Panic property.

Returns:

Boolean to indicate if any panicked particles exist in the particle group.

std::shared_ptr<TransformationStrategy> make_simple_thinning_strategy(NP::ParticleGroupSharedPtr template_group, REAL thinning_ratio, std::shared_ptr<NP::HostPerParticleBlockRNG<REAL>> rng_kernel, const std::map<int, std::string> &properties_map = get_default_map())#

Helper function for generating a simple thinning strategy.

Parameters:
  • template_group – The template group sharing the domain and sycl target of the particle group to which the transformation strategy is to be applied

  • thinning_ratio – The probability of the particle being kept and its weight increased by 1/thinning_ratio

  • rng_kernel – Shared-pointer to a uniform variate NP::HostPerParticleBlockRNG kernel used to sample the random number for comparison with the thinning ratio

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

std::map<int, std::string> get_default_map()#
bool map_subset_check(std::map<int, std::string> custom_map)#

Function to check whether a custom map is a subset of the default map.

Returns:

True if the given custom map is a subset of the default map.

bool operator==(const Species &lhs, const Species &rhs)#
std::string species_property(const Species &species, const std::string &property)#

Generate a species property name from the species and a property name string in a standardised way.

Parameters:
  • species – Species to use

  • property – Property name to use

Returns:

Species-specific property name

template<typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto operator+(const T &lhs, const U &rhs)#

Overload of the “+” operator for adding the outputs of two ReactionData objects using BinaryArrayTransformData. The addition is elementwise.

Example usage: auto result = obj1 + obj2; Where obj1 and obj2 both inherit from ReactionDataBase. The result can be treated as CompositeData-derived object.

template<typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto operator*(const T &lhs, const U &rhs)#

Overload of the “*” operator for multiplying the outputs of two ReactionData objects using BinaryArrayTransformData. The multiplication is elementwise.

Example usage: auto result = obj1 * obj2; Where obj1 and obj2 both inherit from ReactionDataBase. The result can be treated as CompositeData-derived object.

template<typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto operator-(const T &lhs, const U &rhs)#

Overload of the “-” operator for subtracting the outputs of two ReactionData objects using BinaryArrayTransformData. The subtraction is elementwise.

Example usage: auto result = obj1 - obj2; Where obj1 and obj2 both inherit from ReactionDataBase. The result can be treated as CompositeData-derived object.

template<typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto operator/(const T &lhs, const U &rhs)#

Overload of the “/” operator for dividing the outputs of two ReactionData objects using BinaryArrayTransformData. The division is elementwise.

Example usage: auto result = obj1 / obj2; Where obj1 and obj2 both inherit from ReactionDataBase. The result can be treated as CompositeData-derived object.

template<typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto dot_product(const T &lhs, const U &rhs)#

Helper function to apply a dot product to the outputs of two ReactionData objects using BinaryArrayTransformData. The dot product itself is applied via BinaryDotArrayTransform.

Example usage: auto result = dot_product(obj1, obj2); Where obj1 and obj2 both inherit from ReactionDataBase. The result can be treated as CompositeData-derived object.

Parameters:
  • lhs – ReactionData object (with the same output dimensions as rhs).

  • rhs – ReactionData object (with the same output dimensions as lhs).

Returns:

BinaryArrayTransformData object whose calc_data will output the result of the dot product.

template<size_t DIM>
inline auto scale_by(const REAL &mult)#

Helper function to generate a UnaryArrayTransformData that can be used to scale the output of a ReactionData object by a scalar.

Example usage: auto velocity_data = extract<3>(“VELOCITY”); auto doubler = scale_by<3>(2.0); auto pipeline = pipe(velocity_data, doubler)

The pipeline can be treated as CompositeData-derived object.

Parameters:

mult – REAL-valued scalar to multiply the elements of the output of a ReactionData object.

Returns:

UnaryArrayTransformData object whose calc_data will output an elementwise multiplication of the output of the calc_data of a ReactionData object.

template<size_t DIM_IN, typename LAMBDA>
inline auto uatData(const LAMBDA &lambda)#

Helper function to generate a UnaryArrayTransformData that can be used to pass the output of a ReactionData object to a lambda function.

Example usage: auto velocity_data = extract<2>(“VELOCITY”); auto vnorm_lambda = [](const std::array<REAL, 2> &arr) { return std::array<REAL, 1>{ std::sqrt(arr[0] * arr[0] + arr[1] * arr[1]) }; }; auto vnorm_lambda_wrapper = utils::LambdaWrapper<decltype(vnorm_lambda), 2>(vnorm_lambda); auto unary_transform_data = uatData<2, decltype(vnorm_lambda_wrapper)>(vnorm_lambda_wrapper); auto pipeline = pipe(velocity_data, unary_transform_data)

The pipeline can be treated as CompositeData-derived object.

Parameters:

lambda – A lambda wrapper object that defines the transformation to apply to a ReactionData object.

Returns:

UnaryArrayTransformData object whose calc_data will output a transformation of the output of the calc_data of a ReactionData object according to the lamdba argument.

template<size_t DIM_IN, typename LAMBDA>
inline auto uetData(const LAMBDA &lambda)#

Helper function to generate a UnaryArrayTransformData that can be used to pass the output of a ReactionData object to a lambda function elementwise.

Example usage: auto velocity_data = extract<2>(“VELOCITY”); auto vsquare_lambda = [](const REAL &v_comp) { return v_comp * v_comp; }; auto vsquare_lambda_wrapper = utils::LambdaWrapper(vsquare_lambda); auto unary_transform_data = uetData<2,decltype(vsquare_lambda_wrapper)>(vsquare_lambda_wrapper); auto pipeline = pipe(velocity_data, unary_transform_data)

The pipeline can be treated as CompositeData-derived object.

Parameters:

lambda – A lambda wrapper object that defines the elementwise transformation to apply to a ReactionData object.

Returns:

UnaryArrayTransformData object whose calc_data will output an elementwise transformation of the output of the calc_data of a ReactionData object according to the lamdba argument.

template<typename LAMBDA, typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto batData(const LAMBDA &lambda, const T &lhs, const U &rhs)#

Helper function to generate a BinaryArrayTransformData that can be used to pass the output of two ReactionData objects to a lambda function.

Parameters:
  • lambda – A lambda wrapper object that defines the transformation to apply to the ReactionData objects.

  • lhs – ReactionData object

  • rhs – ReactionData object

Returns:

BinaryArrayTransformData object whose calc_data will output the binary transformation that will be applied to the outputs of the calc_data of two ReactionData objects according to the lambda argument.

template<typename LAMBDA, typename T, typename U, std::enable_if_t<std::is_base_of<ReactionDataBase<typename T::ON_DEVICE_OBJ_TYPE, T::DIM, typename T::RNG_KERNEL_TYPE, 0>, T>::value, bool> = true>
inline auto betData(const LAMBDA &lambda, const T &lhs, const U &rhs)#

Helper function to generate a BinaryArrayTransformData that can be used to pass the output of two ReactionData objects to a lambda function to be operated on elementwise.

Parameters:
  • lambda – A lambda wrapper object that defines the elementwise transformation to apply to the ReactionData objects.

  • lhs – ReactionData object

  • rhs – ReactionData object

Returns:

BinaryArrayTransformData object whose calc_data will output the binary transformation that will be elementwise applied to the outputs of the calc_data of two ReactionData objects according to the lambda argument.

template<size_t ndim>
inline auto uniform_velocity_bin_transform(std::array<REAL, ndim> global_extents, std::array<INT, ndim> n_cells, NP::Sym<INT> bin_sym, NP::Sym<REAL> velocity_sym)#

Helper function generating a transformation binning particles in uniform velocity bins. Each of the directions has two guard cells, which will bin any particles outside of the main binning region. For example, if there is only one binning cell in each direction this results in 27 total binning cells - 3^3.

Parameters:
  • global_extents – std::array holding the total extents of the core binning cells in each direction, assumed symmetric around 0, i.e. binning into the region (-L/2,L/2]

  • n_cells – The number of core binning cells in each direction, the total in each direction including the guard cells being 2 greater than this

  • bin_sym – The NP::Sym representing the linear bin index - binning is done in the x,y,z order

  • velocity_sym – The velocity sym

template<typename ...DATATYPE>
inline std::tuple<typename DATATYPE::ON_DEVICE_OBJ_TYPE...> get_on_device_objs(std::tuple<DATATYPE...> &data)#

Getter that returns tuple of ReactionDataOnDevice objects associated with each DATATYPE object in data.

template<typename T>
constexpr size_t total_dim()#

Recursive helper function to accumulate the DIM-values of each ReactionData (or ReactionDataOnDevice) object in DATATYPE (specifically the size of the output of their on-device calc_data functions).

Use within ConcatenatorData or ConcatenatorDataOnDevice as: total_dim<DATATYPE…>();

template<typename T, typename U, typename ...DATATYPE>
constexpr size_t total_dim()#
template<size_t ndim>
inline std::shared_ptr<TransformationStrategy> make_vranic_merging_strategy(NP::ParticleGroupSharedPtr template_group, size_t num_merging_groups, const std::map<int, std::string> &properties_map = get_default_map())#

Helper function for generating a Vranic merging strategy.

Parameters:
  • template_group – The template group sharing the domain and sycl target of the particle group to which the transformation strategy is to be applied

  • num_merging_groups – The number of merging groups, i.e. velocity space bins or other downsampling group types

  • properties_map – (Optional) A std::map<int, std::string> object to be used when remapping property names

template<typename T>
constexpr size_t last_dim()#

Recursive helper function to retrieve the DIM-value of the last ReactionData (or ReactionDataOnDevice) object in DATATYPE (specifically the size of the output of its on-device calc_data function).

Use within PipelineData or PipelineDataOnDevice as: last_dim<DATATYPE…>();

template<typename T, typename U, typename ...DATATYPE>
constexpr size_t last_dim()#
template<typename T, typename ...DATATYPE>
constexpr size_t first_in_dim()#

Helper function to retrieve the INPUT_DIM-value of the first ReactionData (or ReactionDataOnDevice) object in DATATYPE.

Use within PipelineData or PipelineDataOnDevice as: first_in_dim<DATATYPE…>();

template<typename T>
constexpr bool check_consistency()#

Helper function to check that the INPUT_DIM-value of a given ReactionData object in DATATYPE equals the DIM-value of the previous ReactionData (or ReactionDataOnDevice) object.

Use within PipelineData or PipelineDataOnDevice as: check_consistency<DATATYPE…>();

template<typename T, typename U, typename ...DATATYPE>
constexpr bool check_consistency()#
template<typename ...DATATYPE>
inline auto pipe(DATATYPE... data)#

Helper function to construct a PipelineData object.

Parameters:

data – Variadic argument with all of the contained ReactionData objects

Returns:

PipelineData object.

template<typename T, typename Expected, typename ...Args>
constexpr bool check_calc_data_return_type()#

Check whether T::calc_data(Args…) returns exactly Expected.

This helper short-circuits: if the parameter signature is wrong, is_calc_data_callable_v is false and the function returns true so that a separate static_assert on parameter mismatch can be the only error emitted. When the parameter signature is correct but the return type differs, it returns false.

template<size_t n_comp>
inline auto extract(const std::string &name)#

Helper function to construct ExtractorData using the name of a NP::Sym<REAL>.

Template Parameters:

ncomp – Number of components of the dat to be extracted

Parameters:

name – Name of the NP::Sym<REAL> corresponding to the ParticleDat whose components should be extracted.

Returns:

Specified ExtractorData object.

template<typename MarkingStrategyDerived, typename ...ARGS>
inline std::shared_ptr<MarkingStrategy> make_marking_strategy(ARGS&&... args)#

Helper function for generating shared pointers of marking strategies by passing constructor arguments to individual derived classes.

Template Parameters:

MarkingStrategyDerived – The class name of the derived class of MarkingStrategy

Parameters:

args – Argument pack to be passed to the constructor of MarkingStrategyDerived

Returns:

std::shared_ptr<MarkingStrategy>

template<typename TransformationStrategyDerived, typename ...ARGS>
inline std::shared_ptr<TransformationStrategy> make_transformation_strategy(ARGS&&... args)#

Helper function for generating shared pointers of transformation strategies by passing constructor arguments to individual derived classes.

Template Parameters:

TransformationStrategyDerived – The class name of the derived class of TransformationStrategy

Parameters:

args – Argument pack to be passed to the constructor of TransformationStrategyDerived

Returns:

std::shared_ptr<TransformationStrategy>

template<typename KERNEL, typename ...ARGS>
inline std::shared_ptr<MarkingStrategy> make_direct_marking_strategy(std::string &&name, KERNEL &&kernel, ARGS&&... args)#

Helper function for constructing a direct MarkingStrategy shared ptr.

template<typename KERNEL, typename ...ARGS>
inline std::shared_ptr<TransformationStrategy> make_direct_transformation_strategy(std::string &&name, KERNEL &&kernel, ARGS&&... args)#

Helper function for construcing a direct transformation strategy.

template<typename LAMBDA>
inline std::shared_ptr<TransformationStrategy> make_lambda_transformation_strategy(std::string &&name, LAMBDA &&lambda)#

Helper function for constructing TransformationStrategy shared ptrs from lambda transformation strategies.

Variables

const auto default_properties = StandardPropertiesEnum()#
constexpr int PROFILING_LEVEL = 1024#
template<typename T, typename ...Args>
constexpr bool is_calc_data_callable_v = calc_data_traits_defs::calc_data_traits<T, void, Args...>::is_callable#

true if T::calc_data(Args…) is a valid call expression.

constexpr auto INF_INTERP_DOUBLE = std::numeric_limits<double>::infinity()#
namespace calc_data_traits_defs#

Compile-time helpers for checking that a derived on-device reaction-data type defines calc_data with the correct parameter signature and return type.

These traits use std::void_t SFINAE (Substitution Failure Is Not An Error) to detect whether T::calc_data(Args…) is a well-formed expression, and if so, what type it returns. They are used automatically inside ReactionDataBase::validate_on_device_type(), and may also be used manually in derived-class constructors if desired.

namespace grid_utils#

Functions

void append(REAL *ptr, size_t &offset, const REAL *data, size_t n)#

Append n REAL values from a raw pointer into the flat grid buffer at the current offset.

Parameters:
  • ptr – Pointer to the first value of the data that is to be copied to.

  • offset – Location to specify where in ptr to copy data to. This is updated post-copy so subsequent calls have the right offset.

  • data – Pointer to the first REAL value to copy.

  • n – Number of elements to copy. MUST be less than or equal to the size of data.

template<int ndim, typename FUNC>
inline void iterate_points(const std::array<std::vector<REAL>, ndim> &coords, const FUNC &func)#

Iterate over all grid points in row-major order (dimension 0 varies fastest) and execute a function at the calculated coordinates of each grid point.

Template Parameters:
  • ndim – Number of dimensions.

  • FUNC – Type of callable taking const std::array<REAL, ndim> & (coordinate values).

Parameters:
  • coords – Per-dimension coordinate vectors defining the grid.

  • func – Callable invoked once per grid point with the coordinate array.

template<typename Container>
inline void append(REAL *ptr, size_t &offset, const Container &data)#

Append elements from a container into the flat grid buffer at the current offset.

Template Parameters:

Container – Valid types: std::array<REAL, N>, std::vector<REAL>.

Parameters:
  • ptr – Pointer to the first value of the data that is to be copied to.

  • offset – Location to specify where in ptr to copy data to. This is updated post-copy so subsequent calls have the right offset.

  • data – Container of REAL values to copy.

Variables

template<typename T>
constexpr bool is_std_array_of_real_v = is_std_array_of_real<T>::value#

Helper variable template for is_std_array_of_real.

Template Parameters:

T – Type to check.

namespace interp_utils#

Functions

std::vector<size_t> construct_initial_hypercube(const size_t &ndim)#

Function to construct a series of points that constitute the vertices of N-Dimensional hypercube. The points are integers but the binary representations denote the normalised vertices. For example in 2D: 0, 1, 3, 2 where the binary representations would be: 00, 01, 11, 10 which would correspond to the vertices (0, 0), (0, 1), (1, 1), (1, 0).

Parameters:

ndim – The number of dimensions.

Returns:

std::vector<INT> That contains the points denoting the vertices of the hypercube.

template<typename T>
inline T binary_extract(const T &i, const size_t &j)#

Helper function that extracts the value of the binary representation of i at position j (in the binary representation of i).

inline INT coeff_index_on_device(INT const *indices, size_t const *dims_vec, const int &ndim)#

Helper function to calculate the index on a contiguous row-major grid array where the indices run from fastest index to slowest index.

Parameters:
  • indices – Pointer to a vector that contains the indices to access grid data (an index for each dimension of the non-flattened array).

  • dims_vec – Pointer to a vector that contains the size of each dimension.

  • ndim – The number of dimensions

Returns:

std::size_t that specifies the index on a contiguous grid array

inline size_t coord_index_on_device(const size_t &sub_index, const size_t &dim_index, size_t const *dims_vec)#

Similar to coeff_index_on_device in that it returns an index on a contiguous row-major array containing the coordinates of each dimension of relevance for the interpolation.

Parameters:
  • sub_index – The index for the specific dimension of interest

  • dim_index – The index of the dimension itself, as in for the 2nd dimension of a 4D grid, the dim_index=2

  • dims_vec – Pointer to a vector that contains the size of each dimension.

Returns:

std::size_t that specifies the index on a contiguous coords array.

inline size_t calc_floor_point_index(const REAL &x_interp, REAL const *dim_coords, const size_t &last_index)#

Helper function to calculate the index on a given dimension that is the closest to a given interpolation point. The preference is to provide the lowest(or left-most) index.

Parameters:
  • x_interp – Value of the interpolation point for a given dimension

  • dim_coords – Pointer to a vector containing the coordinate values for a given dimension.

  • last_index – The last index in the coordinate values of the given dimension.

Returns:

std::size_t The index on a given dimension that is the closest to x_interp.

inline REAL linear_interp(const REAL &x_interp, const REAL &x0, const REAL &x1, const REAL &f0, const REAL &f1)#

Function to perform a 1D linear interpolation.

Parameters:
  • x_interp – The interpolation point in a given dimension

  • x0 – The highest-value point on the dimension that is less than x_interp

  • x1 – The lowest-value point on the dimension that is greater than x_interp

  • f0 – The function value at x0.

  • f1 – The function value at x1.

Returns:

REAL value of the linearly interpolated function value at x_interp.

template<size_t index_ndim>
inline std::array<INT, index_ndim> bin_uniform_indices(const std::array<REAL, index_ndim> &u, const std::array<INT, index_ndim> &dims)#

Function to bin REAL-valued (between 0.0 and 1.0) elements of an input array, u, into INT-valued indices that lie between 0 and an upper limit defined by the elements of dims. For example with u = {0.1, 0.7, 0.3} and dims = {4, 6, 9} the output coords would be: {0, 4, 2}.

Template Parameters:

index_ndim – The size of the u array, the dims array and the output from the function.

Parameters:
  • u – REAL-valued array of size index_ndim that contains the values (between 0.0 and 1.0) that are to be converted to indices.

  • dims – INT-valued array of size index_ndim that contains values that define the upper limits for the results.

Returns:

An INT-valued array of size index_ndim that contains required indices.

template<typename DATATYPE, int output_ndim, int interp_ndim, int non_interp_ndim>
inline void initial_func_eval_on_device(REAL *vertex_func_evals, INT *vertex_coord, const DATATYPE &grid_func_data, INT const *origin_indices, size_t const *hypercube_vertices, REAL const *coords_vec, const std::array<REAL, non_interp_ndim> &non_interpolation_points, const std::array<size_t, interp_ndim> &interpolation_indices, const std::array<size_t, non_interp_ndim> &non_interpolation_indices, size_t const *dims_vec, const NP::Access::LoopIndex::Read &index, const NP::Access::SymVector::Write<INT> &req_int_props, const NP::Access::SymVector::Read<REAL> &req_real_props, typename NP::TupleRNG<std::shared_ptr<typename DATATYPE::RNG_KERNEL_TYPE>>::KernelType &rng_kernel)#

Function to calculate the initial function values on the vertices of the hypercube.

Template Parameters:
  • DATATYPE – ReactionDataBaseOnDevice derived type corresponding to the grid-function evaluation reaction data.

  • output_ndim – Number of dimensions of the output of the grid-function evaluation.

  • interp_ndim – Number of dimensions being interpolated.

  • non_interp_ndim – Number of non-interpolated dimensions (ie. dimensions passed through without modification to calc_data(…)).

Parameters:
  • vertex_func_evals – Pointer to a vector to fill with function evaluations.

  • vertex_coord – Pointer to a vector to fill with locations of the vertices of the hypercube.

  • grid_func_data – DATATYPE object that defines the grid-function evaluation.

  • origin_indices – Pointer to a vector containing the indices that will form the (0,0) point of the hypercube (that is to say, the largest indices in each dimension that are still smaller than the desired interpolation point).

  • hypercube_vertices – Pointer to a vector containing the vertices of the hypercube (integers whose binary representations give the normalised positions of the vertices).

  • coords_vec – Pointer to the flattened coords array used to recover the coordinate value for each interpolated dimension.

  • non_interpolation_points – Values passed through without modification to calc_data(…)

  • interpolation_indices – Array of indices that correspond to the dimensions that will be interpolated.

  • non_interpolation_indices – Array of indices that correspond to the dimensions that will not be interpolated.

  • dims_vec – Pointer to a vector that contains the size of each dimension.

  • index – Read-only accessor to a loop index for a NP::ParticleLoop inside which calc_data is called. NP::Access using either index.get_loop_linear_index(), index.get_local_linear_index(), index.get_sub_linear_index() as required.

  • req_int_props – Vector of symbols for integer-valued properties that need to be used for the reaction data calculation.

  • req_real_props – Vector of symbols for real-valued properties that need to be used for the reaction data calculation.

  • rng_kernel – The random number generator kernel potentially used in the calculation

template<int output_ndim>
inline void contract_hypercube_on_device(const REAL *interp_points, const size_t &dim_index, size_t const *hypercube_vertices, const INT *origin_indices, const REAL *vertex_func_evals, REAL const *coords_vec, size_t const *dims_vec, REAL *output_evals, INT *varying_dim, INT *vertex_coord)#

Function to contract a hypercube down by 1 dimension via linear interpolation.

Template Parameters:

output_ndim – Number of output dimensions of output_evals.

Parameters:
  • interp_points – Pointer to a vector that contains the interpolation points in each dimension.

  • dim_index – Since this function is called multiple times, this counter keeps track of the progress, it can be thought of as: ndim-1 where ndim is the current dimensionality of the hypercube.

  • hypercube_vertices – Pointer to a vector that contains the vertices of the hypercube pre-contraction.

  • origin_indices – Pointer to a vector containing the indices that will form the (0,0) point of the hypercube (that is to say, the largest indices in each dimension that are still smaller than the desired interpolation point).

  • vertex_func_evals – Pointer to a vector that contains the function evaluations at initial vertices.

  • coords_vec – Pointer to a vector containing a contiguous array of the coordinates of each dimension of relevance for the interpolation.

  • dims_vec – Pointer to a vector that contains the size of each dimension.

  • output_evals – Pointer to a vector that contains the function evaluations at contracted vertices.

  • varying_dim – Pointer to a vector used for storing the vertices whose coordinates vary in the dimension to be contracted.

  • vertex_coord – Pointer to a vector used for storing the vertices of the hypercube after they’ve been mapped to the actual region in the dimensions of the grid that are of interest.

namespace utils#

Functions

template<typename T>
std::shared_ptr<NP::BufferDevice<T>> make_buffer_device_ptr(NP::SYCLTargetSharedPtr sycl_target, const std::vector<T> &vec)#

Helper function to construct a shared pointer to a NP::BufferDevice from a vector.

Template Parameters:

T – Arithmetic type template parameter

Parameters:
  • sycl_target – SYCL target shared pointer used for buffer allocation.

  • vec – Vector to be wrapped by NP::BufferDevice.

Returns:

Shared pointer to an allocated NP::BufferDevice.

template<typename T>
T norm2(const std::vector<T> &vec)#

Helper function to calculate the L2 norm of a vector of arithmetic types.

Template Parameters:

T – Arithmetic type template parameter

Parameters:

vec – Vector to take norm of

Returns:

T sqrt(sum(x^2)) for x in vec

template<typename T>
std::vector<T> cross_product(const std::vector<T> &a, const std::vector<T> &b)#

Helper function to compute vector cross product of two length 3 vectors.

Template Parameters:

T – Arithmetic type template parameter

Parameters:
  • a – first cross product argument

  • b – second cross product argument

Returns:

std::vector<T> a x b

template<typename PROP_TYPE>
std::vector<NP::Sym<PROP_TYPE>> build_sym_vector(std::vector<std::string> required_properties)#

Helper function to build a std::vector of Syms from a list of names.

Template Parameters:

PROP_TYPE – The property type associated with the syms that need to be stored in the resulting vector (either INT or REAL).

Parameters:

required_properties – A vector of strings that contains the required properties

Returns:

A std::vector of Syms of PROP_TYPE (ie. std::vector<Syms<PROP_TYPE>>)

inline std::array<REAL, 2> box_muller_transform(const REAL &u1, const REAL &u2)#

Perform the standard deterministic Box-Muller transform and store the two normal variates into an array (to avoid use of tuples/pairs in order to maximise SYCL compatibility)

Parameters:
  • u1 – First uniformly distributed random number

  • u2 – Second uniformly distributed random number

Returns:

A REAL-valued array of size 2 containing the calculated two normal variates.

template<size_t n_dim>
inline std::array<REAL, n_dim> reflect_vector(const std::array<REAL, n_dim> &input, const std::array<REAL, n_dim> &ref_vector)#

Reflect an input array across a normalised reflection vector (e.g. surface normal). output = input - 2 * dot_product(input,ref_vector) * ref_vector.

Parameters:
  • input – Input array to be reflected

  • ref_vector – Normalised vector to reflect through

Returns:

Reflected array

template<size_t n_dim>
inline std::array<REAL, n_dim> project_vector(const std::array<REAL, n_dim> &input, const std::array<REAL, n_dim> &proj_direction)#

Return dot(input,proj_direction) * proj_direction. If proj_direction is a unit vector this will be a projection of input onto proj_direction.

Parameters:
  • input – The input vector

  • proj_direction – Direction onto which to project the input

Returns:

Projected vector.

inline std::array<REAL, 9> get_normal_basis(const std::array<REAL, 3> &vel, const std::array<REAL, 3> &normal)#

Returns the 3D basis for performing reflections based on an ingoing velocity vector and a normal vector. Handles both possible orientations of the normal and produces the following basis:

result[6-8] - e3: Basis vector normal to the wall, oriented so that the dot product of it and the velocity is negative, i.e. into the domain

result[0-2] - e1: Basis vector in the vel - vel dot normal direction

result[3-5] - e2: e3 x e1

Parameters:
  • vel – Velocity vector (in standard Cartesian coordinates), assumed going into the surface

  • normal – Normal vector at the surface, assumed to be a unit vector, but can be either into or out of the surface

Returns:

Normal basis.

inline std::array<REAL, 3> normal_basis_to_cartesian(const std::array<REAL, 3> &coords, const std::array<REAL, 9> &basis)#

Given spherical coordinates r, theta, and phi, and an orthonormal basis (flattened in an array) with respect to which the coordinates are defines, gives the cartesian components of the vector.

Parameters:
  • coords – r,theta, phi coordinates

  • basis – Flattened rotated cartesian basis with respect to which the coords are given

Returns:

Cartesian components of the input coords.

inline size_t bin_uniform_symmetric_guard_1d(const REAL &inverse_2L, const INT &n_cells, const REAL &position)#

Bin into equal sized cartesian 1D cells, assuming the following:

  1. The Cartesian domain is (-L,L]

  2. Particles with positions less than -L or greater than L are binned in guard cells, resulting in n_cells+2 bins (0 is the left guard cell, n_cells+1 the right)

Parameters:
  • inverse_2L – 1/(2*total_length_of_domain)

  • n_cells – Number of cells on the 1D grid

  • position – The position of the point to be binned

Returns:

Index of the point being binned on 1D grid

file neso_particles_namespace_alias.hpp
#include “neso_particles.hpp”
file neso_test_assert.hpp
#include “neso_particles/typedefs.hpp”
#include <cstdlib>
#include <stdexcept>
#include <neso_particles.hpp>

Defines

NESOASSERT_FUNCTION#

Functions

template<typename T>
inline void neso_particles_test_assert(const char *expr_str, bool expr, const char *file, int line, T &&msg)#

Helper function that disables NESOASSERT when TEST_NESOASSERT is set and instead replaces it with a throw of std::logic_error if the expr boolean is false. This is useful for unit tests where EXPECT_THROW is used to check expected failures (it just checks that std::logic_error is thrown).

Parameters:
  • expr_str – A string identifying the conditional to check. (passed to neso_particles_assert)

  • expr – Bool resulting from the evaluation of the expression.

  • file – Filename containing the call to neso_particles_assert. (passed to neso_particles_assert)

  • line – Line number for the call to neso_particles assert. (passed to neso_particles_assert)

  • msg – Message to print to stderr on evaluation of conditional to false. (passed to neso_particles_assert)

file reactions.hpp
#include “neso_test_assert.hpp”
file binary_array_transform_data.hpp
#include “composite_data.hpp”
file common_array_transforms.hpp
#include “reaction_data.hpp”
file common_markers.hpp
file common_transformations.hpp
#include “utils.hpp”
#include <memory>
file composite_data.hpp
#include “reaction_data.hpp”
file concatenator_data.hpp
#include “composite_data.hpp”
file AMJUEL_fit_cs.hpp
#include “../reaction_data.hpp”
file constant_rate_cs.hpp
#include “../reaction_data.hpp”
#include <limits>
file data_calculator.hpp
#include “reaction_data.hpp”
#include <tuple>
#include <type_traits>
#include <vector>
file electron_impact_ionisation.hpp
#include “../data_calculator.hpp”
#include “../reaction_base.hpp”
file recombination_reaction.hpp
#include “../reaction_base.hpp”
file downsampling_base.hpp
#include <limits>
#include <memory>
#include <vector>
file simple_thinning_kernels.hpp
file vranic_merging_kernels.hpp
file interp_utils.hpp
#include <vector>
file merge_transformation.hpp
#include <limits>
#include <memory>
file particle_properties_map.hpp
#include <map>
#include <string>
#include <utility>
file particle_spec_builder.hpp
file pipeline_data.hpp
#include “composite_data.hpp”
#include “reaction_data.hpp”
file profiling_base.hpp
#include <optional>
#include <string>
#include <typeinfo>
file reaction_base.hpp
#include “data_calculator.hpp”
#include “profiling_base.hpp”
#include “reaction_data.hpp”
#include “reaction_kernels.hpp”
#include <array>
#include <cstring>
#include <type_traits>
#include <vector>
file reaction_controller.hpp
#include “common_markers.hpp”
#include “reaction_base.hpp”
#include <memory>
file reaction_data.hpp
#include <memory>
#include <type_traits>
#include <utility>
file AMJUEL_1D_data.hpp
#include “../reaction_data.hpp”
#include <array>
file AMJUEL_2D_data.hpp
#include “../reaction_data.hpp”
#include <array>
file AMJUEL_2D_data_H3.hpp
#include “../reaction_data.hpp”
#include <array>
#include <cmath>
file array_lookup_data.hpp
#include “../reaction_data.hpp”
#include <array>
#include <memory>
#include <neso_particles/compute_target.hpp>
file arrhenius_data.hpp
#include “../reaction_data.hpp”
file cartesian_basis_reflection_data.hpp
#include “../reaction_data.hpp”
#include “../utils.hpp”
file cartesian_grid_data.hpp
#include “../interp_utils.hpp”
#include “../reaction_data.hpp”
#include “../utils.hpp”
#include <array>
#include <memory>
#include “grid_descriptors.hpp”
file extractor_data.hpp
#include “../reaction_data.hpp”
file filtered_maxwellian_sampler.hpp
#include “../utils.hpp”
#include <type_traits>
file fixed_array_data.hpp
#include “../reaction_data.hpp”
file fixed_coefficient_data.hpp
#include “../reaction_data.hpp”
file fixed_rate_data.hpp
#include “../reaction_data.hpp”
file grid_descriptors.hpp
#include <algorithm>
#include <array>
#include <cstddef>
#include <type_traits>
#include <vector>
file interpolate_data.hpp
#include <algorithm>
#include <memory>
file one_way_maxwellian_flux_sampler.hpp
#include “../reaction_data.hpp”
#include “../utils.hpp”
#include <neso_particles.hpp>
file sampler_data.hpp
#include “../reaction_data.hpp”
file specular_reflection_data.hpp
#include “../reaction_data.hpp”
#include “../utils.hpp”
file spherical_basis_reflection_data.hpp
#include “../reaction_data.hpp”
#include “../utils.hpp”
file trim_eval_data.hpp
#include “../interp_utils.hpp”
#include “../reaction_data.hpp”
#include “../utils.hpp”
#include <array>
#include <memory>
#include “grid_descriptors.hpp”
file reaction_data_accumulator.hpp
#include “reaction_data.hpp”
#include <memory>
file reaction_kernel_pre_reqs.hpp
#include “utils.hpp”
#include <iterator>
#include <optional>
#include <set>
#include <string>
#include <strings.h>
#include <vector>
file reaction_kernels.hpp
file base_cx_kernels.hpp
#include “../reaction_kernels.hpp”
#include <array>
#include <vector>
file base_ionisation_kernels.hpp
#include “../reaction_kernels.hpp”
#include <array>
#include <vector>
file base_recombination_kernels.hpp
#include “../reaction_kernels.hpp”
#include <array>
#include <vector>
file general_absorption_kernels.hpp
#include “../reaction_kernels.hpp”
#include <array>
file general_linear_scattering_kernels.hpp
#include “../reaction_kernels.hpp”
#include <array>
file specular_reflection_kernels.hpp
#include “../reaction_kernels.hpp”
#include “../utils.hpp”
#include <array>
file transformation_wrapper.hpp
#include <memory>
#include <vector>
#include “profiling_base.hpp”
file unary_array_transform_data.hpp
#include “reaction_data.hpp”
file utils.hpp
#include <cassert>
#include <cmath>
#include <memory>
#include <numeric>
#include <type_traits>
#include <vector>
file common_markers.cpp
file common_transformations.cpp
file simple_thinning_kernels.cpp
#include “../include/reactions_lib/downsampling_kernels/simple_thinning_kernels.hpp”
file vranic_merging_kernels.cpp
#include “../include/reactions_lib/downsampling_kernels/vranic_merging_kernels.hpp”
file interp_utils.cpp
file merge_transformation.cpp
file particle_properties_map.cpp
file particle_spec_builder.cpp
file profiling_base.cpp
file reaction_base.cpp
file reaction_controller.cpp
file reaction_data.cpp
file arrhenius_data.cpp
#include “../include/reactions_lib/reaction_data/arrhenius_data.hpp”
file cartesian_basis_reflection_data.cpp
#include “../include/reactions_lib/reaction_data/cartesian_basis_reflection_data.hpp”
file filtered_maxwellian_sampler.cpp
file fixed_coefficient_data.cpp
#include “../include/reactions_lib/reaction_data/fixed_coefficient_data.hpp”
file fixed_rate_data.cpp
#include “../include/reactions_lib/reaction_data/fixed_rate_data.hpp”
file grid_descriptors.cpp
#include “../include/reactions_lib/reaction_data/grid_descriptors.hpp”
file one_way_maxwellian_flux_sampler.cpp
file specular_reflection_data.cpp
file spherical_basis_reflection_data.cpp
#include “../include/reactions_lib/reaction_data/spherical_basis_reflection_data.hpp”
file reaction_kernel_pre_reqs.cpp
file reaction_kernels.cpp
file base_cx_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/base_cx_kernels.hpp”
file base_ionisation_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/base_ionisation_kernels.hpp”
file base_recombination_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/base_recombination_kernels.hpp”
file general_absorption_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/general_absorption_kernels.hpp”
file general_linear_scattering_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/general_linear_scattering_kernels.hpp”
file specular_reflection_kernels.cpp
#include “../include/reactions_lib/reaction_kernels/specular_reflection_kernels.hpp”
file transformation_wrapper.cpp
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib/cross_sections
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib/derived_reactions
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib/downsampling_kernels
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/src/downsampling_kernels
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib/reaction_data
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/src/reaction_data
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib/reaction_kernels
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/src/reaction_kernels
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/include/reactions_lib
dir /home/runner/work/VANTAGE-Reactions/VANTAGE-Reactions/src