Garfield 0.3
Toolkit for the detailed simulation of particle detectors based on ionization measurement in gases and semiconductors
Loading...
Searching...
No Matches
Garfield::Vector< type, Dimension > Class Template Reference

#include <Vector.hh>

Inheritance diagram for Garfield::Vector< type, Dimension >:
Garfield::Vec3Impl< double > Garfield::Vec3Impl< float >

Public Member Functions

template<typename... Args>
__host__ __device__ Vector (Args &&... args)
__host__ __device__ Vector ()
__host__ __device__ Vector operator* (const double &i)
__host__ __device__ Vector operator/ (const double &i)
template<typename T, std::size_t D>
__host__ __device__ Vector operator+ (const Vector< T, D > &vec)
template<typename T, std::size_t D>
__host__ __device__ Vector operator- (const Vector< T, D > &vec)

Detailed Description

template<typename type, std::size_t Dimension>
class Garfield::Vector< type, Dimension >

Definition at line 22 of file Vector.hh.

Constructor & Destructor Documentation

◆ Vector() [1/2]

template<typename type, std::size_t Dimension>
template<typename... Args>
__host__ __device__ Garfield::Vector< type, Dimension >::Vector ( Args &&... args)
inline

Definition at line 25 of file Vector.hh.

std::array< T, D > GarfieldArray
Definition Vector.hh:16

◆ Vector() [2/2]

template<typename type, std::size_t Dimension>
__host__ __device__ Garfield::Vector< type, Dimension >::Vector ( )
inline

Definition at line 27 of file Vector.hh.

27{ this->fill(0.); }

Member Function Documentation

◆ operator*()

template<typename type, std::size_t Dimension>
__host__ __device__ Vector Garfield::Vector< type, Dimension >::operator* ( const double & i)
inline

Definition at line 28 of file Vector.hh.

28 {
29 Vector ret = *this;
30 for (std::size_t j = 0; j != ret.size(); ++j) {
31 ret[j] *= i;
32 }
33 return ret;
34 }
__host__ __device__ Vector(Args &&... args)
Definition Vector.hh:25

◆ operator+()

template<typename type, std::size_t Dimension>
template<typename T, std::size_t D>
__host__ __device__ Vector Garfield::Vector< type, Dimension >::operator+ ( const Vector< T, D > & vec)
inline

Definition at line 43 of file Vector.hh.

43 {
44 static_assert(Dimension == D, "The vectors don't have the same dimension!");
45 Vector ret = *this;
46 for (std::size_t j = 0; j != ret.size(); ++j) {
47 ret[j] += vec[j];
48 }
49 return ret;
50 }

◆ operator-()

template<typename type, std::size_t Dimension>
template<typename T, std::size_t D>
__host__ __device__ Vector Garfield::Vector< type, Dimension >::operator- ( const Vector< T, D > & vec)
inline

Definition at line 52 of file Vector.hh.

52 {
53 static_assert(Dimension == D, "The vectors don't have the same dimension!");
54 Vector ret = *this;
55 for (std::size_t j = 0; j != ret.size(); ++j) {
56 ret[j] -= vec[j];
57 }
58 return ret;
59 }

◆ operator/()

template<typename type, std::size_t Dimension>
__host__ __device__ Vector Garfield::Vector< type, Dimension >::operator/ ( const double & i)
inline

Definition at line 35 of file Vector.hh.

35 {
36 Vector ret = *this;
37 for (std::size_t j = 0; j != ret.size(); ++j) {
38 ret[j] /= i;
39 }
40 return ret;
41 }

The documentation for this class was generated from the following file:
  • /builds/garfield/docs/source/Include/Garfield/Vector.hh