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