OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
Loading...
Searching...
No Matches
OpalBeamline Class Reference

#include <OpalBeamline.h>

Collaboration diagram for OpalBeamline:
Collaboration graph

Public Member Functions

 OpalBeamline ()
 
 OpalBeamline (const Vector_t< double, 3 > &origin, const Quaternion &rotation)
 
 ~OpalBeamline ()
 
void activateElements ()
 
std::set< std::shared_ptr< Component > > getElements (const Vector_t< double, 3 > &x)
 
std::set< std::shared_ptr< Component > > getElements ()
 
Vector_t< double, 3 > transformTo (const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > transformFrom (const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > rotateTo (const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > rotateFrom (const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > transformToLocalCS (const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > transformFromLocalCS (const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > rotateToLocalCS (const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
 
Vector_t< double, 3 > rotateFromLocalCS (const std::shared_ptr< Component > &comp, const Vector_t< double, 3 > &r) const
 
PlacedElement getPlacedElement (const std::shared_ptr< Component > &comp) const
 Return the placed-element view used by the bridge stage.
 
CoordinateSystemTrafo getCSTrafoLab2Local (const std::shared_ptr< Component > &comp) const
 Return the nominal rigid placement transform \(T_i\).
 
CoordinateSystemTrafo getCSTrafoLab2Local () const
 
CoordinateSystemTrafo getMisalignment (const std::shared_ptr< Component > &comp) const
 
CoordinateSystemTrafo getNominalEntryTransform (const std::shared_ptr< Component > &comp) const
 
CoordinateSystemTrafo getNominalExitTransform (const std::shared_ptr< Component > &comp) const
 
double getStart (const Vector_t< double, 3 > &) const
 
double getEnd (const Vector_t< double, 3 > &) const
 
void switchElements (const double &, const double &, const double &kineticEnergy, const bool &nomonitors=false)
 
void switchElementsOff ()
 
ParticleMatterInteractionHandler * getParticleMatterInteractionHandler (const unsigned int &)
 
BoundaryGeometrygetBoundaryGeometry (const unsigned int &)
 
unsigned long getFieldAt (const unsigned int &, const Vector_t< double, 3 > &, const long &, const double &, Vector_t< double, 3 > &, Vector_t< double, 3 > &)
 
unsigned long getFieldAt (const Vector_t< double, 3 > &, const Vector_t< double, 3 > &, const double &, Vector_t< double, 3 > &, Vector_t< double, 3 > &)
 
template<class T >
void visit (const T &, BeamlineVisitor &, PartBunch_t &)
 
void prepareSections ()
 
void positionElementRelative (std::shared_ptr< ElementBase >)
 
void compute3DLattice ()
 
void save3DLattice ()
 
void save3DInput ()
 
void print (Inform &) const
 
void apply (const Vector_t< double, 3 > &R, const Vector_t< double, 3 > &, const double &t, Vector_t< double, 3 > &E, Vector_t< double, 3 > &B)
 
FieldList getElementByType (ElementType)
 
void swap (OpalBeamline &rhs)
 
void merge (OpalBeamline &rhs)
 
template<>
void visit (const Marker &, BeamlineVisitor &, PartBunch_t &)
 

Private Types

using PlacementAssembly = std::map< const ElementBase *, PlacedElement >
 

Private Member Functions

void setNominalPlacement (const std::shared_ptr< ElementBase > &element, const CoordinateSystemTrafo &parentToBody)
 Update the nominal rigid placement transform of one element.
 
void storePlacedElement (const std::shared_ptr< ElementBase > &element)
 Refresh the beamline-owned placed-element assembly record.
 
void compileCompatibilityPlacement ()
 Compile legacy reference-order placement into explicit nominal poses.
 

Private Attributes

FieldList elements_m
 
PlacementAssembly placementAssembly_m
 
bool prepared_m
 
bool compatibilityPlacementCompiled_m
 
CoordinateSystemTrafo coordTransformationTo_m
 

Detailed Description

Definition at line 41 of file OpalBeamline.h.

Member Typedef Documentation

◆ PlacementAssembly

using OpalBeamline::PlacementAssembly = std::map<const ElementBase*, PlacedElement>
private

Definition at line 131 of file OpalBeamline.h.

Constructor & Destructor Documentation

◆ OpalBeamline() [1/2]

OpalBeamline::OpalBeamline ( )

Definition at line 31 of file OpalBeamline.cpp.

◆ OpalBeamline() [2/2]

OpalBeamline::OpalBeamline ( const Vector_t< double, 3 > &  origin,
const Quaternion rotation 
)

Definition at line 37 of file OpalBeamline.cpp.

◆ ~OpalBeamline()

OpalBeamline::~OpalBeamline ( )

Definition at line 44 of file OpalBeamline.cpp.

References elements_m.

Member Function Documentation

◆ activateElements()

void OpalBeamline::activateElements ( )

Definition at line 610 of file OpalBeamline.cpp.

References elements_m.

Referenced by ParallelTracker::execute().

◆ apply()

void OpalBeamline::apply ( const Vector_t< double, 3 > &  R,
const Vector_t< double, 3 > &  ,
const double &  t,
Vector_t< double, 3 > &  E,
Vector_t< double, 3 > &  B 
)

◆ compileCompatibilityPlacement()

void OpalBeamline::compileCompatibilityPlacement ( )
private

Compile legacy reference-order placement into explicit nominal poses.

This setup-stage bridge consumes the compatibility placement encoded via ELEMEDGE and converts it once into nominal rigid placement transforms \(T_i\) stored on the elements. Existing callers may still invoke compute3DLattice(), but new code should treat this as a setup conversion, not as a runtime geometry query.

Definition at line 199 of file OpalBeamline.cpp.

References compatibilityPlacementCompiled_m, Quaternion::conjugate(), coordTransformationTo_m, elements_m, euclidean_norm(), BendBase::getBendAngle(), BendBase::getChordLength(), BendBase::getDesignPath(), BendBase::getEntranceAngle(), ElementBase::getRotationAboutZ(), Options::idealized, RBEND, RBEND3D, Quaternion::rotate(), SBEND, setNominalPlacement(), and SOURCE.

Referenced by compute3DLattice(), and prepareSections().

Here is the call graph for this function:

◆ compute3DLattice()

void OpalBeamline::compute3DLattice ( )

Definition at line 361 of file OpalBeamline.cpp.

References compileCompatibilityPlacement().

Referenced by ParallelTracker::prepareSections(), TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ getBoundaryGeometry()

BoundaryGeometry * OpalBeamline::getBoundaryGeometry ( const unsigned int &  )

◆ getCSTrafoLab2Local() [1/2]

CoordinateSystemTrafo OpalBeamline::getCSTrafoLab2Local ( ) const
inline

Definition at line 244 of file OpalBeamline.h.

References coordTransformationTo_m.

Referenced by getElements(), and save3DInput().

◆ getCSTrafoLab2Local() [2/2]

CoordinateSystemTrafo OpalBeamline::getCSTrafoLab2Local ( const std::shared_ptr< Component > &  comp) const
inline

Return the nominal rigid placement transform \(T_i\).

In the language of the placement note, this is the nominal rigid placement transform from the parent/reference base into the element body frame. During the bridge stage this remains identical to the legacy lab-to-local transform storage.

Definition at line 239 of file OpalBeamline.h.

References PlacedElement::getNominalBodyTransform(), and getPlacedElement().

Referenced by ParallelTracker::computeExternalFields(), ParallelTracker::emitFromEmissionSources(), ParallelTracker::execute(), OrbitThreader::integrate(), ParallelTracker::markBackwardParticlesAtSourcePlane(), TEST_F(), TEST_F(), and ParallelTracker::updateReferenceParticles().

Here is the call graph for this function:

◆ getElementByType()

FieldList OpalBeamline::getElementByType ( ElementType  type)

◆ getElements() [1/2]

std::set< std::shared_ptr< Component > > OpalBeamline::getElements ( )

Get all elements in the beamline, regardless of their position.

Returns
Set of shared pointers to all elements in the beamline.

Definition at line 62 of file OpalBeamline.cpp.

References elements_m.

Referenced by getFieldAt().

◆ getElements() [2/2]

std::set< std::shared_ptr< Component > > OpalBeamline::getElements ( const Vector_t< double, 3 > &  x)

◆ getEnd()

double OpalBeamline::getEnd ( const Vector_t< double, 3 > &  ) const

◆ getFieldAt() [1/2]

unsigned long OpalBeamline::getFieldAt ( const unsigned int &  ,
const Vector_t< double, 3 > &  ,
const long &  ,
const double &  ,
Vector_t< double, 3 > &  ,
Vector_t< double, 3 > &   
)

Definition at line 70 of file OpalBeamline.cpp.

Referenced by ParallelTracker::writePhaseSpace().

◆ getFieldAt() [2/2]

unsigned long OpalBeamline::getFieldAt ( const Vector_t< double, 3 > &  position,
const Vector_t< double, 3 > &  momentum,
const double &  t,
Vector_t< double, 3 > &  Ef,
Vector_t< double, 3 > &  Bf 
)

Definition at line 78 of file OpalBeamline.cpp.

References getElements(), MARKER, rotateFromLocalCS(), rotateToLocalCS(), and transformToLocalCS().

Here is the call graph for this function:

◆ getMisalignment()

CoordinateSystemTrafo OpalBeamline::getMisalignment ( const std::shared_ptr< Component > &  comp) const
inline

Definition at line 248 of file OpalBeamline.h.

References PlacedElement::getMisalignment(), Misalignment::getNominalToActual(), and getPlacedElement().

Referenced by ParallelTracker::computeExternalFields(), and TEST_F().

Here is the call graph for this function:

◆ getNominalEntryTransform()

CoordinateSystemTrafo OpalBeamline::getNominalEntryTransform ( const std::shared_ptr< Component > &  comp) const
inline

Definition at line 253 of file OpalBeamline.h.

References PlacedElement::getNominalEntryTransform(), and getPlacedElement().

Referenced by save3DLattice(), and TEST_F().

Here is the call graph for this function:

◆ getNominalExitTransform()

CoordinateSystemTrafo OpalBeamline::getNominalExitTransform ( const std::shared_ptr< Component > &  comp) const
inline

Definition at line 258 of file OpalBeamline.h.

References PlacedElement::getNominalExitTransform(), and getPlacedElement().

Referenced by save3DLattice(), and TEST_F().

Here is the call graph for this function:

◆ getParticleMatterInteractionHandler()

ParticleMatterInteractionHandler * OpalBeamline::getParticleMatterInteractionHandler ( const unsigned int &  )

◆ getPlacedElement()

PlacedElement OpalBeamline::getPlacedElement ( const std::shared_ptr< Component > &  comp) const
inline

Return the placed-element view used by the bridge stage.

This is the beamline-facing access point to the geometric placement record. It keeps nominal placement, local correction, and port geometry together while the legacy runtime still stores them on ElementBase.

Definition at line 231 of file OpalBeamline.h.

References placementAssembly_m.

Referenced by getCSTrafoLab2Local(), getMisalignment(), getNominalEntryTransform(), getNominalExitTransform(), rotateFromLocalCS(), rotateToLocalCS(), save3DLattice(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), transformFromLocalCS(), and transformToLocalCS().

◆ getStart()

double OpalBeamline::getStart ( const Vector_t< double, 3 > &  ) const

◆ merge()

void OpalBeamline::merge ( OpalBeamline rhs)

◆ positionElementRelative()

void OpalBeamline::positionElementRelative ( std::shared_ptr< ElementBase element)

Definition at line 176 of file OpalBeamline.cpp.

References coordTransformationTo_m, and setNominalPlacement().

Referenced by TEST_F(), and visit().

Here is the call graph for this function:

◆ prepareSections()

void OpalBeamline::prepareSections ( )

Definition at line 132 of file OpalBeamline.cpp.

References compileCompatibilityPlacement(), elements_m, prepared_m, BeamlineFieldElement::SortAsc(), and storePlacedElement().

Referenced by ParallelTracker::prepareSections(), TEST_F(), TEST_F(), TEST_F(), and TEST_F().

Here is the call graph for this function:

◆ print()

void OpalBeamline::print ( Inform &  ) const

Definition at line 145 of file OpalBeamline.cpp.

◆ rotateFrom()

Vector_t< double, 3 > OpalBeamline::rotateFrom ( const Vector_t< double, 3 > &  r) const
inline

Definition at line 207 of file OpalBeamline.h.

References coordTransformationTo_m, and CoordinateSystemTrafo::rotateFrom().

Here is the call graph for this function:

◆ rotateFromLocalCS()

Vector_t< double, 3 > OpalBeamline::rotateFromLocalCS ( const std::shared_ptr< Component > &  comp,
const Vector_t< double, 3 > &  r 
) const
inline

Definition at line 226 of file OpalBeamline.h.

References PlacedElement::getNominalBodyTransform(), getPlacedElement(), and CoordinateSystemTrafo::rotateFrom().

Referenced by getFieldAt(), OrbitThreader::integrate(), and TEST_F().

Here is the call graph for this function:

◆ rotateTo()

Vector_t< double, 3 > OpalBeamline::rotateTo ( const Vector_t< double, 3 > &  r) const
inline

Definition at line 203 of file OpalBeamline.h.

References coordTransformationTo_m, and CoordinateSystemTrafo::rotateTo().

Here is the call graph for this function:

◆ rotateToLocalCS()

Vector_t< double, 3 > OpalBeamline::rotateToLocalCS ( const std::shared_ptr< Component > &  comp,
const Vector_t< double, 3 > &  r 
) const
inline

◆ save3DInput()

◆ save3DLattice()

◆ setNominalPlacement()

void OpalBeamline::setNominalPlacement ( const std::shared_ptr< ElementBase > &  element,
const CoordinateSystemTrafo parentToBody 
)
private

Update the nominal rigid placement transform of one element.

This is the write-side bridge from the legacy beamline assembly code to the new placement vocabulary. The stored quantity is the nominal rigid placement transform \(T_i\); local survey or misalignment corrections remain on the element and are not composed here.

Definition at line 189 of file OpalBeamline.cpp.

References storePlacedElement().

Referenced by compileCompatibilityPlacement(), and positionElementRelative().

Here is the call graph for this function:

◆ storePlacedElement()

void OpalBeamline::storePlacedElement ( const std::shared_ptr< ElementBase > &  element)
private

Refresh the beamline-owned placed-element assembly record.

Beamline assembly owns a snapshot of the geometric placement records used by placement/export queries. This keeps the assembled placement model distinct from the legacy storage that still lives on ElementBase during the bridge stage.

Definition at line 195 of file OpalBeamline.cpp.

References placementAssembly_m.

Referenced by prepareSections(), and setNominalPlacement().

◆ swap()

void OpalBeamline::swap ( OpalBeamline rhs)

◆ switchElements()

void OpalBeamline::switchElements ( const double &  min,
const double &  max,
const double &  kineticEnergy,
const bool &  nomonitors = false 
)

Definition at line 112 of file OpalBeamline.cpp.

References elements_m.

◆ switchElementsOff()

void OpalBeamline::switchElementsOff ( )

Definition at line 127 of file OpalBeamline.cpp.

References elements_m.

Referenced by ParallelTracker::execute().

◆ transformFrom()

Vector_t< double, 3 > OpalBeamline::transformFrom ( const Vector_t< double, 3 > &  r) const
inline

Definition at line 199 of file OpalBeamline.h.

References coordTransformationTo_m, and CoordinateSystemTrafo::transformFrom().

Here is the call graph for this function:

◆ transformFromLocalCS()

Vector_t< double, 3 > OpalBeamline::transformFromLocalCS ( const std::shared_ptr< Component > &  comp,
const Vector_t< double, 3 > &  r 
) const
inline

Definition at line 216 of file OpalBeamline.h.

References PlacedElement::getNominalBodyTransform(), getPlacedElement(), and CoordinateSystemTrafo::transformFrom().

Referenced by TEST_F().

Here is the call graph for this function:

◆ transformTo()

Vector_t< double, 3 > OpalBeamline::transformTo ( const Vector_t< double, 3 > &  r) const
inline

Definition at line 195 of file OpalBeamline.h.

References coordTransformationTo_m, and CoordinateSystemTrafo::transformTo().

Here is the call graph for this function:

◆ transformToLocalCS()

Vector_t< double, 3 > OpalBeamline::transformToLocalCS ( const std::shared_ptr< Component > &  comp,
const Vector_t< double, 3 > &  r 
) const
inline

◆ visit() [1/2]

template<>
void OpalBeamline::visit ( const Marker ,
BeamlineVisitor ,
PartBunch_t  
)
inline

Definition at line 192 of file OpalBeamline.h.

◆ visit() [2/2]

Member Data Documentation

◆ compatibilityPlacementCompiled_m

bool OpalBeamline::compatibilityPlacementCompiled_m
private

Definition at line 168 of file OpalBeamline.h.

Referenced by compileCompatibilityPlacement(), merge(), swap(), and visit().

◆ coordTransformationTo_m

◆ elements_m

◆ placementAssembly_m

PlacementAssembly OpalBeamline::placementAssembly_m
private

Definition at line 166 of file OpalBeamline.h.

Referenced by getPlacedElement(), merge(), storePlacedElement(), swap(), and visit().

◆ prepared_m

bool OpalBeamline::prepared_m
private

Definition at line 167 of file OpalBeamline.h.

Referenced by merge(), prepareSections(), swap(), and visit().


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