Skip to content

Commit

Permalink
Make SoftQuad faster
Browse files Browse the repository at this point in the history
  • Loading branch information
ax3l committed Feb 19, 2025
1 parent abc0e9c commit 66f8459
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion src/elements/SoftQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,25 @@ namespace SoftQuadrupoleData
/** 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 a soft-edge quadrupole functor, so that a variable of this type can be used
* like a soft-edge quadrupole 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 @@ -213,7 +229,7 @@ namespace SoftQuadrupoleData
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 Expand Up @@ -500,6 +516,11 @@ namespace SoftQuadrupoleData
amrex::ParticleReal* m_sin_h_data = nullptr; //! non-owning pointer to host sine coefficients
amrex::ParticleReal* m_cos_d_data = nullptr; //! non-owning pointer to device cosine coefficients
amrex::ParticleReal* m_sin_d_data = nullptr; //! non-owning pointer to device sine coefficients

private:
// constants that are independent of the individually tracked particle,
// see: compute_constants() to refresh
amrex::ParticleReal ...;
};

} // namespace impactx
Expand Down

0 comments on commit 66f8459

Please sign in to comment.