Commit 895e02a8 authored by kraus's avatar kraus

cleaning up OpalRBend and OpalSBend

parent 52da1c54
......@@ -181,18 +181,17 @@ void OpalRBend::update() {
"RBend requires non-zero DESIGNENERGY");
}
bend->setFullGap(Attributes::getReal(itsAttr[GAP]));
double gap = Attributes::getReal(itsAttr[GAP]);
bend->setFullGap(gap);
// if(itsAttr[APERT])
// throw OpalException("OpalRBend::fillRegisteredAttributes",
// "APERTURE in RBEND not supported; use GAP and HAPERT instead");
if(itsAttr[APERT])
throw OpalException("OpalRBend::update",
"APERTURE in RBEND not supported; use GAP and HAPERT instead");
if(itsAttr[HAPERT]) {
double hapert = Attributes::getReal(itsAttr[HAPERT]);
double gap = Attributes::getReal(itsAttr[GAP]);
bend->setAperture(ElementBase::RECTANGULAR, std::vector<double>({hapert, gap, 1.0}));
} else {
double gap = Attributes::getReal(itsAttr[GAP]);
bend->setAperture(ElementBase::RECTANGULAR, std::vector<double>({0.5, gap, 1.0}));
}
......
......@@ -187,7 +187,8 @@ void OpalSBend::update() {
"SBend requires non-zero DESIGNENERGY");
}
bend->setFullGap(Attributes::getReal(itsAttr[GAP]));
double gap = Attributes::getReal(itsAttr[GAP]);
bend->setFullGap(gap);
if(itsAttr[APERT])
throw OpalException("OpalSBend::update",
......@@ -195,7 +196,9 @@ void OpalSBend::update() {
if(itsAttr[HAPERT]) {
double hapert = Attributes::getReal(itsAttr[HAPERT]);
bend->setAperture(ElementBase::RECTANGULAR, std::vector<double>({hapert, hapert, 1.0}));
bend->setAperture(ElementBase::RECTANGULAR, std::vector<double>({hapert, gap, 1.0}));
} else {
bend->setAperture(ElementBase::RECTANGULAR, std::vector<double>({0.5, gap, 1.0}));
}
if(itsAttr[LENGTH])
......@@ -222,4 +225,4 @@ void OpalSBend::update() {
// Transmit "unknown" attributes.
OpalElement::updateUnknown(bend);
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment