class
ElementBase
: public RCObject
(Return to index)
Interface for basic beam line object.
This class defines the abstract interface for all objects which can be
contained in a beam line. ElementBase forms the base class for two distinct
but related hierarchies of objects:
-
A set of concrete accelerator element classes, which compose the standard
accelerator component library (SACL).
-
A second hierarchy which parallels the SACL, acting as container or
wrapper-like objects. These latter classes are used to construct
beam-lines composed of referenced ``design'' components, together with
beam-line position dependent extrinsic state (e. g. errors). These wrapper
objects are by default unique.
Also derived from ElementBase there is a class AlignWrapper, which can
be used to store misalignment errors or deliberate displacements.
Any element can have only one AlignWrapper and one FieldWrapper. To be
processed in the correct order, the AlignWrapper must be the outermost.
AlignWrapper --> FieldWrapper --> Element
To ensure this structure, wrapper elements cannot be constructed directly,
one should rather call one of:
- makeAlignWrapper()
- make an align wrapper.
- makeFieldWrapper()
- make a field wrapper.
- makeWrappers()
- make both wrappers.
An existing wrapper can be removed by
- removeAlignWrapper()
- remove align wrapper.
- removeFieldWrapper()
- remove field wrapper.
Instances of the concrete classes for single elements are by default
sharable. Instances of beam lines, wrappers and integrators are by
default non-sharable, but they may be made sharable by a call to
makeSharable().
An ElementBase object can return two lengths, which may be different:
-
The arc length along the geometry.
-
The design length, often measured along a straight line.
Class ElementBase contains a map of name versus value for user-defined
attributes (see file AbsBeamline/AttributeSet.hh). The map is primarily
intended for processes that require algorithm-specific data in the
accelerator model.
The class ElementBase has as base class the abstract class RCObject.
Virtual derivation is used to make multiple inheritance possible for
derived concrete classes. ElementBase implements three copy modes:
-
Copy by reference: Call RCObject::addReference() and use this.
-
Copy structure: use ElementBase::copyStructure().
During copying of the structure, all sharable items are re-used, while
all non-sharable ones are cloned.
-
Copy by cloning: use ElementBase::clone().
This returns a full deep copy.
Type: |
Abstract |
Superclasses: |
public RCObject |
Include file: |
./AbsBeamline/ElementBase.hh |
Inheritance
Synopsis (including inherited members):
- Public members:
- Protected Members:
-
mutable bool shareFlag
;
-
RCObject& operator=
(const RCObject&)
;
Documentation:
- Public members:
-
ElementBase
(const string&)
;
- Constructor with given name.
-
virtual void accept
(BeamlineVisitor&)const
= 0
;
- Apply visitor.
This method must be overridden by derived classes. It should call the
method of the visitor corresponding to the element class.
If any error occurs, this method throws an exception.
-
virtual ElementBase* clone
()const
= 0
;
- Return clone.
Return an identical deep copy of the element.
-
virtual ElementBase* copyStructure
()
;
- Make a structural copy.
Return a fresh copy of any beam line structure is made,
but sharable elements remain shared.
-
virtual double getArcLength
()const
;
- Get arc length.
Return the entire arc length measured along the design orbit
-
virtual double getAttribute
(const string&)const
;
- Get attribute value.
If the attribute does not exist, return zero.
-
virtual Channel* getChannel
(const string&)
;
- Construct a read/write channel.
This method constructs a Channel permitting read/write access to
the attribute aKey and returns it.
If the attribute does not exist, it returns NULL.
-
virtual const ConstChannel* getConstChannel
(const string&)const
;
- Construct a read-only channel.
This method constructs a Channel permitting read-only access to
the attribute aKey and returns it.
If the attribute does not exist, it returns NULL.
-
virtual double getElementLength
()const
;
- Get design length.
Return the design length defined by the geometry.
This may be the arc length or the straight length.
-
virtual double getEntrance
()const
;
- Get entrance position.
Return the arc length from the origin to the entrance of the element
(entrance <= 0)
-
virtual Euclid3D getEntranceFrame
()const
;
- Get transform.
Equivalent to getTransform(0.0, getEntrance()).
Return the transform of the local coordinate system from the
origin to the entrance of the element.
-
virtual Euclid3D getEntrancePatch
()const
;
- Get patch.
Returns the entrance patch (transformation) which is used to transform
the global geometry to the local geometry for a misaligned element
at its entrance. The default behaviour returns identity transformation.
This function should be overridden by derived concrete classes which
model complex geometries.
-
virtual double getExit
()const
;
- Get exit position.
Return the arc length from the origin to the exit of the element
(exit >= 0)
-
virtual Euclid3D getExitFrame
()const
;
- Get transform.
Equivalent to getTransform(0.0, getExit()).
Return the transform of the local coordinate system from the
origin to the exit of the element.
-
virtual Euclid3D getExitPatch
()const
;
- Get patch.
Returns the entrance patch (transformation) which is used to transform
the local geometry to the global geometry for a misaligned element
at its exit. The default behaviour returns identity transformation.
This function should be overridden by derived concrete classes which
model complex geometries.
-
virtual Geometry& getGeometry
()
= 0
;
- Get geometry.
Return the element geometry.
Version for non-constant object.
-
virtual const Geometry& getGeometry
()const
= 0
;
- Get geometry.
Return the element geometry
Version for constant object.
-
virtual ElementImage* getImage
()const
;
- Construct an image.
Return the image of the element, containing the name and type string
of the element, and a copy of the user-defined attributes.
-
virtual const string& getName
()const
;
- Get element name.
-
virtual double getOrigin
()const
;
- Get origin position.
Return the arc length from the entrance to the origin of the element
(origin >= 0)
-
virtual Euclid3D getTotalTransform
()const
;
- Get transform.
Equivalent to getTransform(getEntrance(), getExit()).
Return the transform of the local coordinate system from the
entrance to the exit of the element.
-
virtual Euclid3D getTransform
(double,double)const
;
- Get transform.
Return the transform of the local coordinate system from the
position fromS to the position toS.
-
virtual Euclid3D getTransform
(double)const
;
- Get transform.
Equivalent to getTransform(0.0, s).
Return the transform of the local coordinate system from the
origin and s.
-
virtual const string& getType
()const
= 0
;
- Get element type string.
-
virtual bool hasAttribute
(const string&)const
;
- Test for existence of an attribute.
If the attribute exists, return true, otherwise false.
-
bool isSharable
()const
;
- Test if the element can be shared.
-
virtual ElementBase* makeAlignWrapper
()
;
- Allow misalignment.
Build an AlignWrapper pointing to the element and return a pointer to
that wrapper. If the element cannot be misaligned, or already has an
AlignWrapper, return a pointer to the element.
Wrappers are non-sharable, unless otherwise defined.
-
virtual ElementBase* makeFieldWrapper
()
;
- Allow field errors.
Build a FieldWrapper pointing to the element and return a pointer to
that wrapper. If the element cannot have field errors, or already has
a FieldWrapper, return a pointer to the element.
Wrappers are non-sharable, unless otherwise defined.
-
virtual void makeSharable
()
;
- Set sharable flag.
The whole structure depending on this is marked as sharable.
After this call a copyStructure() call reuses the element.
-
virtual ElementBase* makeWrappers
()
;
- Allow errors.
Equivalent to the calls
makeFieldWrapper()->makeAlignWrapper()
.
Wrappers are non-sharable, unless otherwise defined.
-
virtual ElementBase* removeAlignWrapper
()
;
- Remove align wrapper.
Remove the align wrapper.
-
virtual const ElementBase* removeAlignWrapper
()const
;
- Remove align wrapper.
Remove the align wrapper.
-
virtual void removeAttribute
(const string&)
;
- Remove an existing attribute.
-
virtual ElementBase* removeFieldWrapper
()
;
- Remove field wrapper.
Remove the field wrapper.
-
virtual const ElementBase* removeFieldWrapper
()const
;
- Remove field wrapper.
Remove the field wrapper for constant object.
-
virtual ElementBase* removeWrappers
()
;
- Return the design element.
Return this, if the element is not wrapped.
-
virtual const ElementBase* removeWrappers
()const
;
- Return the design element.
Return this, if the element is not wrapped.
-
virtual void setAttribute
(const string&,double)
;
- Set value of an attribute.
-
virtual void setElementLength
(double)
;
- Set design length.
Set the design length defined by the geometry.
This may be the arc length or the straight length.
-
virtual void setName
(const string&)
;
- Set element name.
-
bool update
(const AttributeSet&)
;
- Update element.
This method stores all attributes contained in the AttributeSet to
"*this". The return value true indicates success.
- Protected members:
Documentation generated by fci on Mon Feb 7 11:41:37 2000