83 "Can't copy construct LossDataSink so copy constructor fails");
100 if (flagNeedUpdate) {
103 <<
" m out of the field map boundary" <<
endl;
113 return flagNeedUpdate;
122 bool outOfBounds =
true;
125 double rSquared = R[0] * R[0] + R[1] * R[1];
126 if (rSquared < minR2_m || rSquared >
maxR2_m) {
130 for (
size_t i = 0; i < sections.size(); ++i) {
133 outOfBounds &= sections[i]->getFieldValue(R,
refPartBunch_m->get_centroid(), t, E_temp, B_temp);
147 "Cannot get s-dimension of a ring");
157 double& ,
double& ) {
182 double deltaAngle = std::atan2(rotationTest(2), rotationTest(0));
184 return elementRotation;
192 std::string(
"Placement of elements out of the ")+
193 "midplane is not supported by Ring");
201 Euclid3D euclid(v(2), v(0), -v(1), r(2), r(0), -r(1));
237 "Attempt to append element " + element.
getName() +
238 " when ring is locked");
256 double placeF = std::atan2(startNorm(0), startNorm(1));
264 Vector_t endNorm =
Vector_t(+startNorm(0) * std::cos(endF) - startNorm(1) * std::sin(endF),
265 +startNorm(0) * std::sin(endF) + startNorm(1) * std::cos(endF),
270 double orientation = std::atan2(startNorm(1), startNorm(0));
275 *
gmsg <<
"* Start position ("
282 *
gmsg <<
"* End position ("
294 "Attempt to lock ring when it is already locked");
298 if (sectionListSize == 0) {
300 "Failed to find any elements in Ring");
305 *
gmsg <<
"Applying symmetry to Ring" <<
endl;
307 for (
size_t j = 0; j < sectionListSize; ++j) {
341 for (
int i = 0; i < 3; ++i) {
345 "Ring is not closed");
353 ringSections_m = std::vector< std::vector<RingSection*> >(nSections);
377 if (minR < 0 || maxR < 0) {
379 "Could not parse negative or undefined aperture limit");
389 std::stringstream err;
390 err <<
"Attempt to get RingSection for element " << i
395 if (
sec ==
nullptr) {
397 "Opal internal error - RingSection was null");
Tps< T > sec(const Tps< T > &x)
Secant.
Inform & level4(Inform &inf)
Inform & endl(Inform &inf)
constexpr double two_pi
The value of.
constexpr double e
The value of.
virtual void visitRing(const Ring &)=0
Apply the algorithm to a ring.
Component(const std::string &name)
Constructor with given name.
PartBunchBase< double, 3 > * RefPartBunch_m
virtual const std::string & getName() const
Get element name.
virtual ElementBase * clone() const =0
Return clone.
virtual BGeometryBase & getGeometry()=0
Get geometry.
Vector_t getNextPosition() const
std::vector< RingSection * > getSectionsAt(const Vector_t &pos)
Rotation3D getRotationStartToEnd(Euclid3D delta) const
size_t getNumberOfRingSections() const
static bool sectionCompare(RingSection const *const sec1, RingSection const *const sec2)
Vector_t getNextNormal() const
virtual void finalise() override
virtual bool apply(const size_t &id, const double &t, Vector_t &E, Vector_t &B) override
Ring(const std::string &ring)
RingSection * getLastSectionPlaced() const
void setRefPartBunch(PartBunchBase< double, 3 > *bunch)
virtual void initialise(PartBunchBase< double, 3 > *bunch, double &startField, double &endField) override
double latticeThetaInit_m
std::vector< RingSectionList > ringSections_m
virtual void accept(BeamlineVisitor &visitor) const override
void setRingAperture(double minR, double maxR)
RingSectionList section_list_m
void checkMidplane(Euclid3D delta) const
void setLossDataSink(LossDataSink *sink)
PlanarArcGeometry planarArcGeometry_m
virtual void getDimensions(double &zBegin, double &zEnd) const override
void appendElement(const Component &element)
Vector_t getStartNormal() const
void rotateToCyclCoordinates(Euclid3D &euclid3d) const
static const double lengthTolerance_m
RingSection * getSection(int i) const
Vector_t getStartPosition() const
PartBunchBase< double, 3 > * refPartBunch_m
static const double angleTolerance_m
Displacement and rotation in space.
const Vector3D & getVector() const
Get displacement.
const Rotation3D & getRotation() const
Get rotation.
virtual Euclid3D getTotalTransform() const
Get transform.
Rotation in 3-dimensional space.
static Rotation3D ZRotation(double angle)
Make rotation.
Vector3D getAxis() const
Get axis vector.
Component placement handler in ring geometry.
void setStartNormal(Vector_t orientation)
void setComponentPosition(Vector_t position)
void setComponent(Component *component)
void setStartPosition(Vector_t pos)
Vector_t getStartNormal() const
void setComponentOrientation(Vector_t orientation)
Component * getComponent() const
Vector_t getEndPosition() const
Vector_t getStartPosition() const
void setEndPosition(Vector_t pos)
Vector_t getEndNormal() const
void setEndNormal(Vector_t orientation)
Vektor< double, 3 > Vector_t