Celeritas  0.5.0-56+6b053cd
Public Member Functions | List of all members
celeritas::AtomicRelaxationHelper Class Reference

Helper class for atomic relaxation. More...

#include <AtomicRelaxationHelper.hh>

Public Member Functions

CELER_FUNCTION AtomicRelaxationHelper (AtomicRelaxParamsRef const &shared, AtomicRelaxStateRef const &states, ElementId el_id, TrackSlotId tid)
 Construct with shared and state data.
 
CELER_FUNCTION operator bool () const
 Whether atomic relaxation should be applied.
 
CELER_FUNCTION size_type max_secondaries () const
 Maximum number of secondaries that can be produced.
 
CELER_FUNCTION Span< SubshellIdscratch () const
 Access scratch space. More...
 
CELER_FUNCTION AtomicRelaxation build_distribution (CutoffView const &cutoffs, SubshellId shell_id, Span< Secondary > secondaries) const
 Create the sampling distribution.
 

Detailed Description

Helper class for atomic relaxation.

This class can be used inside an Interactor to simplify the creation of the sampling distribution for relaxation and the allocation of storage for secondaries created in both relaxation and the primary process.

// Allocate secondaries for a model that produces a single secondary
Span<Secondary> secondaries;
size_type count = relax_helper.max_secondaries() + 1;
if (Secondary* ptr = allocate_secondaries(count))
{
secondaries = {ptr, count};
}
else
{
}
Interaction result;
// ...
AtomicRelaxation sample_relaxation = relax_helper.build_distribution(
cutoffs, shell_id, secondaries.subspan(1));
auto outgoing = sample_relaxation(rng);
result.secondaries = outgoing.secondaries;
result.energy_deposition -= outgoing.energy;
CELER_CONSTEXPR_FUNCTION Count< T > count()
Count upward from zero.
Definition: Range.hh:210
unsigned int size_type
Standard type for container sizes, optimized for GPU use.
Definition: corecel/Types.hh:28
static CELER_FUNCTION Interaction from_failure()
Indicate a failure to allocate memory for secondaries.
Definition: phys/Interaction.hh:139

Member Function Documentation

◆ scratch()

CELER_FUNCTION Span< SubshellId > celeritas::AtomicRelaxationHelper::scratch ( ) const
inline

Access scratch space.

This temporary data is needed as part of a stack while processing the cascade of electrons.


The documentation for this class was generated from the following file: