CORSIKA  @c8_version@
The framework to simulate particle cascades for astroparticle physics
corsika::Vector< TDimension > Class Template Reference

#include <Vector.hpp>

Inheritance diagram for corsika::Vector< TDimension >:

Public Types

using quantity_type = phys::units::quantity< TDimension, double >
 
using quantity_square_type = decltype(std::declval< quantity_type >() *std::declval< quantity_type >())
 

Public Member Functions

 Vector (CoordinateSystemPtr const &pCS, QuantityVector< TDimension > const &pQVector)
 
 Vector (CoordinateSystemPtr const &cs, quantity_type const x=quantity_type::zero(), quantity_type const y=quantity_type::zero(), quantity_type const z=quantity_type::zero())
 
QuantityVector< TDimension > const & getComponents () const
 
QuantityVector< TDimension > & getComponents ()
 
QuantityVector< TDimension > getComponents (CoordinateSystemPtr const &pCS) const
 
QuantityVector< TDimension > & getComponents (CoordinateSystemPtr const &pCS)
 this always returns a QuantityVector as triple More...
 
void rebase (CoordinateSystemPtr const &pCS)
 
quantity_type getNorm () const
 
quantity_square_type getSquaredNorm () const
 
template<typename TDimension2 >
auto getParallelProjectionOnto (Vector< TDimension2 > const &pVec, CoordinateSystemPtr const &pCS) const
 
template<typename TDimension2 >
auto getParallelProjectionOnto (Vector< TDimension2 > const &pVec) const
 
Vector operator+ (Vector< TDimension > const &pVec) const
 
Vector operator- (Vector< TDimension > const &pVec) const
 
auto & operator*= (double const p)
 
template<typename TScalarDim >
auto operator* (phys::units::quantity< TScalarDim, double > const p) const
 
template<typename TScalarDim >
auto operator/ (phys::units::quantity< TScalarDim, double > const p) const
 
auto operator* (double const p) const
 
auto operator/ (double const p) const
 
auto & operator+= (Vector< TDimension > const &pVec)
 
auto & operator-= (Vector< TDimension > const &pVec)
 
auto operator- () const
 
auto normalized () const
 
template<typename TDimension2 >
auto cross (Vector< TDimension2 > const &pV) const
 
template<typename TDimension2 >
auto dot (Vector< TDimension2 > const &pV) const
 
Access coordinate components

Note, if you access components in a different CoordinateSystem pCS than the stored data, internally a temporary object will be created and destroyed each call.

This can be avoided by using rebase first.

quantity_type getX (CoordinateSystemPtr const &pCS) const
 
quantity_type getY (CoordinateSystemPtr const &pCS) const
 
quantity_type getZ (CoordinateSystemPtr const &pCS) const
 
- Public Member Functions inherited from corsika::BaseVector< TDimension >
 BaseVector (CoordinateSystemPtr const &pCS, QuantityVector< TDimension > const &pQVector)
 
 BaseVector (BaseVector const &)=default
 
 BaseVector (BaseVector &&a)=default
 
BaseVectoroperator= (BaseVector const &)=default
 
CoordinateSystemPtr getCoordinateSystem () const
 
void setCoordinateSystem (CoordinateSystemPtr const &cs)
 

Additional Inherited Members

- Protected Member Functions inherited from corsika::BaseVector< TDimension >
QuantityVector< TDimension > const & getQuantityVector () const
 
QuantityVector< TDimension > & getQuantityVector ()
 
void setQuantityVector (QuantityVector< TDimension > const &v)
 

Detailed Description

template<typename TDimension>
class corsika::Vector< TDimension >

A Vector represents a 3-vector in Euclidean space.

It is defined by components given in a specific CoordinateSystem. It has a physical dimension ("unit") as part of its type, so you cannot mix up e.g. electric with magnetic fields (but you could calculate their cross-product to get an energy flux vector).

When transforming coordinate systems, a Vector is subject to the rotational part only and invariant under translations.

Definition at line 29 of file CoordinateSystem.hpp.

Member Function Documentation

◆ getComponents() [1/3]

template<typename TDimension>
QuantityVector<TDimension> const& corsika::Vector< TDimension >::getComponents ( ) const
Returns
a QuantityVector with the components given in the "home" CoordinateSystem of the Vector
Todo:
this should best be protected, we don't want users to use bare coordinates without reference frame

◆ getComponents() [2/3]

template<typename TDimension>
QuantityVector<TDimension> corsika::Vector< TDimension >::getComponents ( CoordinateSystemPtr const &  pCS) const

returns a QuantityVector with the components given in an arbitrary CoordinateSystem

◆ getComponents() [3/3]

template<typename TDimension>
QuantityVector<TDimension>& corsika::Vector< TDimension >::getComponents ( CoordinateSystemPtr const &  pCS)

this always returns a QuantityVector as triple

Returns
A reference type QuantityVector&, but be aware, the underlying class data is actually transformed to pCS, if needed. Thus, there may be an implicit call to rebase.

◆ getNorm()

template<typename TDimension>
quantity_type corsika::Vector< TDimension >::getNorm ( ) const

returns the norm/length of the Vector. Before using this method, think about whether squaredNorm() might be cheaper for your computation.

◆ getParallelProjectionOnto()

template<typename TDimension>
template<typename TDimension2 >
auto corsika::Vector< TDimension >::getParallelProjectionOnto ( Vector< TDimension2 > const &  pVec,
CoordinateSystemPtr const &  pCS 
) const

returns a Vector \( \vec{v}_{\parallel} \) which is the parallel projection of this vector \( \vec{v}_1 \) along another Vector \( \vec{v}_2 \) given by

\[ \vec{v}_{\parallel} = \frac{\vec{v}_1 \cdot \vec{v}_2}{\vec{v}_2^2} \vec{v}_2 \]

◆ getSquaredNorm()

template<typename TDimension>
quantity_square_type corsika::Vector< TDimension >::getSquaredNorm ( ) const

returns the squared norm of the Vector. Before using this method, think about whether norm() might be cheaper for your computation.

◆ rebase()

template<typename TDimension>
void corsika::Vector< TDimension >::rebase ( CoordinateSystemPtr const &  pCS)

transforms the Vector into another CoordinateSystem by changing its components internally


The documentation for this class was generated from the following files: