|
OPALX (Object Oriented Parallel Accelerator Library for Exascal) master (dc2a29eed580)
OPALX
|
Rigid spatial transform between a parent frame and a local frame. More...
#include <CoordinateSystemTrafo.h>

Public Member Functions | |
| CoordinateSystemTrafo () | |
| Construct the identity transform. | |
| CoordinateSystemTrafo (const CoordinateSystemTrafo &right) | |
| CoordinateSystemTrafo (const ippl::Vector< double, 3 > &origin, const Quaternion &orientation) | |
| Construct a parent-to-local transform. | |
| void | invert () |
| Invert the transform in place. | |
| CoordinateSystemTrafo | inverted () const |
| Return the inverse transform. | |
| ippl::Vector< double, 3 > | transformTo (const ippl::Vector< double, 3 > &r) const |
| Map a point from the parent frame to the local frame. | |
| ippl::Vector< double, 3 > | transformFrom (const ippl::Vector< double, 3 > &r) const |
| Map a point from the local frame back to the parent frame. | |
| ippl::Vector< double, 3 > | rotateTo (const ippl::Vector< double, 3 > &r) const |
| Rotate a vector from the parent frame into the local frame. | |
| ippl::Vector< double, 3 > | rotateFrom (const ippl::Vector< double, 3 > &r) const |
| Rotate a vector from the local frame back into the parent frame. | |
| template<typename ViewType > | |
| void | transformBunchTo (ViewType Rview, size_t nLocal) const |
| Apply transformTo() to a Kokkos view of particle positions. | |
| template<typename ViewType > | |
| void | transformBunchFrom (ViewType Rview, size_t nLocal) const |
| Apply transformFrom() to a Kokkos view of particle positions. | |
| template<typename ViewType > | |
| void | rotateBunchTo (ViewType Pview, size_t nLocal) const |
| Apply rotateTo() to a Kokkos view of vectors such as momenta. | |
| template<typename ViewType > | |
| void | rotateBunchFrom (ViewType Pview, size_t nLocal) const |
| Apply rotateFrom() to a Kokkos view of vectors such as momenta. | |
| CoordinateSystemTrafo & | operator= (const CoordinateSystemTrafo &right)=default |
| CoordinateSystemTrafo | operator* (const CoordinateSystemTrafo &right) const |
| Compose two transforms. | |
| void | operator*= (const CoordinateSystemTrafo &right) |
| ippl::Vector< double, 3 > | getOrigin () const |
| Quaternion | getRotation () const |
| matrix3x3_t | getRotationMatrix () const |
| void | print (std::ostream &) const |
Private Attributes | |
| ippl::Vector< double, 3 > | origin_m |
| Local origin expressed in the parent frame. | |
| Quaternion | orientation_m |
| Quaternion whose rotation maps parent-frame vectors into local-frame vectors. | |
| matrix3x3_t | rotationMatrix_m |
| Cached rotation matrix for the same parent-to-local mapping. | |
Rigid spatial transform between a parent frame and a local frame.
OPALX uses this class as a rigid transform with translation and rotation. The stored origin \(\mathbf{o}\) is the location of the local origin expressed in the parent frame. The stored rotation \(R\) maps parent-frame vectors into local-frame vectors.
For a point \(\mathbf{r}\) in the parent frame, the local coordinates are computed as
\[ \mathbf{r}_{\mathrm{local}} = R \left(\mathbf{r}_{\mathrm{parent}} - \mathbf{o}\right). \]
The inverse mapping is
\[ \mathbf{r}_{\mathrm{parent}} = R^T \mathbf{r}_{\mathrm{local}} + \mathbf{o}. \]
The same convention is used for pure vector rotations without translation:
\[ \mathbf{v}_{\mathrm{local}} = R \mathbf{v}_{\mathrm{parent}}, \qquad \mathbf{v}_{\mathrm{parent}} = R^T \mathbf{v}_{\mathrm{local}}. \]
Composition follows function composition of transformTo():
\[ (A * B)(\mathbf{r}) = A(B(\mathbf{r})). \]
In other words, A * B applies B first and then A.
Definition at line 40 of file CoordinateSystemTrafo.h.
| CoordinateSystemTrafo::CoordinateSystemTrafo | ( | ) |
Construct the identity transform.
Definition at line 3 of file CoordinateSystemTrafo.cpp.
References rotationMatrix_m.
| CoordinateSystemTrafo::CoordinateSystemTrafo | ( | const CoordinateSystemTrafo & | right | ) |
Definition at line 18 of file CoordinateSystemTrafo.cpp.
| CoordinateSystemTrafo::CoordinateSystemTrafo | ( | const ippl::Vector< double, 3 > & | origin, |
| const Quaternion & | orientation | ||
| ) |
Construct a parent-to-local transform.
| origin | Position of the local origin in parent coordinates. |
| orientation | Unit quaternion whose rotation matrix maps parent-frame vectors into local-frame vectors. |
Definition at line 23 of file CoordinateSystemTrafo.cpp.
|
inline |
Definition at line 169 of file CoordinateSystemTrafo.h.
References origin_m.
Referenced by ParallelTracker::markBackwardParticlesAtSourcePlane(), OpalBeamline::save3DInput(), OpalBeamline::save3DLattice(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), OpalRBend::update(), and OpalSBend::update().
|
inline |
Definition at line 171 of file CoordinateSystemTrafo.h.
References orientation_m.
Referenced by OpalBeamline::save3DInput(), TEST_F(), TEST_F(), OpalRBend::update(), and OpalSBend::update().
|
inline |
Definition at line 173 of file CoordinateSystemTrafo.h.
References rotationMatrix_m.
Referenced by ParallelTracker::markBackwardParticlesAtSourcePlane().
| void CoordinateSystemTrafo::invert | ( | ) |
Invert the transform in place.
Definition at line 29 of file CoordinateSystemTrafo.cpp.
References Quaternion::conjugate(), get_transpose(), orientation_m, origin_m, Quaternion::rotate(), and rotationMatrix_m.
Referenced by inverted(), and TEST_F().

