diff --git a/Documentation/Doxygen/Doxyfile.in b/Documentation/Doxygen/Doxyfile.in index e94e892677be0d29ed58c405848006624fb29f07..42bcd4f961972d8dcba4dd253261608e2da90bfc 100644 --- a/Documentation/Doxygen/Doxyfile.in +++ b/Documentation/Doxygen/Doxyfile.in @@ -23,5 +23,6 @@ INCLUDE_GRAPH = YES GRAPHICAL_HIERARCHY = YES DIRECTORY_GRAPH = YES GENERATE_LEGEND = YES +USE_MATHJAX = YES SEARCHENGINE = YES diff --git a/Framework/Geometry/BaseVector.h b/Framework/Geometry/BaseVector.h index 0867bb2a63de58d2a3e217f4ed839f26303a1e9b..02edb6fa8199e0d70a0eea1b326ca6f07b8bd5b3 100644 --- a/Framework/Geometry/BaseVector.h +++ b/Framework/Geometry/BaseVector.h @@ -4,6 +4,10 @@ #include <Geometry/QuantityVector.h> #include <Geometry/CoordinateSystem.h> +/*! + * Common base class for Vector and Point. Currently it does basically nothing. + */ + template <typename dim> class BaseVector { diff --git a/Framework/Geometry/Point.h b/Framework/Geometry/Point.h index b6a6fff21eac45c962cbf044266ce6c0f8fe28bb..c55cfd1541229b316c968bbecb64b0cc2f13ce30 100644 --- a/Framework/Geometry/Point.h +++ b/Framework/Geometry/Point.h @@ -6,10 +6,12 @@ #include <Geometry/Vector.h> #include <Units/PhysicalUnits.h> +/*! + * A Point represents a point in position space. It is defined by its + * coordinates with respect to some CoordinateSystem. + */ class Point : public BaseVector<phys::units::length_d> { - using Length = phys::units::quantity<phys::units::length_d, double>; - public: Point(CoordinateSystem const& pCS, QuantityVector<phys::units::length_d> pQVector) : BaseVector<phys::units::length_d>(pCS, pQVector) @@ -38,6 +40,10 @@ public: } } + /*! + * transforms the Point into another CoordinateSystem by changing its + * coordinates interally + */ void rebase(CoordinateSystem const& pCS) { BaseVector<phys::units::length_d>::qVector = getCoordinates(pCS); @@ -49,6 +55,9 @@ public: return Point(*BaseVector<phys::units::length_d>::cs, getCoordinates() + pVec.getComponents(*BaseVector<phys::units::length_d>::cs)); } + /*! + * returns the distance Vector between two points + */ Vector<phys::units::length_d> operator-(Point const& pB) const { auto& cs = *BaseVector<phys::units::length_d>::cs; diff --git a/Framework/Geometry/QuantityVector.h b/Framework/Geometry/QuantityVector.h index 26e6c2a4104dfe60cca55b48edfd9792b30c9810..4f9209f8e2ee76bb6549f892712e7cf2cea563fc 100644 --- a/Framework/Geometry/QuantityVector.h +++ b/Framework/Geometry/QuantityVector.h @@ -7,17 +7,22 @@ #include <iostream> #include <utility> +/*! + * A QuantityVector is a three-component container based on Eigen::Vector3d + * with a phys::units::dimension. Arithmethic operators are defined that + * propagate the dimensions by dimensional analysis. + */ + template <typename dim> class QuantityVector { protected: - using Quantity = phys::units::quantity<dim, double>; - //using QuantitySquared = decltype(std::declval<Quantity>() * std::declval<Quantity>()); + using Quantity = phys::units::quantity<dim, double>; //< the phys::units::quantity corresponding to the dimension public: - Eigen::Vector3d eVector; + Eigen::Vector3d eVector; //!< the actual container where the raw numbers are stored - typedef dim dimension; + typedef dim dimension; //!< should be a phys::units::dimension QuantityVector(Quantity a, Quantity b, Quantity c) : eVector{a.magnitude(), b.magnitude(), c.magnitude()} diff --git a/Framework/Geometry/Vector.h b/Framework/Geometry/Vector.h index 2fe62e04b73f000b05468dda63776ca4fcd450be..4c531a52afc322b0c2f1e7aee713610ef8807475 100644 --- a/Framework/Geometry/Vector.h +++ b/Framework/Geometry/Vector.h @@ -5,6 +5,16 @@ #include <Geometry/QuantityVector.h> #include <Units/PhysicalUnits.h> +/*! + * 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. + */ + template <typename dim> class Vector : public BaseVector<dim> { @@ -21,11 +31,19 @@ public: { } + /*! + * returns a QuantityVector with the components given in the "home" + * CoordinateSystem of the Vector + */ auto getComponents() const { return BaseVector<dim>::qVector; } + /*! + * returns a QuantityVector with the components given in an arbitrary + * CoordinateSystem + */ auto getComponents(CoordinateSystem const& pCS) const { if (&pCS == BaseVector<dim>::cs) @@ -38,22 +56,41 @@ public: } } + /*! + * transforms the Vector into another CoordinateSystem by changing + * its components internally + */ void rebase(CoordinateSystem const& pCS) { BaseVector<dim>::qVector = getComponents(pCS); BaseVector<dim>::cs = &pCS; } + /*! + * returns the norm/length of the Vector. Before using this method, + * think about whether squaredNorm() might be cheaper for your computation. + */ auto norm() const { return BaseVector<dim>::qVector.norm(); } + /*! + * returns the squared norm of the Vector. Before using this method, + * think about whether norm() might be cheaper for your computation. + */ auto squaredNorm() const { return BaseVector<dim>::qVector.squaredNorm(); } - + + /*! + * returns a Vector \f$ \vec{v}_{\parallel} \f$ which is the parallel projection + * of this vector \f$ \vec{v}_1 \f$ along another Vector \f$ \vec{v}_2 \f$ given by + * \f[ + * \vec{v}_{\parallel} = \frac{\vec{v}_1 \cdot \vec{v}_2}{\vec{v}_2^2} \vec{v}_2 + * \f] + */ template <typename dim2> auto parallelProjectionOnto(Vector<dim2> const& pVec, CoordinateSystem const& pCS) const {