Skip to content

Commit

Permalink
Named: name Only Used Once (#782)
Browse files Browse the repository at this point in the history
... avoid an unnecessary copy. (Found via clang-tidy.)
  • Loading branch information
ax3l authored Jan 7, 2025
1 parent 2c97164 commit 426a2d5
Show file tree
Hide file tree
Showing 27 changed files with 28 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/particles/elements/Aperture.H
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_shape(shape), m_action(action), m_xmax(xmax), m_ymax(ymax), m_repeat_x(repeat_x), m_repeat_y(repeat_y)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Buncher.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_V(V), m_k(k)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/CFbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_rc(rc), m_k(k)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ChrDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ChrPlasmaLens.H
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_k(k), m_unit(unit)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ChrQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_k(k), m_unit(unit)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ChrUniformAcc.H
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_ez(ez), m_bz(bz)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ConstF.H
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_kx(kx), m_ky(ky), m_kt(kt)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/DipEdge.H
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_psi(psi), m_rc(rc), m_g(g), m_K2(K2)
{
Expand Down
3 changes: 2 additions & 1 deletion src/particles/elements/Drift.H
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <AMReX_REAL.H>

#include <cmath>
#include <utility>


namespace impactx
Expand Down Expand Up @@ -52,7 +53,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ExactDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ExactSbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_phi(phi * degree2rad), m_B(B)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Kicker.H
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_xkick(xkick), m_ykick(ykick), m_unit(unit)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Multipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_multipole(multipole), m_Kn(K_normal), m_Ks(K_skew)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/NonlinearLens.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_knll(knll), m_cnll(cnll)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/PRot.H
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ namespace impactx
amrex::ParticleReal phi_out,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
m_phi_in(phi_in * degree2rad),
m_phi_out(phi_out * degree2rad)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/PlaneXYRot.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_phi(phi * degree2rad)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Programmable.H
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ namespace impactx
int nslice=1,
std::optional<std::string> name = std::nullopt
)
: Named(name), m_ds(ds), m_nslice(nslice)
: Named(std::move(name)), m_ds(ds), m_nslice(nslice)
{}

/** Push all particles relative to the reference particle
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Quad.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_k(k)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/RFCavity.H
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ namespace RFCavityData
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_escale(escale), m_freq(freq), m_phase(phase), m_mapsteps(mapsteps), m_id(RFCavityData::next_id)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Sbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_rc(rc)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ShortRF.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_V(V), m_freq(freq), m_phase(phase)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/SoftQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ namespace SoftQuadrupoleData
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_gscale(gscale), m_mapsteps(mapsteps), m_id(SoftQuadrupoleData::next_id)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/SoftSol.H
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ namespace SoftSolenoidData
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_bscale(bscale), m_unit(unit), m_mapsteps(mapsteps), m_id(SoftSolenoidData::next_id)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/Sol.H
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ namespace impactx
int nslice = 1,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Thick(ds, nslice),
Alignment(dx, dy, rotation_degree),
m_ks(ks)
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/TaperedPL.H
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_k(k), m_taper(taper), m_unit(unit)
{
Expand Down
2 changes: 1 addition & 1 deletion src/particles/elements/ThinDipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace impactx
amrex::ParticleReal rotation_degree = 0,
std::optional<std::string> name = std::nullopt
)
: Named(name),
: Named(std::move(name)),
Alignment(dx, dy, rotation_degree),
m_theta(theta * degree2rad),
m_rc(rc)
Expand Down

0 comments on commit 426a2d5

Please sign in to comment.