CORSIKA
@c8_version@
The framework to simulate particle cascades for astroparticle physics
QuantityVector.hpp
1
/*
2
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
3
*
4
* This software is distributed under the terms of the GNU General Public
5
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
6
* the license.
7
*/
8
9
#pragma once
10
11
#include <Eigen/Dense>
12
13
#include <
corsika/framework/core/PhysicalUnits.hpp
>
14
#include <ostream>
15
#include <utility>
16
17
namespace
corsika
{
18
19
class
CoordinateSystem;
// fwd decl
20
class
Point
;
// fwd decl
21
template
<
typename
T>
22
class
Vector;
// fwd decl
23
34
template
<
typename
TDimension>
35
class
QuantityVector
{
36
public
:
37
using
quantity_type
=
38
phys::units::quantity<TDimension, double>
;
//< the phys::units::quantity
39
// corresponding to the dimension
40
using
quantity_square_type =
41
decltype(std::declval<quantity_type>() * std::declval<quantity_type>());
42
43
QuantityVector
(Eigen::Vector3d
const
& pBareVector)
44
:
eigenVector_
(pBareVector) {}
45
46
public
:
47
typedef
TDimension
dimension_type
;
48
49
QuantityVector
(
quantity_type
const
a,
quantity_type
const
b,
quantity_type
const
c)
50
:
eigenVector_
{a.
magnitude
(), b.
magnitude
(), c.
magnitude
()} {}
51
52
QuantityVector
(
double
const
a,
double
const
b,
double
const
c)
53
:
eigenVector_
{a, b, c} {
54
static_assert(
55
std::is_same_v<TDimension, phys::units::dimensionless_d>,
56
"initialization of dimensionful QuantityVector with pure numbers not allowed!"
);
57
}
58
59
quantity_type
operator[](
size_t
const
index)
const
;
60
quantity_type
getX()
const
;
61
quantity_type
getY()
const
;
62
quantity_type
getZ()
const
;
63
Eigen::Vector3d
const
& getEigenVector()
const
{
return
eigenVector_
; }
64
Eigen::Vector3d& getEigenVector() {
return
eigenVector_
; }
65
66
quantity_type
getNorm()
const
;
67
68
quantity_square_type getSquaredNorm()
const
;
69
70
QuantityVector
operator+(
QuantityVector<TDimension>
const
& pQVec)
const
;
71
72
QuantityVector
operator-(
QuantityVector<TDimension>
const
& pQVec)
const
;
73
74
template
<
typename
TScalarDim>
75
auto
operator*(
phys::units::quantity<TScalarDim, double>
const
p)
const
;
76
77
template
<
typename
TScalarDim>
78
auto
operator/(
phys::units::quantity<TScalarDim, double>
const
p)
const
;
79
80
auto
operator*(
double
const
p)
const
;
81
82
auto
operator/(
double
const
p)
const
;
83
84
auto
& operator/=(
double
const
p);
85
86
auto
& operator*=(
double
const
p);
87
88
auto
& operator+=(
QuantityVector<TDimension>
const
& pQVec);
89
90
auto
& operator-=(
QuantityVector<TDimension>
const
& pQVec);
91
92
auto
operator-()
const
;
93
94
auto
normalized()
const
;
95
96
auto
operator==(
QuantityVector<TDimension>
const
& p)
const
;
97
98
// friends:
99
friend
class
CoordinateSystem
;
100
friend
class
Point
;
101
template
<
typename
T>
102
friend
class
corsika::Vector
;
103
template
<
typename
TDim>
104
friend
std::ostream& operator<<(std::ostream& os, QuantityVector<TDim>
const
& qv);
105
106
protected
:
107
Eigen::Vector3d
108
eigenVector_
;
109
};
110
115
template
<
typename
TDimension>
116
std::ostream&
operator<<
(std::ostream& os,
117
corsika::QuantityVector<TDimension>
const
& qv);
118
119
}
// namespace corsika
120
121
#include <corsika/detail/framework/geometry/QuantityVector.inl>
corsika::Point
Definition:
Point.hpp:22
PhysicalUnits.hpp
Import and extend the phys::units package.
corsika::QuantityVector::dimension_type
TDimension dimension_type
should be a phys::units::dimension
Definition:
QuantityVector.hpp:47
Point
returns a pointer to the sub-VolumeTreeNode which is "responsible" for the given , or nullptr iff p is not contained in this volume.
corsika::operator<<
std::ostream & operator<<(std::ostream &, corsika::Code)
Code output operator.
corsika::QuantityVector
Definition:
QuantityVector.hpp:35
phys::units::quantity
class "quantity" is the heart of the library.
Definition:
quantity.hpp:54
phys::units::quantity::magnitude
constexpr value_type magnitude() const
the quantity's magnitude.
Definition:
quantity.hpp:346
corsika
`, since they are used everywhere as integral part of the framework.
Definition:
BoundaryCrossingProcess.hpp:14
corsika::Vector
Definition:
CoordinateSystem.hpp:29
corsika::CoordinateSystem
A class to store the reference coordinate system for a geometric object.
Definition:
CoordinateSystem.hpp:94
corsika::QuantityVector::eigenVector_
Eigen::Vector3d eigenVector_
the actual container where the raw numbers are stored
Definition:
QuantityVector.hpp:108
corsika
framework
geometry
QuantityVector.hpp
Generated by
1.8.13