ImpactX
Public Types | Public Member Functions | Static Public Attributes | Private Attributes | List of all members
impactx::diagnostics::BeamMonitor Struct Reference

#include <openPMD.H>

Inheritance diagram for impactx::diagnostics::BeamMonitor:
impactx::elements::Thin

Public Types

using PType = typename ImpactXParticleContainer::ParticleType
 
using PinnedContainer = typename ImpactXParticleContainer::ContainerLike< amrex::PinnedArenaAllocator >
 

Public Member Functions

 BeamMonitor (std::string series_name, std::string backend="default", std::string encoding="g")
 
 BeamMonitor (BeamMonitor const &other)=default
 
 BeamMonitor (BeamMonitor &&other)=default
 
BeamMonitoroperator= (BeamMonitor const &other)=default
 
BeamMonitoroperator= (BeamMonitor &&other)=default
 
void prepare (PinnedContainer &pc, std::vector< std::string > const &real_soa_names, std::vector< std::string > const &int_soa_names, RefPart const &ref_part, int step)
 
void operator() (ImpactXParticleContainer &pc, int step)
 
void operator() (PinnedContainer::ParIterType &pti, std::vector< std::string > const &real_soa_names, std::vector< std::string > const &int_soa_names, RefPart const &ref_part)
 
std::string series_name () const
 
void finalize ()
 
- Public Member Functions inherited from impactx::elements::Thin
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE void operator() ([[maybe_unused]] RefPart &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
 

Static Public Attributes

static constexpr auto name = "BeamMonitor"
 
static std::map< std::string, std::any > m_unique_series = {}
 

Private Attributes

std::string m_series_name
 
std::string m_OpenPMDFileType
 ... More...
 
std::any m_series
 ... More...
 
int m_step = 0
 openPMD::Series; ... More...
 
int m_file_min_digits = 6
 ... More...
 
std::vector< uint64_t > m_offset
 minimum number of digits to iteration number in file name More...
 

Detailed Description

This element writes the particle beam out to openPMD data.

This class behaves like a singleton if constructed with the same series name as an existing instance.

Member Typedef Documentation

◆ PinnedContainer

◆ PType

Constructor & Destructor Documentation

◆ BeamMonitor() [1/3]

impactx::diagnostics::BeamMonitor::BeamMonitor ( std::string  series_name,
std::string  backend = "default",
std::string  encoding = "g" 
)

This element writes the particle beam out to openPMD data.

Elements with the same series name are identical.

Parameters
series_namename of the data series, usually the element name
backendfile format backend for openPMD, e.g., "bp" or "h5"
encodingopenPMD iteration encoding: "v"ariable based, "f"ile based, "g"roup based (default)

◆ BeamMonitor() [2/3]

impactx::diagnostics::BeamMonitor::BeamMonitor ( BeamMonitor const &  other)
default

◆ BeamMonitor() [3/3]

impactx::diagnostics::BeamMonitor::BeamMonitor ( BeamMonitor &&  other)
default

Member Function Documentation

◆ finalize()

void impactx::diagnostics::BeamMonitor::finalize ( )

Close and deallocate all data series and backends.

◆ operator()() [1/2]

void impactx::diagnostics::BeamMonitor::operator() ( ImpactXParticleContainer pc,
int  step 
)

Dump all particles.

Particles are relative to the reference particle.

Parameters
[in,out]pcparticle container to push
[in]stepglobal step for diagnostics

◆ operator()() [2/2]

void impactx::diagnostics::BeamMonitor::operator() ( PinnedContainer::ParIterType &  pti,
std::vector< std::string > const &  real_soa_names,
std::vector< std::string > const &  int_soa_names,
RefPart const &  ref_part 
)

Write a tile of particles

Parameters
ptiparticle tile iterator
[in]real_soa_namesParticleReal component names
[in]int_soa_namesinteger component names
ref_partreference particle

◆ operator=() [1/2]

BeamMonitor& impactx::diagnostics::BeamMonitor::operator= ( BeamMonitor &&  other)
default

◆ operator=() [2/2]

BeamMonitor& impactx::diagnostics::BeamMonitor::operator= ( BeamMonitor const &  other)
default

◆ prepare()

void impactx::diagnostics::BeamMonitor::prepare ( PinnedContainer pc,
std::vector< std::string > const &  real_soa_names,
std::vector< std::string > const &  int_soa_names,
RefPart const &  ref_part,
int  step 
)

Prepare entering the element before starting push logic.

And write reference particle.

Parameters
[in]pcparticle container
[in]real_soa_namesParticleReal component names
[in]int_soa_namesinteger component names
[in]ref_partreference particle
[in]stepglobal step for diagnostics

◆ series_name()

std::string impactx::diagnostics::BeamMonitor::series_name ( ) const
inline

Get the name of the series

Elements with the same series name are identical.

Member Data Documentation

◆ m_file_min_digits

int impactx::diagnostics::BeamMonitor::m_file_min_digits = 6
private

...

◆ m_offset

std::vector<uint64_t> impactx::diagnostics::BeamMonitor::m_offset
private

minimum number of digits to iteration number in file name

This rank's offset in the MPI-global particle array, by level

This MUST be updated by prepare() before the next step's output.

◆ m_OpenPMDFileType

std::string impactx::diagnostics::BeamMonitor::m_OpenPMDFileType
private

...

◆ m_series

std::any impactx::diagnostics::BeamMonitor::m_series
private

...

◆ m_series_name

std::string impactx::diagnostics::BeamMonitor::m_series_name
private

◆ m_step

int impactx::diagnostics::BeamMonitor::m_step = 0
private

◆ m_unique_series

std::map<std::string, std::any> impactx::diagnostics::BeamMonitor::m_unique_series = {}
inlinestatic

track all m_series_name instances

Ensure m_series is the same for the same name.

◆ name

constexpr auto impactx::diagnostics::BeamMonitor::name = "BeamMonitor"
staticconstexpr

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