ElementBase.h 21.8 KB
Newer Older
gsell's avatar
gsell committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
#ifndef CLASSIC_ElementBase_HH
#define CLASSIC_ElementBase_HH 1

// ------------------------------------------------------------------------
// $RCSfile: ElementBase.h,v $
// ------------------------------------------------------------------------
// $Revision: 1.2 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Class: ElementBase
//   The very base class for beam line representation objects.  A beam line
//   is modelled as a composite structure having a single root object
//   (the top level beam line), which contains both ``single'' leaf-type
//   elements (Components), as well as sub-lines (composites).
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/12/16 16:26:43 $
// $Author: mad $
//
// ------------------------------------------------------------------------

#include "AbsBeamline/AttributeSet.h"
#include "BeamlineGeometry/Geometry.h"
#include "MemoryManagement/RCObject.h"
30 31 32
#include "Algorithms/Vektor.h"
#include "Algorithms/Quaternion.h"
#include "Algorithms/CoordinateSystemTrafo.h"
33
#include "Utilities/GeneralClassicException.h"
34

gsell's avatar
gsell committed
35
#include <string>
36
#include <queue>
gsell's avatar
gsell committed
37 38 39 40 41 42 43 44 45

class BeamlineVisitor;
class Channel;
class ConstChannel;
class ElementImage;

enum ElemType {
    isDrift,
    isSolenoid,
46
    isSource,
gsell's avatar
gsell committed
47 48 49
    isRF,
    isDipole,
    isMultipole,
kraus's avatar
kraus committed
50
    isOther
gsell's avatar
gsell committed
51 52 53 54 55
};



class WakeFunction;
56
class ParticleMatterInteractionHandler;
gsell's avatar
gsell committed
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132
class BoundaryGeometry;

// Class ElementBase
// ------------------------------------------------------------------------
/// 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:
//  [OL]
//  [LI]
//  A set of concrete accelerator element classes, which compose the standard
//  accelerator component library (SACL).
//  [LI]
//  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.
//  [/OL]
//  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.
//  [pre]
//    AlignWrapper --> FieldWrapper --> Element
//  [/pre]
//  To ensure this structure, wrapper elements cannot be constructed directly,
//  one should rather call one of:
//  [dl]
//  [dt]makeAlignWrapper()  [dd]make an align wrapper.
//  [dt]makeFieldWrapper()  [dd]make a field wrapper.
//  [dt]makeWrappers()      [dd]make both wrappers.
//  [/dl]
//  An existing wrapper can be removed by
//  [dl]
//  [dt]removeAlignWrapper()[dd]remove align wrapper.
//  [dt]removeFieldWrapper()[dd]remove field wrapper.
//  [/dl]
//  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
//  [b]makeSharable()[/b].
//  [p]
//  An ElementBase object can return two lengths, which may be different:
//  [OL]
//  [LI]
//  The arc length along the geometry.
//  [LI]
//  The design length, often measured along a straight line.
//  [/OL]
//  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.
//  [P]
//  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:
//  [OL]
//  [LI]
//  Copy by reference: Call RCObject::addReference() and use [b]this[/b].
//  [LI]
//  Copy structure: use ElementBase::copyStructure().
//  During copying of the structure, all sharable items are re-used, while
//  all non-sharable ones are cloned.
//  [LI]
//  Copy by cloning: use ElementBase::clone().
//  This returns a full deep copy.
//  [/OL]


class ElementBase: public RCObject {

public:

    /// Constructor with given name.
133
    explicit ElementBase(const std::string &name);
gsell's avatar
gsell committed
134 135 136 137 138 139

    ElementBase();
    ElementBase(const ElementBase &);
    virtual ~ElementBase();

    /// Get element name.
140
    virtual const std::string &getName() const;
gsell's avatar
gsell committed
141 142

    /// Set element name.
143
    virtual void setName(const std::string &name);
gsell's avatar
gsell committed
144

145 146 147 148 149
    enum ApertureType {RECTANGULAR
                     , ELLIPTICAL
                     , CONIC_RECTANGULAR
                     , CONIC_ELLIPTICAL
    };
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169

