Skip to content

Commit

Permalink
Make RFCavity faster
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 19, 2025
1 parent 365c93a commit c0dadb2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/elements/RFCavity.H
Original file line number Diff line number Diff line change
Expand Up @@ -187,9 +187,25 @@ namespace RFCavityData
/** Push all particles */
using BeamOptic::operator();

/** Compute and cache the constants for the push.
*
* In particular, used to pre-compute and cache variables that are
* independent of the individually tracked particle.
*
* @param refpart reference particle
*/
void compute_constants (RefPart const & refpart)
{
using namespace amrex::literals; // for _rt and _prt

Alignment::compute_constants(refpart);
}

/** This is an RF cavity functor, so that a variable of this type can be used like
* an RF cavity function.
*
* The @see compute_constants method must be called before pushing particles through this operator.
*
* @param x particle position in x
* @param y particle position in y
* @param t particle position in t
Expand All @@ -208,7 +224,7 @@ namespace RFCavityData
amrex::ParticleReal & AMREX_RESTRICT py,
amrex::ParticleReal & AMREX_RESTRICT pt,
uint64_t & AMREX_RESTRICT idcpu,
[[maybe_unused]] RefPart const & refpart
RefPart const & AMREX_RESTRICT refpart
) const
{
using namespace amrex::literals; // for _rt and _prt
Expand Down

0 comments on commit c0dadb2

Please sign in to comment.