Commit 34805a45 authored by kraus's avatar kraus
Browse files

fixing orientation of dipoles in *_ElementPositions.txt and starting and end...

fixing orientation of dipoles in *_ElementPositions.txt and starting and end points of elements where the edge doesn't coinside with beginning
parent 4a8795e9
......@@ -129,7 +129,8 @@ public:
std::vector<Vector_t> getOutline() const;
MeshData getSurfaceMesh() const;
virtual CoordinateSystemTrafo getBeginToEnd() const;
virtual CoordinateSystemTrafo getEdgeToEnd() const;
CoordinateSystemTrafo getBeginToEnd_local() const;
virtual bool isInside(const Vector_t &r) const;
......@@ -214,7 +215,6 @@ private:
bool treatAsDrift(Inform &msg, double chordlength);
void retrieveDesignEnergy(double startField);
CoordinateSystemTrafo getBeginToEnd_local() const;
void setCSTrafoToEntranceRegion(const CoordinateSystemTrafo &trafo);
void setCSTrafoToExitRegion(const CoordinateSystemTrafo &trafo);
Vector_t transformToEntranceRegion(const Vector_t &R) const;
......@@ -403,7 +403,7 @@ double Bend::getMapLength() const
}
inline
CoordinateSystemTrafo Bend::getBeginToEnd() const
CoordinateSystemTrafo Bend::getEdgeToEnd() const
{
return beginToEnd_m;
}
......@@ -434,4 +434,4 @@ Vector_t Bend::transformToExitRegion(const Vector_t &R) const {
return toExitRegion_m.transformTo(R);
}
#endif // CLASSIC_BEND_H
#endif // CLASSIC_BEND_H
\ No newline at end of file
......@@ -56,11 +56,11 @@ BendBase::BendBase(const std::string &name):
std::vector<Vector_t> BendBase::getDesignPath() const {
unsigned int size = refTrajMap_m.size();
std::vector<Vector_t> designPath(size);
double angleZ = getRotationAboutZ();
Quaternion rotationAboutZ(cos(angleZ / 2), sin(angleZ / 2) * Vector_t(0, 0, 1));
// double angleZ = getRotationAboutZ();
// Quaternion rotationAboutZ(cos(angleZ / 2), sin(angleZ / 2) * Vector_t(0, 0, 1));
for (unsigned int i = 0; i < size; ++ i) {
Vector_t currentPosition = refTrajMap_m[i];
designPath[i] = rotationAboutZ.rotate(currentPosition);
designPath[i] = currentPosition;//rotationAboutZ.rotate(currentPosition);
}
return designPath;
......
......@@ -434,7 +434,8 @@ public:
void fixPosition();
bool isPositioned() const;
virtual CoordinateSystemTrafo getBeginToEnd() const;
virtual CoordinateSystemTrafo getEdgeToBegin() const;
virtual CoordinateSystemTrafo getEdgeToEnd() const;
void setAperture(const ApertureType& type, const std::vector<double> &args);
std::pair<ElementBase::ApertureType, std::vector<double> > getAperture() const;
......@@ -602,7 +603,16 @@ CoordinateSystemTrafo ElementBase::getCSTrafoGlobal2Local() const
{ return csTrafoGlobal2Local_m; }
inline
CoordinateSystemTrafo ElementBase::getBeginToEnd() const
CoordinateSystemTrafo ElementBase::getEdgeToBegin() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, 0),
Quaternion(1, 0, 0, 0));
return ret;
}
inline
CoordinateSystemTrafo ElementBase::getEdgeToEnd() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, getElementLength()),
Quaternion(1, 0, 0, 0));
......
......@@ -207,6 +207,8 @@ public:
virtual void getElementDimensions(double &begin,
double &end) const;
virtual CoordinateSystemTrafo getEdgeToBegin() const;
virtual CoordinateSystemTrafo getEdgeToEnd() const;
protected:
std::shared_ptr<AbstractTimeDependence> phase_td_m;
......@@ -510,4 +512,24 @@ std::string RFCavity::getFrequencyModelName() {
return frequency_name_m;
}
inline
CoordinateSystemTrafo RFCavity::getEdgeToBegin() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, startField_m),
Quaternion(1, 0, 0, 0));
return ret;
}
inline
CoordinateSystemTrafo RFCavity::getEdgeToEnd() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, endField_m),
Quaternion(1, 0, 0, 0));
return ret;
}
#endif // CLASSIC_RFCavity_HH
\ No newline at end of file
......@@ -89,6 +89,10 @@ public:
virtual double getElementLength() const;
virtual void getElementDimensions(double &zBegin, double &zEnd) const;
virtual CoordinateSystemTrafo getEdgeToBegin() const;
virtual CoordinateSystemTrafo getEdgeToEnd() const;
private:
// std::string name; /**< The name of the object*/
......@@ -105,4 +109,23 @@ private:
void operator=(const Solenoid &);
};
inline
CoordinateSystemTrafo Solenoid::getEdgeToBegin() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, startField_m),
Quaternion(1, 0, 0, 0));
return ret;
}
inline
CoordinateSystemTrafo Solenoid::getEdgeToEnd() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, startField_m + length_m),
Quaternion(1, 0, 0, 0));
return ret;
}
#endif // CLASSIC_Solenoid_HH
\ No newline at end of file
......@@ -103,6 +103,8 @@ public:
virtual void getElementDimensions(double &begin,
double &end) const;
virtual CoordinateSystemTrafo getEdgeToBegin() const;
virtual CoordinateSystemTrafo getEdgeToEnd() const;
private:
Fieldmap *CoreFieldmap_m;
......@@ -237,4 +239,23 @@ inline
void TravelingWave::setMode(double mode) {
Mode_m = mode;
}
inline
CoordinateSystemTrafo TravelingWave::getEdgeToBegin() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, -0.5 * PeriodLength_m),
Quaternion(1, 0, 0, 0));
return ret;
}
inline
CoordinateSystemTrafo TravelingWave::getEdgeToEnd() const
{
CoordinateSystemTrafo ret(Vector_t(0, 0, -0.5 * PeriodLength_m + length_m),
Quaternion(1, 0, 0, 0));
return ret;
}
#endif // CLASSIC_TravelingWave_HH
\ No newline at end of file
......@@ -428,7 +428,7 @@ void OpalBeamline::plot3DLattice() {
corners.push_back(rotDiagonal.rotate(toBegin.transformFrom(point)));
}
} else {
CoordinateSystemTrafo toEnd = element->getBeginToEnd() * toBegin;
CoordinateSystemTrafo toEnd = element->getEdgeToEnd() * toBegin;
auto aperture = element->getAperture();
double elementHeightFront = aperture.second[0];
double elementHeightBack = aperture.second[0] * aperture.second[2];
......@@ -507,8 +507,9 @@ void OpalBeamline::save3DLattice() {
MeshGenerator mesh;
for (; it != end; ++ it) {
std::shared_ptr<Component> element = (*it).getElement();
CoordinateSystemTrafo toEnd = element->getBeginToEnd() * (*it).getCoordTransformationTo();
Vector_t entry3D = (*it).getCoordTransformationTo().getOrigin();
CoordinateSystemTrafo toBegin = element->getEdgeToBegin() * (*it).getCoordTransformationTo();
CoordinateSystemTrafo toEnd = element->getEdgeToEnd() * (*it).getCoordTransformationTo();
Vector_t entry3D = toBegin.getOrigin();
Vector_t exit3D = toEnd.getOrigin();
mesh.add(*(element.get()));
......@@ -518,6 +519,8 @@ void OpalBeamline::save3DLattice() {
Bend * bendElement = static_cast<Bend*>(element.get());
std::vector<Vector_t> designPath = bendElement->getDesignPath();
CoordinateSystemTrafo toEnd = bendElement->getBeginToEnd_local() * (*it).getCoordTransformationTo();
Vector_t exit3D = toEnd.getOrigin();
unsigned int size = designPath.size();
unsigned int minNumSteps = std::max(20.0,
......
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