Commit b138e969 authored by snuverink_j's avatar snuverink_j
Browse files

fix typo, null initialisation and code simplification

parent 0ef6a56b
......@@ -209,7 +209,7 @@ class Offset : public Component {
Vector_t _end_direction;
bool _is_local;
// The offset's geometry.
Euclid3DGeometry* geometry_m;
Euclid3DGeometry* geometry_m = nullptr;
static const double lengthUnits_m;
};
......
......@@ -89,8 +89,8 @@ void OpalLocalCartesianOffset::fillRegisteredAttributes
OpalElement::fillRegisteredAttributes(base);
const Offset* offset = dynamic_cast<const Offset*>(&base);
if (offset == NULL) {
throw OpalException("OpalVariableRFCavity::fillRegisteredAttributes",
"Failed to cast ElementBase to a VariableRFCavity");
throw OpalException("OpalLocalCartesianOffset::fillRegisteredAttributes",
"Failed to cast ElementBase to a OpalLocalCartesianOffset");
}
Euclid3D trans = offset->getGeometry().getTotalTransform();
......@@ -109,8 +109,7 @@ void OpalLocalCartesianOffset::update() {
Attributes::getReal(itsAttr[END_POSITION_Y]), 0.);
Vector_t norm(Attributes::getReal(itsAttr[END_NORMAL_X]),
Attributes::getReal(itsAttr[END_NORMAL_Y]), 0.);
Offset off = Offset(Offset::localCartesianOffset(name, pos, norm));
*offset = off;
*offset = Offset(Offset::localCartesianOffset(name, pos, norm));
setElement(offset);
}
}
\ 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