    enum ElementType {ALIGNWRAPPER
                    , BEAMBEAM
                    , BEAMBEAM3D
                    , BEAMLINE
                    , COLLIMATOR
                    , CORRECTOR
                    , CORRECTORWRAPPER
                    , CYCLOTRON
                    , CYCLOTRONWRAPPER
                    , CYCLOTRONVALLEY
                    , DEGRADER
                    , DIAGNOSTIC
                    , DRIFT
                    , INTEGRATOR
                    , LAMBERTSON
                    , MARKER
                    , MONITOR
                    , MPSPLITINTEGRATOR
                    , MULTIPOLE
ext-rogers_c's avatar
ext-rogers_c committed
170
                    , MULTIPOLET
171 172 173 174 175 176
                    , MULTIPOLEWRAPPER
                    , OFFSET
                    , PARALLELPLATE
                    , PATCH
                    , PROBE
                    , RBEND
177
                    , RBEND3D
178 179 180 181 182 183 184 185 186 187
                    , RBENDWRAPPER
                    , RFCAVITY
                    , RFQUADRUPOLE
                    , RING
                    , SBEND3D
                    , SBEND
                    , SBENDWRAPPER
                    , SEPARATOR
                    , SEPTUM
                    , SOLENOID
188
                    , SOURCE
189 190 191 192 193
                    , STRIPPER
                    , TRAVELINGWAVE
                    , VARIABLERFCAVITY
                    , ANY};

194
    /// Get element type std::string.
195 196 197
    virtual ElementType getType() const = 0;

    std::string getTypeString() const;
198
    static std::string getTypeString(ElementType type);
gsell's avatar
gsell committed
199 200 201 202

    /// Get geometry.
    //  Return the element geometry.
    //  Version for non-constant object.
203
    virtual BGeometryBase  &getGeometry() = 0;
gsell's avatar
gsell committed
204 205 206 207

    /// Get geometry.
    //  Return the element geometry
    //  Version for constant object.
208
    virtual const BGeometryBase  &getGeometry() const = 0;
gsell's avatar
gsell committed
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285

    /// Get arc length.
    //  Return the entire arc length measured along the design orbit
    virtual double getArcLength() const;

    /// Get design length.
    //  Return the design length defined by the geometry.
    //  This may be the arc length or the straight length.
    virtual double getElementLength() const;

    /// Set design length.
    //  Set the design length defined by the geometry.
    //  This may be the arc length or the straight length.
    virtual void setElementLength(double length);

    /// Get origin position.
    //  Return the arc length from the entrance to the origin of the element
    //  (origin >= 0)
    virtual double getOrigin() const;

    /// Get entrance position.
    //  Return the arc length from the origin to the entrance of the element
    //  (entrance <= 0)
    virtual double getEntrance() const;

    /// Get exit position.
    //  Return the arc length from the origin to the exit of the element
    //  (exit >= 0)
    virtual double getExit() const;

    /// Get transform.
    //  Return the transform of the local coordinate system from the
    //  position [b]fromS[/b] to the position [b]toS[/b].
    virtual Euclid3D getTransform(double fromS, double toS) const;

    /// Get transform.
    //  Equivalent to getTransform(0.0, s).
    //  Return the transform of the local coordinate system from the
    //  origin and [b]s[/b].
    virtual Euclid3D getTransform(double s) 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 getTotalTransform() 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 getEntranceFrame() 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 getExitFrame() 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 Euclid3D getEntrancePatch() 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 Euclid3D getExitPatch() const;

    /// Get attribute value.
    //  If the attribute does not exist, return zero.
286
    virtual double getAttribute(const std::string &aKey) const;
gsell's avatar
gsell committed
287 288 289

    /// Test for existence of an attribute.
    //  If the attribute exists, return true, otherwise false.
290
    virtual bool hasAttribute(const std::string &aKey) const;
gsell's avatar
gsell committed
291 292

    /// Remove an existing attribute.
293
    virtual void removeAttribute(const std::string &aKey);
gsell's avatar
gsell committed
294 295

    /// Set value of an attribute.
296
    virtual void setAttribute(const std::string &aKey, double val);
gsell's avatar
gsell committed
297 298 299 300 301

    /// Construct a read/write channel.
    //  This method constructs a Channel permitting read/write access to
    //  the attribute [b]aKey[/b] and returns it.
    //  If the attribute does not exist, it returns NULL.
302
    virtual Channel *getChannel(const std::string &aKey, bool create = false);
gsell's avatar
gsell committed
303 304 305 306 307

    /// Construct a read-only channel.
    //  This method constructs a Channel permitting read-only access to
    //  the attribute [b]aKey[/b] and returns it.
    //  If the attribute does not exist, it returns NULL.
308
    virtual const ConstChannel *getConstChannel(const std::string &aKey) const;
gsell's avatar
gsell committed
309 310

