1#include "gtest/gtest.h"
14 constexpr double tol = 1
e-12;
16 using Vector3 = ippl::Vector<double, 3>;
19 return Quaternion(std::cos(0.5 * angle), 0.0, 0.0, std::sin(0.5 * angle));
22 void expectVectorNear(
const Vector3& actual,
const Vector3& expected) {
23 EXPECT_NEAR(actual(0), expected(0), tol);
24 EXPECT_NEAR(actual(1), expected(1), tol);
25 EXPECT_NEAR(actual(2), expected(2), tol);
33 char** argv =
nullptr;
35 ippl::initialize(argc, argv);
47 Vector3 point(2.0, 0.0, -1.0);
53 expectVectorNear(actual, expected);
65 PlacedElement placed(
nullptr, nominal, correction, geometry, support);
66 Vector3 point(0.5, -0.5, 2.0);
115 EXPECT_EQ(entry.
getName(),
"entry");
116 EXPECT_EQ(body.
getName(),
"body");
117 EXPECT_EQ(exit.
getName(),
"exit");
TEST_F(PlacedElementTest, ActualBodyTransformAppliesCorrectionAfterNominalPlacement)
Rigid spatial transform between a parent frame and a local frame.
ippl::Vector< double, 3 > getOrigin() const
ippl::Vector< double, 3 > transformTo(const ippl::Vector< double, 3 > &r) const
Map a point from the parent frame to the local frame.
virtual void setElementLength(double length)
Set design length.
void setMisalignment(const CoordinateSystemTrafo &cst)
virtual Port getEntryPort() const
Return the entrance port of the canonical local chart.
void setCSTrafoGlobal2Local(const CoordinateSystemTrafo &ori)
virtual Port getBodyPort() const
Return the body port of the canonical local chart.
virtual Port getExitPort() const
Return the exit port of the canonical local chart.
PlacedElement getPlacedElement() const
Return a placed-element view assembled from the current bridge objects.
Named body-relative ports used for placement and chaining.
const Port & getExit() const
const Port & getEntry() const
const Port & getBody() const
Local nominal-to-actual correction transform.
const CoordinateSystemTrafo & getNominalToActual() const
static void SetUpTestSuite()
static void TearDownTestSuite()
Geometric placement record for an element instance.
const ElementGeometry & getGeometry() const
CoordinateSystemTrafo getNominalEntryTransform() const
CoordinateSystemTrafo getNominalExitTransform() const
CoordinateSystemTrafo getBodyTransform() const
CoordinateSystemTrafo getEntryTransform() const
CoordinateSystemTrafo getExitTransform() const
CoordinateSystemTrafo getActualBodyTransform() const
CoordinateSystemTrafo getSupportTransform() const
CoordinateSystemTrafo getNominalBodyTransform() const
Nominal rigid placement transform.
const CoordinateSystemTrafo & getParentToNominal() const
Named local frame attached to an element body.
const CoordinateSystemTrafo & getBodyToPort() const
const std::string & getName() const
Quaternion storage and rotation algebra used by OPALX geometry code.
Optional offset from the canonical body frame to the support frame.
const CoordinateSystemTrafo & getBodyToSupport() const
constexpr double e
The value of.