Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects

Resolve "Check that element length is long relative to a time step"

Files
4
@@ -114,23 +114,24 @@ void OrbitThreader::checkElementLengths(const std::set<std::shared_ptr<Component
return;
}
double driftLength = Physics::c * stepSizes_m.getdT() * p_m(2) / Util::getGamma(p_m);
for (const std::shared_ptr<Component> field: fields) {
for (const std::shared_ptr<Component> field : fields) {
ElementBase::ElementType type = field->getType();
double length = field->getElementLength();
int numSteps = 10;
if (type == ElementBase::MONITOR ||
type == ElementBase::SOURCE ||
type == ElementBase::DRIFT ||
type == ElementBase::MARKER ||
type == ElementBase::SEPTUM ||
type == ElementBase::STRIPPER) {
continue;
numSteps = 1;
}
double length = field->getElementLength();
if (length < 10 * driftLength) {
if (length < numSteps * driftLength) {
throw OpalException("OrbitThreader::checkElementLengths",
"The element '" + field->getName() +
"' is too short compared to the size of the time step\n" +
"The time step is too long compared to the length of the\n"
"element '" + field->getName() + "'\n" +
"The length of the element is: " + std::to_string(length) + "\n"
"The distance the particles drift in 10 time steps is: " + std::to_string(10 * driftLength));
"The distance the particles drift in " + std::string(numSteps) +
" time step(s) is: " + std::to_string(numSteps * driftLength));
}
}
}
@@ -478,4 +479,4 @@ double OrbitThreader::computeDriftLengthToBoundingBox(const std::set<std::shared
}
return std::numeric_limits<double>::max();
}
\ No newline at end of file
}
Loading