    /// Construct an image.
311
    //  Return the image of the element, containing the name and type std::string
gsell's avatar
gsell committed
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
    //  of the element, and a copy of the user-defined attributes.
    virtual ElementImage *getImage() const;

    /// 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 void accept(BeamlineVisitor &visitor) const = 0;


    /// Return clone.
    //  Return an identical deep copy of the element.
    virtual ElementBase *clone() const = 0;

    /// Make a structural copy.
    //  Return a fresh copy of any beam line structure is made,
    //  but sharable elements remain shared.
    virtual ElementBase *copyStructure();

    /// Test if the element can be shared.
    bool isSharable() const;

    /// Set sharable flag.
    //  The whole structure depending on [b]this[/b] is marked as sharable.
    //  After this call a [b]copyStructure()[/b] call reuses the element.
    virtual void makeSharable();

    /// 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 *makeAlignWrapper();

    /// 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 ElementBase *makeFieldWrapper();

    /// Allow errors.
    //  Equivalent to the calls
    //  [pre]
    //    makeFieldWrapper()->makeAlignWrapper()
    //  [/pre].
    //  Wrappers are non-sharable, unless otherwise defined.
    virtual ElementBase *makeWrappers();

    /// Remove align wrapper.
    //  Remove the align wrapper.
    virtual ElementBase *removeAlignWrapper();

    /// Remove align wrapper.
    //  Remove the align wrapper.
    virtual const ElementBase *removeAlignWrapper() const ;

    /// Remove field wrapper.
    //  Remove the field wrapper.
    virtual ElementBase *removeFieldWrapper();

    /// Remove field wrapper.
    //  Remove the field wrapper for constant object.
    virtual const ElementBase *removeFieldWrapper() const;

    /// Return the design element.
    //  Return [b]this[/b], if the element is not wrapped.
    virtual ElementBase *removeWrappers();

    /// Return the design element.
    //  Return [b]this[/b], if the element is not wrapped.
    virtual const  ElementBase *removeWrappers() const ;

    /// Update element.
    //  This method stores all attributes contained in the AttributeSet to
    //  "*this".  The return value [b]true[/b] indicates success.
    bool update(const AttributeSet &);

390 391 392
    void setElementPosition(double elemedge);
    double getElementPosition() const;
    bool isElementPositionSet() const;
gsell's avatar
gsell committed
393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410

    /// attach a boundary geometry field to the element
    virtual void setBoundaryGeometry(BoundaryGeometry *geo);

    /// return the attached boundary geometrt object if there is any
    virtual BoundaryGeometry *getBoundaryGeometry() const;

    virtual bool hasBoundaryGeometry() const;


    /// attach a wake field to the element
    virtual void setWake(WakeFunction *wf);

    /// return the attached wake object if there is any
    virtual WakeFunction *getWake() const;

    virtual bool hasWake() const;

411
    virtual void setParticleMatterInteraction(ParticleMatterInteractionHandler *spys);
gsell's avatar
gsell committed
412

413
    virtual ParticleMatterInteractionHandler *getParticleMatterInteraction() const;
gsell's avatar
gsell committed
414

415
    virtual bool hasParticleMatterInteraction() const;
gsell's avatar
gsell committed
416 417 418 419 420 421 422

    /// returns element type as enumeration needed in the envelope tracker
    ElemType getElType() const;

    /// set the element type as enumeration needed in the envelope tracker
    void setElType(ElemType elt);

423 424
    void setCSTrafoGlobal2Local(const CoordinateSystemTrafo &ori);
    CoordinateSystemTrafo getCSTrafoGlobal2Local() const;
425
    void releasePosition();
426
    void fixPosition();
427
    bool isPositioned() const;
428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448

    virtual CoordinateSystemTrafo getBeginToEnd() const;

    void setAperture(const ApertureType& type, const std::vector<double> &args);
    std::pair<ElementBase::ApertureType, std::vector<double> > getAperture() const;

    virtual bool isInside(const Vector_t &r) const;

    void setMisalignment(double x, double y, double s);
    void setMisalignment(const CoordinateSystemTrafo &cst);

    void getMisalignment(double &x, double &y, double &s) const;
    CoordinateSystemTrafo getMisalignment() const;

    void setActionRange(const std::queue<std::pair<double, double> > &range);
    void setCurrentSCoordinate(double s);

