diff options
Diffstat (limited to 'src/main/CurvedElement.cc')
-rw-r--r-- | src/main/CurvedElement.cc | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/main/CurvedElement.cc b/src/main/CurvedElement.cc index f4b760a..1abfcbf 100644 --- a/src/main/CurvedElement.cc +++ b/src/main/CurvedElement.cc @@ -12,9 +12,14 @@ namespace vhc { +<<<<<<< .mine + /** Cf. CurvedElement.h */ + CurvedElement::CurvedElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next): + using namespace std; CurvedElement::CurvedElement(const Vector3D& entry, const Vector3D& exit, double sectionRadius, double curvature, Element* next): + Element(entry, exit, sectionRadius, next), curvature(curvature), curvatureCenter(Vector3D::Null) { @@ -30,4 +35,23 @@ CurvedElement::CurvedElement(const Vector3D& entry, const Vector3D& exit, double curvatureCenter = midpoint + sqrt(1.0 - (k * k) / 4 * getDiagonal().normSquare()) * (getDiagonal().unit().cross(Vector3D::k)); } + + /* TODO print also Vecotr3D magnetic field + * Schould we do as if curved element is an abstract class + * and implement this method under the class 'MagneticCurvedElement'?? + */ + /** Cf. CurvedElement.h */ + std::string CurvedElement::toString() const { + + std::stringstream s; + s << "CurvedElement:" << "\n"; + s << "\tPosition of entry: " << entryPosition << "\n"; + s << "\tPosition of exit: " << exitPosition << "\n"; + s << "\tRadius of section: " << sectionRadius << "\n"; + s << "\tRadius of curvature 1/k: " << 1/curvature << "\n"; + s << "\tCenter of curvature: " << curvatureCenter << "\n"; + s << "\t"; + return s.str(); + } + } |