SBend.cpp 2.43 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
// ------------------------------------------------------------------------
// $RCSfile: SBend.cpp,v $
// ------------------------------------------------------------------------
// $Revision: 1.1.1.1 $
// ------------------------------------------------------------------------
// Copyright: see Copyright.readme
// ------------------------------------------------------------------------
//
// Definitions for class: SBend
//   Defines the abstract interface for a sector bend magnet.
//
// ------------------------------------------------------------------------
// Class category: AbsBeamline
// ------------------------------------------------------------------------
//
// $Date: 2000/03/27 09:32:31 $
// $Author: fci $
//
// ------------------------------------------------------------------------

#include "AbsBeamline/SBend.h"
22
#include "Algorithms/PartBunch.h"
gsell's avatar
gsell committed
23
#include "AbsBeamline/BeamlineVisitor.h"
24
#include "Utilities/Options.h"
25
#include "Fields/Fieldmap.h"
26
#include "AbstractObjects/OpalData.h"
gsell's avatar
gsell committed
27 28 29
#include <iostream>
#include <fstream>

kraus's avatar
kraus committed
30 31
extern Inform *gmsg;

gsell's avatar
gsell committed
32 33 34 35
// Class SBend
// ------------------------------------------------------------------------

SBend::SBend():
36 37 38
    Bend()
{
    setMessageHeader("SBend ");
gsell's avatar
gsell committed
39 40 41
}

SBend::SBend(const SBend &right):
42 43 44
    Bend(right)
{
    setMessageHeader("SBend ");
45
}
gsell's avatar
gsell committed
46

Steve Russell's avatar
Steve Russell committed
47
SBend::SBend(const std::string &name):
48 49 50
    Bend(name)
{
    setMessageHeader("SBend ");
gsell's avatar
gsell committed
51 52 53 54 55 56 57 58 59
}

SBend::~SBend() {
}

void SBend::accept(BeamlineVisitor &visitor) const {
    visitor.visitSBend(*this);
}

60 61 62 63
/*
 * OPAL-MAP methods
 * ================
 */
gsell's avatar
gsell committed
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
double SBend::getNormalComponent(int n) const {
    return getField().getNormalComponent(n);
}

double SBend::getSkewComponent(int n) const {
    return getField().getSkewComponent(n);
}

void SBend::setNormalComponent(int n, double v) {
    getField().setNormalComponent(n, v);
}

void SBend::setSkewComponent(int n, double v) {
    getField().setSkewComponent(n, v);
}

80

81 82 83 84 85 86 87 88 89
/*
 * OPAL-T Methods.
 * ===============
 */

/*
 *  This function merely repackages the field arrays as type Vector_t and calls
 *  the equivalent method but with the Vector_t data types.
 */
gsell's avatar
gsell committed
90

91 92
ElementBase::ElementType SBend::getType() const {
    return SBEND;
93
}
gsell's avatar
gsell committed
94

95

96 97
bool SBend::findChordLength(Inform &msg,
                            double &chordLength) {
98 99 100 101 102

    /*
     * Find bend chord length. If this was not set by the user using the
     * L (length) attribute, infer it from the field map.
     */
103
    chordLength = getLength();
104
    return true;
105
}