ImpactX
Loading...
Searching...
No Matches
impactx::elements::Programmable Struct Reference

#include <Programmable.H>

Inheritance diagram for impactx::elements::Programmable:
impactx::elements::mixin::Named impactx::elements::mixin::LinearTransport< Programmable, false >

Public Types

using PType = ImpactXParticleContainer::ParticleType

Public Member Functions

 Programmable (amrex::ParticleReal ds=DEFAULT_ds, int nslice=DEFAULT_nslice, std::optional< std::string > name=DEFAULT_name)
void reverse ()
void operator() (ImpactXParticleContainer &pc, int step, int period) const
void operator() (ImpactXParticleContainer::iterator &pti, RefPart &ref_part, bool spin) const
void operator() (RefPart &refpart) const
AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 transport_map (RefPart const &AMREX_RESTRICT refpart) const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int nslice () const
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal ds () const
void finalize ()
Public Member Functions inherited from impactx::elements::mixin::Named
AMREX_GPU_HOST void set_name (std::string const &new_name)
AMREX_GPU_HOST Named (std::optional< std::string > name)
AMREX_GPU_HOST_DEVICE ~Named ()
AMREX_GPU_HOST Named (Named const &other)
AMREX_GPU_HOST Namedoperator= (Named const &other)
AMREX_GPU_HOST_DEVICE Named (Named &&other) noexcept
AMREX_GPU_HOST_DEVICE Namedoperator= (Named &&other) noexcept
AMREX_FORCE_INLINE std::string name () const
AMREX_FORCE_INLINE bool has_name () const
Public Member Functions inherited from impactx::elements::mixin::LinearTransport< Programmable, false >
AMREX_GPU_HOST AMREX_FORCE_INLINE void operator() (Map6x6 &AMREX_RESTRICT cm, RefPart const &AMREX_RESTRICT ref) const

Public Attributes

amrex::ParticleReal m_ds = 0.0
int m_nslice = DEFAULT_nslice
 segment length in m
bool m_threadsafe = false
 number of slices used for the application of space charge
std::function< void(ImpactXParticleContainer *, int, int)> m_push
std::function< void(ImpactXParticleContainer::iterator *, RefPart &)> m_beam_particles
 hook for push of whole container (pc, step, period)
std::function< void(RefPart &)> m_ref_particle
 hook for beam particles (pti, ref)
std::function< void()> m_finalize
 hook for reference particle

Static Public Attributes

static constexpr auto type = "Programmable"
static constexpr amrex::ParticleReal DEFAULT_ds = 0
static constexpr int DEFAULT_nslice = mixin::Thick::DEFAULT_nslice
Static Public Attributes inherited from impactx::elements::mixin::Named
static constexpr std::nullopt_t DEFAULT_name = std::nullopt
Static Public Attributes inherited from impactx::elements::mixin::LinearTransport< Programmable, false >
static constexpr bool has_linear_transport

Member Typedef Documentation

◆ PType

Constructor & Destructor Documentation

◆ Programmable()

impactx::elements::Programmable::Programmable ( amrex::ParticleReal ds = DEFAULT_ds,
int nslice = DEFAULT_nslice,
std::optional< std::string > name = DEFAULT_name )
inline

This element can be programmed

Parameters
dsSegment length in m
nslicenumber of slices used for the application of space charge
namea user defined and not necessarily unique name of the element

Member Function Documentation

◆ ds()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE amrex::ParticleReal impactx::elements::Programmable::ds ( ) const
inline

Return the segment length

Returns
value in meters

◆ finalize()

void impactx::elements::Programmable::finalize ( )

Close and deallocate all data and handles.

◆ nslice()

AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE int impactx::elements::Programmable::nslice ( ) const
inline

Number of slices used for the application of space charge

Returns
positive integer

◆ operator()() [1/3]

void impactx::elements::Programmable::operator() ( ImpactXParticleContainer & pc,
int step,
int period ) const

Push all particles relative to the reference particle

Parameters
[in,out]pcparticle container to push
[in]stepglobal step for diagnostics
[in]periodfor periodic lattices, this is the current period (turn or cycle)

◆ operator()() [2/3]

void impactx::elements::Programmable::operator() ( ImpactXParticleContainer::iterator & pti,
RefPart & ref_part,
bool spin ) const

Push all particles relative to the reference particle

◆ operator()() [3/3]

void impactx::elements::Programmable::operator() ( RefPart & refpart) const

This pushes the reference particle.

Parameters
[in,out]refpartreference particle

◆ reverse()

void impactx::elements::Programmable::reverse ( )
inline

Reverse the element (not supported for Programmable)

◆ transport_map()

AMREX_GPU_HOST AMREX_FORCE_INLINE Map6x6 impactx::elements::Programmable::transport_map ( RefPart const &AMREX_RESTRICT refpart) const
inline

This function returns the linear transport map.

Parameters
[in]refpartreference particle
Returns
6x6 transport matrix

Member Data Documentation

◆ DEFAULT_ds

amrex::ParticleReal impactx::elements::Programmable::DEFAULT_ds = 0
staticconstexpr

◆ DEFAULT_nslice

int impactx::elements::Programmable::DEFAULT_nslice = mixin::Thick::DEFAULT_nslice
staticconstexpr

◆ m_beam_particles

std::function<void(ImpactXParticleContainer::iterator *, RefPart &)> impactx::elements::Programmable::m_beam_particles

hook for push of whole container (pc, step, period)

◆ m_ds

amrex::ParticleReal impactx::elements::Programmable::m_ds = 0.0

◆ m_finalize

std::function<void()> impactx::elements::Programmable::m_finalize

hook for reference particle

◆ m_nslice

int impactx::elements::Programmable::m_nslice = DEFAULT_nslice

segment length in m

◆ m_push

std::function<void(ImpactXParticleContainer *, int, int)> impactx::elements::Programmable::m_push

◆ m_ref_particle

std::function<void(RefPart &)> impactx::elements::Programmable::m_ref_particle

hook for beam particles (pti, ref)

◆ m_threadsafe

bool impactx::elements::Programmable::m_threadsafe = false

number of slices used for the application of space charge

Allow threading via OpenMP for the particle iterator loop

This will only affect threading if the OMP backend is active.

The default value is false to do the safe thing by default. Users must opt-in their guarantee that their code is thread-safe.

◆ type

auto impactx::elements::Programmable::type = "Programmable"
staticconstexpr

The documentation for this struct was generated from the following files: