Skip to content

Commit

Permalink
C++: Add mixin:: Element Namespace
Browse files Browse the repository at this point in the history
Mirror directory structure and separate from "physical"
elements as we do in Python.
  • Loading branch information
ax3l committed Jan 15, 2025
1 parent 5dcb441 commit 87f85e9
Show file tree
Hide file tree
Showing 41 changed files with 234 additions and 234 deletions.
2 changes: 1 addition & 1 deletion src/initialization/InitElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ namespace detail
amrex::ParticleReal ds = 0.0;
pp_element.queryAdd("ds", ds);

elements::LinearTransport::Map6x6 transport_map = elements::LinearTransport::Map6x6::Identity();
elements::mixin::LinearTransport::Map6x6 transport_map = elements::mixin::LinearTransport::Map6x6::Identity();

// safe to ParmParse inputs for reproducibility
for (int i=1; i<=6; ++i) {
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/Aperture.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct Aperture
: public elements::Named,
public elements::BeamOptic<Aperture>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<Aperture>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Aperture";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/Buncher.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct Buncher
: public elements::Named,
public elements::BeamOptic<Buncher>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<Buncher>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Buncher";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/CFbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
namespace impactx
{
struct CFbend
: public elements::Named,
public elements::BeamOptic<CFbend>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<CFbend>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "CFbend";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace impactx
{
struct ChrDrift
: public elements::Named,
public elements::BeamOptic<ChrDrift>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ChrDrift>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ChrDrift";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrPlasmaLens.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace impactx
{
struct ChrPlasmaLens
: public elements::Named,
public elements::BeamOptic<ChrPlasmaLens>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ChrPlasmaLens>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ChrPlasmaLens";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrQuad.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
namespace impactx
{
struct ChrQuad
: public elements::Named,
public elements::BeamOptic<ChrQuad>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ChrQuad>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ChrQuad";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ChrUniformAcc.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace impactx
{
struct ChrAcc
: public elements::Named,
public elements::BeamOptic<ChrAcc>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ChrAcc>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ChrAcc";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ConstF.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace impactx
{
struct ConstF
: public elements::Named,
public elements::BeamOptic<ConstF>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ConstF>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ConstF";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/DipEdge.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct DipEdge
: public elements::Named,
public elements::BeamOptic<DipEdge>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<DipEdge>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "DipEdge";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
16 changes: 8 additions & 8 deletions src/particles/elements/Drift.H
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
namespace impactx
{
struct Drift
: public elements::Named,
public elements::BeamOptic<Drift>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<Drift>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Drift";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down Expand Up @@ -178,7 +178,7 @@ namespace impactx
* @returns 6x6 transport matrix
*/
AMREX_GPU_HOST_DEVICE AMREX_FORCE_INLINE
elements::LinearTransport::Map6x6
elements::mixin::LinearTransport::Map6x6
transport_map (RefPart & AMREX_RESTRICT refpart) const
{
using namespace amrex::literals; // for _rt and _prt
Expand All @@ -191,7 +191,7 @@ namespace impactx
amrex::ParticleReal const betgam2 = std::pow(pt_ref, 2) - 1.0_prt;

// assign linear map matrix elements
elements::LinearTransport::Map6x6 R = elements::LinearTransport::Map6x6::Identity();
elements::mixin::LinearTransport::Map6x6 R = elements::mixin::LinearTransport::Map6x6::Identity();
R(1,2) = slice_ds;
R(3,4) = slice_ds;
R(5,6) = slice_ds / betgam2;
Expand Down
4 changes: 2 additions & 2 deletions src/particles/elements/Empty.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
namespace impactx
{
struct Empty
: public elements::Thin,
public elements::NoFinalize
: public elements::mixin::Thin,
public elements::mixin::NoFinalize
{
static constexpr auto type = "None";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ExactDrift.H
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
namespace impactx
{
struct ExactDrift
: public elements::Named,
public elements::BeamOptic<ExactDrift>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ExactDrift>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ExactDrift";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
12 changes: 6 additions & 6 deletions src/particles/elements/ExactSbend.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
namespace impactx
{
struct ExactSbend
: public elements::Named,
public elements::BeamOptic<ExactSbend>,
public elements::Thick,
public elements::Alignment,
public elements::PipeAperture,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<ExactSbend>,
public elements::mixin::Thick,
public elements::mixin::Alignment,
public elements::mixin::PipeAperture,
public elements::mixin::NoFinalize
{
static constexpr auto type = "ExactSbend";
static constexpr amrex::ParticleReal degree2rad = ablastr::constant::math::pi / 180.0;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/Kicker.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct Kicker
: public elements::Named,
public elements::BeamOptic<Kicker>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<Kicker>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Kicker";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/LinearMap.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct LinearMap
: public elements::Named,
public elements::BeamOptic<LinearMap>,
public elements::Alignment,
public elements::LinearTransport,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<LinearMap>,
public elements::mixin::Alignment,
public elements::mixin::LinearTransport,
public elements::mixin::NoFinalize
{
static constexpr auto type = "LinearMap";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
6 changes: 3 additions & 3 deletions src/particles/elements/Marker.H
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
namespace impactx
{
struct Marker
: public elements::Named,
public elements::Thin,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::Thin,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Marker";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/Multipole.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct Multipole
: public elements::Named,
public elements::BeamOptic<Multipole>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<Multipole>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "Multipole";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/NonlinearLens.H
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@
namespace impactx
{
struct NonlinearLens
: public elements::Named,
public elements::BeamOptic<NonlinearLens>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<NonlinearLens>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "NonlinearLens";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
8 changes: 4 additions & 4 deletions src/particles/elements/PRot.H
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
namespace impactx
{
struct PRot
: public elements::Named,
public elements::BeamOptic<PRot>,
public elements::Thin,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<PRot>,
public elements::mixin::Thin,
public elements::mixin::NoFinalize
{
static constexpr auto type = "PRot";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
10 changes: 5 additions & 5 deletions src/particles/elements/PlaneXYRot.H
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@
namespace impactx
{
struct PlaneXYRot
: public elements::Named,
public elements::BeamOptic<PlaneXYRot>,
public elements::Thin,
public elements::Alignment,
public elements::NoFinalize
: public elements::mixin::Named,
public elements::mixin::BeamOptic<PlaneXYRot>,
public elements::mixin::Thin,
public elements::mixin::Alignment,
public elements::mixin::NoFinalize
{
static constexpr auto type = "PlaneXYRot";
using PType = ImpactXParticleContainer::ParticleType;
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 @@ -23,7 +23,7 @@
namespace impactx
{
struct Programmable
: public elements::Named
: public elements::mixin::Named
{
static constexpr auto type = "Programmable";
using PType = ImpactXParticleContainer::ParticleType;
Expand Down
Loading

0 comments on commit 87f85e9

Please sign in to comment.