20#ifndef OPALX_TBeamline_HH
21#define OPALX_TBeamline_HH
39 explicit TBeamline(
const std::string& name);
163 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
164 relativePositions_m(false) {}
172 itsCoordTrafoTo_m(1.0, 0.0, 0.0, 0.0),
173 relativePositions_m(false) {}
180 itsOrigin_m(rhs.itsOrigin_m),
181 itsCoordTrafoTo_m(rhs.itsCoordTrafoTo_m),
182 relativePositions_m(rhs.relativePositions_m) {}
195 for (
typename std::list<T>::const_reverse_iterator op = this->rbegin(); op != this->rend();
200 for (
typename std::list<T>::const_iterator op = this->begin(); op != this->end(); ++op) {
210 for (
typename std::list<T>::const_iterator op = this->begin(); op != this->end(); ++op) {
213 newObj.setElement(op->getElement()->clone());
232 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end();
236 newObj.setElement(iter->getElement()->copyStructure());
253 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end(); ++iter) {
272 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end(); ++iter) {
283 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end(); ++iter) {
284 length += iter->getElement()->getElementLength();
292 return (getArcLength() / 2.0);
297 return (-getOrigin());
302 return (getArcLength() / 2.0);
310 double s1 = getEntrance();
311 typename std::list<T>::const_iterator iter = this->begin();
313 while (iter != this->end() && s1 <= toS) {
319 double s0 = (s1 + s2) / 2.0;
320 double arc1 = std::max(s1, fromS) - s0;
321 double arc2 = std::min(s2, toS) - s0;
329 double s1 = getExit();
330 typename std::list<T>::const_reverse_iterator iter = this->rbegin();
332 while (iter != this->rend() && s1 >= toS) {
338 double s0 = (s1 + s2) / 2.0;
339 double arc1 = std::min(s1, fromS) - s0;
340 double arc2 = std::max(s2, toS) - s0;
356 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end(); ++iter) {
357 transform.
dotBy(iter->getElement()->getTotalTransform());
365 return getTransform(0.0, s);
370 return getTransform(0.0, getEntrance());
375 return getTransform(0.0, getExit());
385 this->push_back(obj);
390 this->push_front(obj);
405 itsCoordTrafoTo_m = trafoTo;
410 return itsCoordTrafoTo_m;
415 relativePositions_m = flag;
420 return relativePositions_m;
426 for (
typename std::list<T>::const_iterator iter = this->begin(); iter != this->end(); ++iter) {
ippl::Vector< T, Dim > Vector_t
Implements the composite geometry of a beam line.
virtual double getArcLength() const
Get arc length.
virtual void visitBeamline(const Beamline &)=0
Apply the algorithm to a beam line.
An abstract sequence of beam line components.
virtual double getArcLength() const
Get arc length.
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
Displacement and rotation in space.
const Euclid3D & dotBy(const Euclid3D &rhs)
Dot product with assign.
Quaternion storage and rotation algebra used by OPALX geometry code.
bool getRelativeFlag() const
Quaternion getInitialDirection() const
virtual Euclid3D getEntranceFrame() const
Get transform.
void setRelativeFlag(bool flag)
virtual double getArcLength() const
Get arc length.
virtual TBeamline< T > * clone() const
Make clone.
virtual double getEntrance() const
Get entrance position.
size_t size() const
Get the number of elements in the TBeamline.
void setOrigin3D(const Vector_t< double, 3 > &ori)
virtual TBeamline< T > * copyStructure()
Make structure copy.
virtual Euclid3D getTotalTransform() const
Get transform.
virtual Euclid3D getExitFrame() const
Get transform.
virtual void prepend(const T &)
Prepend a T object.
virtual void makeSharable()
Set sharable flag.
virtual double getOrigin() const
Get origin position.
TBeamline()
Default constructor.
virtual Euclid3D getTransform(double fromS, double toS) const
Get transform.
Vector_t< double, 3 > itsOrigin_m
void setInitialDirection(const Quaternion &rot)
virtual void append(const T &)
Append a T object.
virtual ElementType getType() const
Get beamline type.
Quaternion itsCoordTrafoTo_m
virtual double getElementLength() const
Get design length.
Vector_t< double, 3 > getOrigin3D() const
virtual BeamlineGeometry & getGeometry()
Get geometry.
virtual void accept(BeamlineVisitor &) const
Apply BeamlineVisitor to this line.
virtual double getExit() const
Get exit position.
virtual void iterate(BeamlineVisitor &, bool r2l) const
Apply visitor to all elements of the line.
BeamlineGeometry itsGeometry
The beamline geometry.