Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#ifndef QUANTITYVECTOR_H_
#define QUANTITYVECTOR_H_
#include <phys/units/quantity.hpp>
#include <phys/units/io.hpp>
#include <Eigen/Dense>
#include <iostream>
template <typename dim>
class QuantityVector
{
protected:
using Quantity = phys::units::quantity<dim, double>;
public:
Eigen::Vector3d eVector;
QuantityVector(Quantity a, Quantity b, Quantity c) :
eVector{a.magnitude(), b.magnitude(), c.magnitude()}
{
}
QuantityVector(Eigen::Vector3d pBareVector) :
eVector(pBareVector)
{
}
Quantity operator[](size_t index) const
{
return Quantity(phys::units::detail::magnitude_tag, eVector[index]);
}
};
template <typename dim>
auto& operator<<(std::ostream& os, QuantityVector<dim> qv)
{
os << '(' << qv.eVector(0) << ' ' << qv.eVector(1) << ' ' << qv.eVector(2)
<< ") " << phys::units::to_unit_symbol(phys::units::quantity<dim, double>());
return os;
}
#endif