|
inline |
Return the inverse transform.
Definition at line 175 of file CoordinateSystemTrafo.h.
References invert().
Referenced by MeshGenerator::add(), ParticleContainer< T, Dim >::applyFractionalStep(), ParallelTracker::computeExternalFields(), ParallelTracker::computeSpaceChargeFields(), ParallelTracker::emitFromEmissionSources(), ParallelTracker::execute(), TEST_F(), TEST_F(), and ParticleContainer< T, Dim >::updateRefToLabCSTrafo().

| CoordinateSystemTrafo CoordinateSystemTrafo::operator* | ( | const CoordinateSystemTrafo & | right | ) | const |
Compose two transforms.
For a point \(\mathbf{r}\) in the parent frame,
\[ (A * B).transformTo(\mathbf{r}) = A.transformTo(B.transformTo(\mathbf{r})). \]
Definition at line 35 of file CoordinateSystemTrafo.cpp.
| void CoordinateSystemTrafo::operator*= | ( | const CoordinateSystemTrafo & | right | ) |
Definition at line 42 of file CoordinateSystemTrafo.cpp.
References Quaternion::conjugate(), Quaternion::getRotationMatrix(), Quaternion::normalize(), orientation_m, origin_m, Quaternion::rotate(), and rotationMatrix_m.

|
default |
|
inline |
Definition at line 142 of file CoordinateSystemTrafo.h.
References Quaternion::conjugate(), orientation_m, origin_m, and Quaternion::rotate().
Referenced by operator<<(), and operator<<().

|
inline |
Apply rotateFrom() to a Kokkos view of vectors such as momenta.
Definition at line 212 of file CoordinateSystemTrafo.h.
References prod_vector_transpose(), and rotationMatrix_m.