    /// Set rotation about z axis in bend frame.
    void setRotationAboutZ(double rotation);
    double getRotationAboutZ() const;

gsell's avatar
gsell committed
449
protected:
450
    bool isInsideTransverse(const Vector_t &r, double f = 1) const;
gsell's avatar
gsell committed
451 452 453 454 455

    // Sharable flag.
    // If this flag is true, the element is always shared.
    mutable bool shareFlag;

456 457 458 459 460 461 462 463 464
    CoordinateSystemTrafo csTrafoGlobal2Local_m;
    CoordinateSystemTrafo misalignment_m;

    std::pair<ApertureType, std::vector<double> > aperture_m;

    double elementEdge_m;

    double rotationZAxis_m;

gsell's avatar
gsell committed
465 466 467 468 469 470
private:

    // Not implemented.
    void operator=(const ElementBase &);

    // The element's name
471
    std::string elementID;
gsell's avatar
gsell committed
472 473 474 475 476 477 478 479

    // The user-defined set of attributes.
    AttributeSet userAttribs;

    WakeFunction *wake_m;

    BoundaryGeometry *bgeometry_m;

480
    ParticleMatterInteractionHandler *parmatint_m;
gsell's avatar
gsell committed
481 482

    ElemType elType_m;
483 484 485

    bool positionIsFixed;

486 487 488
    double elementPosition_m;
    bool elemedgeSet_m;

489
    std::queue<std::pair<double, double> > actionRange_m;
gsell's avatar
gsell committed
490 491 492 493 494 495
};


// Inline functions.
// ------------------------------------------------------------------------

496 497
inline
double ElementBase::getArcLength() const
gsell's avatar
gsell committed
498 499
{ return getGeometry().getArcLength(); }

500 501
inline
double ElementBase::getElementLength() const
gsell's avatar
gsell committed
502 503
{ return getGeometry().getElementLength(); }

504 505
inline
void ElementBase::setElementLength(double length)
gsell's avatar
gsell committed
506 507
{ getGeometry().setElementLength(length); }

508 509
inline
double ElementBase::getOrigin() const
gsell's avatar
gsell committed
510 511
{ return getGeometry().getOrigin(); }

512 513
inline
double ElementBase::getEntrance() const
gsell's avatar
gsell committed
514 515
{ return getGeometry().getEntrance(); }

516 517
inline
double ElementBase::getExit() const
gsell's avatar
gsell committed
518 519
{ return getGeometry().getExit(); }

520 521
inline
Euclid3D ElementBase::getTransform(double fromS, double toS) const
gsell's avatar
gsell committed
522 523
{ return getGeometry().getTransform(fromS, toS); }

524 525
inline
Euclid3D ElementBase::getTotalTransform() const
gsell's avatar
gsell committed
526 527
{ return getGeometry().getTotalTransform(); }

528 529
inline
Euclid3D ElementBase::getTransform(double s) const
gsell's avatar
gsell committed
530 531
{ return getGeometry().getTransform(s); }

532 533
inline
Euclid3D ElementBase::getEntranceFrame() const
gsell's avatar
gsell committed
534 535
{ return getGeometry().getEntranceFrame(); }

536 537
inline
Euclid3D ElementBase::getExitFrame() const
gsell's avatar
gsell committed
538 539
{ return getGeometry().getExitFrame(); }

540 541
inline
Euclid3D ElementBase::getEntrancePatch() const
gsell's avatar
gsell committed
542 543
{ return getGeometry().getEntrancePatch(); }

544 545
inline
Euclid3D ElementBase::getExitPatch() const
gsell's avatar
gsell committed
546 547
{ return getGeometry().getExitPatch(); }

548 549
inline
bool ElementBase::isSharable() const
gsell's avatar
gsell committed
550 551
{ return shareFlag; }

552 553
inline
WakeFunction *ElementBase::getWake() const
gsell's avatar
gsell committed
554 555
{ return wake_m; }

556 557
inline
bool ElementBase::hasWake() const
gsell's avatar
gsell committed
558 559
{ return wake_m != NULL; }

560 561
inline
BoundaryGeometry *ElementBase::getBoundaryGeometry() const
gsell's avatar
gsell committed
562 563
{ return bgeometry_m; }

564 565
inline
bool ElementBase::hasBoundaryGeometry() const
gsell's avatar
gsell committed
566 567
{ return bgeometry_m != NULL; }

568
inline
569
ParticleMatterInteractionHandler *ElementBase::getParticleMatterInteraction() const
570
{ return parmatint_m; }
gsell's avatar
gsell committed
571

572
inline
573
bool ElementBase::hasParticleMatterInteraction() const
574
{ return parmatint_m != NULL; }
gsell's avatar
gsell committed
575

576 577
inline
ElemType ElementBase::getElType() const
gsell's avatar
gsell committed
578 579
{ return elType_m;}

580 581
inline
void ElementBase::setElType(ElemType elt)
gsell's avatar
gsell committed
582 583
{ elType_m = elt;}

584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651
inline
void ElementBase::setCSTrafoGlobal2Local(const CoordinateSystemTrafo &trafo)
{
    if (positionIsFixed) return;

    csTrafoGlobal2Local_m = trafo;
}

inline
CoordinateSystemTrafo ElementBase::getCSTrafoGlobal2Local() const
{ return csTrafoGlobal2Local_m; }

inline
CoordinateSystemTrafo ElementBase::getBeginToEnd() const
{
    CoordinateSystemTrafo ret(Vector_t(0, 0, getElementLength()),
                              Quaternion(1, 0, 0, 0));

    return ret;
}

inline
void ElementBase::setAperture(const ApertureType& type, const std::vector<double> &args)
{
    aperture_m.first = type;
    aperture_m.second = args;
}

inline
std::pair<ElementBase::ApertureType, std::vector<double> > ElementBase::getAperture() const
{
    return aperture_m;
}

inline
bool ElementBase::isInside(const Vector_t &r) const
{
    const double length = getElementLength();
    return isInsideTransverse(r, r(2) / length * aperture_m.second[2]) && r(2) >= 0.0 && r(2) < length;
}

inline
bool ElementBase::isInsideTransverse(const Vector_t &r, double f) const
{
    switch(aperture_m.first) {
    case RECTANGULAR:
        return (std::abs(r[0]) < aperture_m.second[0] && std::abs(r[1]) < aperture_m.second[1]);
    case ELLIPTICAL:
        return (std::pow(r[0] / aperture_m.second[0], 2) + std::pow(r[1] / aperture_m.second[1], 2) < 1.0);
    case CONIC_RECTANGULAR:
        return (std::abs(r[0]) < (1.0 - f) * aperture_m.second[0] && std::abs(r[1]) < (1.0 - f) * aperture_m.second[1]);
    case CONIC_ELLIPTICAL:
        return (std::pow(r[0] / ((1.0 - f) * aperture_m.second[0]), 2) + std::pow(r[1] / ((1.0 - f) * aperture_m.second[1]), 2) < 1.0);
    default:
        return false;
    }
}

inline
void ElementBase::setMisalignment(const CoordinateSystemTrafo &cst) {
    misalignment_m = cst;
}

inline
CoordinateSystemTrafo ElementBase::getMisalignment() const {
    return misalignment_m;
}

652 653 654 655 656
inline
void ElementBase::releasePosition() {
    positionIsFixed = false;
}

657 658 659 660 661 662
inline
void ElementBase::fixPosition() {
    positionIsFixed = true;
}

inline
663
bool ElementBase::isPositioned() const {
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686
    return positionIsFixed;
}

inline
void ElementBase::setActionRange(const std::queue<std::pair<double, double> > &range) {
    actionRange_m = range;

    if (actionRange_m.size() > 0)
        elementEdge_m = actionRange_m.front().first;
}

inline
void ElementBase::setRotationAboutZ(double rotation) {
    rotationZAxis_m = rotation;
}

inline
double ElementBase::getRotationAboutZ() const {
    return rotationZAxis_m;
}

inline
std::string ElementBase::getTypeString() const
687 688
{ return getTypeString(getType());}

689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708
inline
void ElementBase::setElementPosition(double elemedge) {
    elementPosition_m = elemedge;
    elemedgeSet_m = true;
}

inline
double ElementBase::getElementPosition() const {
    if (elemedgeSet_m)
        return elementPosition_m;

    throw GeneralClassicException("ElementBase::getElementPosition()",
                                  std::string("ELEMEDGE for \"") + getName() + "\" not set");
}

inline
bool ElementBase::isElementPositionSet() const
{ return elemedgeSet_m; }


ext-rogers_c's avatar
ext-rogers_c committed
709
#endif // CLASSIC_ElementBase_HH