BDSIM
BDSIM is a Geant4 extension toolkit for simulation of particle transport in accelerator beamlines.
|
Simple three vector that's templated so the right type can be used. More...
#include <BDSThreeVector.hh>
Public Member Functions | |
BDSThreeVector () | |
Default constructor. | |
BDSThreeVector (T xIn, T yIn, T zIn) | |
Alternate constructor. | |
BDSThreeVector (const BDSThreeVector &other) | |
Copy constructor. | |
BDSThreeVector & | operator= (const BDSThreeVector &rhs) |
Assignment operator. | |
T & | operator[] (const G4int index) |
Access / set a single element. | |
const T & | operator[] (const G4int index) const |
Access a single element. | |
T | dot (const BDSThreeVector &b) const |
T | mag () const |
Get the magnitude of it. | |
BDSThreeVector & | operator*= (G4double a) |
const T & | x () const |
Accessor by name. | |
const T & | y () const |
Accessor by name. | |
const T & | z () const |
Accessor by name. | |
Private Attributes | |
T | values [3] |
Member data - x,y,z. | |
Friends | |
std::ostream & | operator<< (std::ostream &out, BDSThreeVector const &v) |
Output stream. | |
BDSThreeVector | operator* (const BDSThreeVector &a, const double &b) |
Multiplication. | |
BDSThreeVector | operator* (const double &b, const BDSThreeVector &a) |
Multiplication. | |
T | operator* (const BDSThreeVector &a, const BDSThreeVector &b) |
Multiplication. | |
BDSThreeVector | operator+ (const BDSThreeVector &a, const G4double &b) |
Addition, subtraction. | |
BDSThreeVector | operator+ (const BDSThreeVector &a, const BDSThreeVector &b) |
Addition, subtraction. | |
BDSThreeVector | operator- (const BDSThreeVector &a, const G4double &b) |
Addition, subtraction. | |
BDSThreeVector | operator- (const BDSThreeVector &a, const BDSThreeVector &b) |
Addition, subtraction. | |
Simple three vector that's templated so the right type can be used.
The G4ThreeVector(HEP::ThreeVector) is much better, but this only uses a double. Here, a simple three vector that's templated allows the possibility of using float or double precision, which could make a significant difference to the memory usage - very important for large arrays of this class.
Should more complex features be required - it's best to use an actual G4ThreeVector - constructed from this - and then translated back.
Definition at line 44 of file BDSThreeVector.hh.
|
inline |
Default constructor.
Definition at line 48 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Alternate constructor.
Definition at line 52 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Copy constructor.
Definition at line 56 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Definition at line 99 of file BDSThreeVector.hh.
|
inline |
Get the magnitude of it.
Definition at line 103 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
Referenced by BDS::mag().
|
inline |
Definition at line 125 of file BDSThreeVector.hh.
|
inline |
Assignment operator.
Definition at line 63 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Access / set a single element.
Definition at line 74 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Access a single element.
Definition at line 82 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
|
inline |
Accessor by name.
Definition at line 90 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
Referenced by BDSArrayOperatorValueReflect::Apply(), BDSArrayOperatorValueFlip::Apply(), BDSArray2DCoordsRDipole::GetConst(), BDSArray2DCoordsRQuad::GetConst(), BDSInterpolator1D::GetInterpolatedValue(), BDSInterpolator2D::GetInterpolatedValue(), BDSInterpolator3D::GetInterpolatedValue(), and BDSInterpolator4D::GetInterpolatedValue().
|
inline |
Accessor by name.
Definition at line 91 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
Referenced by BDSArrayOperatorValueReflect::Apply(), BDSArrayOperatorValueFlip::Apply(), BDSArray2DCoordsRDipole::GetConst(), BDSArray2DCoordsRQuad::GetConst(), BDSInterpolator1D::GetInterpolatedValue(), BDSInterpolator2D::GetInterpolatedValue(), BDSInterpolator3D::GetInterpolatedValue(), and BDSInterpolator4D::GetInterpolatedValue().
|
inline |
Accessor by name.
Definition at line 92 of file BDSThreeVector.hh.
References BDSThreeVector< T >::values.
Referenced by BDSArrayOperatorValueReflect::Apply(), BDSArrayOperatorValueFlip::Apply(), BDSArray2DCoordsRQuad::GetConst(), BDSInterpolator1D::GetInterpolatedValue(), BDSInterpolator2D::GetInterpolatedValue(), BDSInterpolator3D::GetInterpolatedValue(), and BDSInterpolator4D::GetInterpolatedValue().
|
friend |
Multiplication.
Definition at line 110 of file BDSThreeVector.hh.
|
friend |
Multiplication.
Definition at line 106 of file BDSThreeVector.hh.
|
friend |
Multiplication.
Definition at line 108 of file BDSThreeVector.hh.
|
friend |
Addition, subtraction.
Definition at line 117 of file BDSThreeVector.hh.
|
friend |
Addition, subtraction.
Definition at line 115 of file BDSThreeVector.hh.
|
friend |
Addition, subtraction.
Definition at line 121 of file BDSThreeVector.hh.
|
friend |
Addition, subtraction.
Definition at line 119 of file BDSThreeVector.hh.
|
friend |
Output stream.
Definition at line 96 of file BDSThreeVector.hh.
|
private |
Member data - x,y,z.
Definition at line 135 of file BDSThreeVector.hh.
Referenced by BDSThreeVector< T >::BDSThreeVector(), BDSThreeVector< T >::mag(), BDSThreeVector< T >::operator=(), BDSThreeVector< T >::operator[](), BDSThreeVector< T >::x(), BDSThreeVector< T >::y(), and BDSThreeVector< T >::z().