|
inline |
Apply rotateTo() to a Kokkos view of vectors such as momenta.
Definition at line 204 of file CoordinateSystemTrafo.h.
References prod_vector(), and rotationMatrix_m.
Referenced by ParallelTracker::computeSpaceChargeFields(), and ParticleContainer< T, Dim >::transformBunch().

|
inline |
Rotate a vector from the local frame back into the parent frame.
Definition at line 164 of file CoordinateSystemTrafo.h.
References prod_vector_transpose(), and rotationMatrix_m.
Referenced by ParticleContainer< T, Dim >::applyFractionalStep(), Monitor::applyToReferenceParticle(), OpalBeamline::rotateFrom(), OpalBeamline::rotateFromLocalCS(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), transformFrom(), ParallelTracker::updateReferenceParticles(), and ParticleContainer< T, Dim >::updateRefToLabCSTrafo().

|
inline |
Rotate a vector from the parent frame into the local frame.
Definition at line 159 of file CoordinateSystemTrafo.h.
References prod_vector(), and rotationMatrix_m.
Referenced by MeshGenerator::add(), Monitor::driftToCorrectPositionAndSave(), ParallelTracker::execute(), OpalBeamline::rotateTo(), OpalBeamline::rotateToLocalCS(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), and ParallelTracker::updateReferenceParticles().

|
inline |
Apply transformFrom() to a Kokkos view of particle positions.
Definition at line 194 of file CoordinateSystemTrafo.h.
References origin_m, prod_vector_transpose(), and rotationMatrix_m.

|
inline |
Apply transformTo() to a Kokkos view of particle positions.
The operation is pointwise and uses the same rigid-transform convention as transformTo().
Definition at line 183 of file CoordinateSystemTrafo.h.
References origin_m, prod_vector(), and rotationMatrix_m.
Referenced by ParallelTracker::computeSpaceChargeFields(), and ParticleContainer< T, Dim >::transformBunch().

|
inline |
Map a point from the local frame back to the parent frame.
Definition at line 154 of file CoordinateSystemTrafo.h.
References origin_m, and rotateFrom().
Referenced by ParticleContainer< T, Dim >::applyFractionalStep(), Monitor::applyToReferenceParticle(), ElementBase::getBoundingBoxInLabCoords(), OpalBeamline::save3DLattice(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), OpalBeamline::transformFrom(), OpalBeamline::transformFromLocalCS(), and ParticleContainer< T, Dim >::updateRefToLabCSTrafo().

|
inline |
Map a point from the parent frame to the local frame.
Definition at line 148 of file CoordinateSystemTrafo.h.
References origin_m, prod_vector(), and rotationMatrix_m.
Referenced by MeshGenerator::add(), Monitor::driftToCorrectPositionAndSave(), ParallelTracker::execute(), OpalBeamline::getElements(), ElementBase::isInsideTransverse(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), TEST_F(), OpalBeamline::transformTo(), OpalBeamline::transformToLocalCS(), and ParallelTracker::updateReferenceParticles().

|
private |
Quaternion whose rotation maps parent-frame vectors into local-frame vectors.
Definition at line 125 of file CoordinateSystemTrafo.h.
Referenced by getRotation(), invert(), operator*=(), and print().
|
private |
Local origin expressed in the parent frame.
Definition at line 122 of file CoordinateSystemTrafo.h.
Referenced by getOrigin(), invert(), operator*=(), print(), transformBunchFrom(), transformBunchTo(), transformFrom(), and transformTo().
|
private |
Cached rotation matrix for the same parent-to-local mapping.
Definition at line 128 of file CoordinateSystemTrafo.h.
Referenced by CoordinateSystemTrafo(), getRotationMatrix(), invert(), operator*=(), rotateBunchFrom(), rotateBunchTo(), rotateFrom(), rotateTo(), transformBunchFrom(), transformBunchTo(), and transformTo().