29 :
Component(name), _is_local(false), geometry_m(nullptr) {
38 :
Component(name), _is_local(false), geometry_m(nullptr) {
43 :
Component(rhs.getName()), _is_local(false), geometry_m(nullptr) {
77 "No field defined for Offset");
82 "No field defined for Offset");
137 "Rotations out of midplane are not implemented");
159 "Global offset needs a local coordinate system");
163 double length =
std::sqrt(translation(0) * translation(0) +
164 translation(1) * translation(1) +
165 translation(2) * translation(2));
181 double thetaIn =
std::atan2(-startDirection[0], startDirection[1]);
185 double thetaRel = thetaOut-thetaIn;
208 for (
int i = 0; i < 3; ++i) {
221 for (
size_t i = 0; i < 3; ++i)
228 return !(off1 == off2);
241 "Try to determine if Offset bends when geometry_m not allocated");
244 for (
size_t i = 0; i < 3; ++i)
259 double displacement) {
Euclid3DGeometry * geometry_m
Tps< T > sqrt(const Tps< T > &x)
Square root.
constexpr double c
The velocity of light in m/s.
Rotation in 3-dimensional space.
Vector_t getEndDirection() const
constexpr double two_pi
The value of .
bool operator!=(const Offset &off1, const Offset &off2)
Euclid3DGeometry & getGeometry() override
Get geometry.
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Abstract base class for electromagnetic fields.
std::ostream & operator<<(std::ostream &os, const Attribute &attr)
Offset & operator=(const Offset &)
static double float_tolerance
Vektor< double, 3 > Vector_t
virtual Euclid3D getTotalTransform() const
Get total transform from beginning to end.
EMField & getField() override
Not implemented - throws GeneralClassicException.
const Rotation3D & getRotation() const
Get rotation.
bool operator==(const TwoPolynomial &left, const TwoPolynomial &right)
static Offset localCartesianOffset(const std::string &name, Vector_t end_position, Vector_t end_direction)
void setIsLocal(bool isLocal)
PartBunchBase< double, 3 > * RefPartBunch_m
virtual const std::string & getName() const
Get element name.
constexpr double pi
The value of .
Inform & endl(Inform &inf)
void updateGeometry(Vector_t startPosition, Vector_t startDirection)
PETE_TBTree< FnArcTan2, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > atan2(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
static Offset globalCylindricalOffset(const std::string &name, double radius_out, double phi_out, double theta_out)
bool isGeometryAllocated() const
static double getTheta(Vector_t vec1, Vector_t vec2)
void accept(BeamlineVisitor &) const override
static Vector_t rotate(Vector_t vec, double theta)
static Offset localCylindricalOffset(const std::string &name, double theta_in, double theta_out, double displacement)
bool bends() const override
ElementBase * clone() const override
Tps< T > cos(const Tps< T > &x)
Cosine.
std::pair< ApertureType, std::vector< double > > getAperture() const
void setEndDirection(Vector_t direction)
Displacement and rotation in space.
virtual void setName(const std::string &name)
Set element name.
void setEndPosition(Vector_t position)
Vector3D getAxis() const
Get axis vector.
constexpr double e
The value of .
virtual void visitOffset(const Offset &)=0
Apply the algorithm to an offset (placement).
void setAperture(const ApertureType &type, const std::vector< double > &args)
Interface for a single beam element.
Tps< T > sin(const Tps< T > &x)
Sine.
void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
Vector_t getEndPosition() const
static Offset globalCartesianOffset(const std::string &name, Vector_t end_position, Vector_t end_direction)
const Vector3D & getVector() const
Get displacement.