15#include "wuzp/trafo/internal/apply_units.hpp"
16#include "wuzp/trafo/internal/pull_back.hpp"
17#include "wuzp/trafo/internal/push_forward.hpp"
18#include "wuzp/trafo/internal/with_quantities.hpp"
24 int DimensionV_,
typename... UnitsT_>
33template <
template <
typename,
int,
int>
typename ValuesT_,
typename FromT_,
typename ToT_,
typename QuantitiesT_>
34struct PassiveLinearTransformationOf {
35 template <
typename... UnitsT_>
37 PassiveLinearTransformation<ValuesT_, typename QuantitiesT_::ValueT, FromT_, ToT_, Rows<QuantitiesT_>::value, UnitsT_...>;
38 using type =
typename ApplyUnits<typename QuantitiesT_::UnitsT, WithUnits>::type;
41template <
template <
typename,
int,
int>
typename ValuesT_,
typename FromT_,
typename ToT_,
typename QuantitiesT_>
42auto makePassiveLinearTransformation(QuantitiesT_ quantities) {
43 return typename PassiveLinearTransformationOf<ValuesT_, FromT_, ToT_, QuantitiesT_>::type{std::move(quantities)};
63 int DimensionV_,
typename... UnitsT_>
66 :
public PassiveTransformation<PassiveLinearTransformation<ValuesT_, ValueT_, FromT_, ToT_, DimensionV_, UnitsT_...>, FromT_, ToT_> {
69 using ValuesT = ValuesT_<ValueT_, DimensionV_, DimensionV_>;
74 template <
typename... Args>
89 auto inverse()
const {
return internal::makePassiveLinearTransformation<ValuesT_, ToT_, FromT_>(quantities_.inverse()); }
93 template <
template <
typename,
int,
int>
typename ValuesOtherT_,
typename ValueOtherT_,
typename FromOtherT_,
typename ToOtherT_,
94 int DimensionOtherV_,
typename... UnitsOtherT_>
99 return quantities_.isApprox(other.
getQuantities(), precision);
110template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
111 typename... UnitsT_,
typename NewFromT_,
typename NewToT_>
112struct WithFrames<PassiveLinearTransformation<ValuesT_, ValueT_, FromT_, ToT_, DimensionV_, UnitsT_...>, NewFromT_, NewToT_> {
113 using type = PassiveLinearTransformation<ValuesT_, ValueT_, NewFromT_, NewToT_, DimensionV_, UnitsT_...>;
116template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
118struct IsChangeOfBasis<PassiveLinearTransformation<ValuesT_, ValueT_, FromT_, ToT_, DimensionV_, UnitsT_...>> : std::true_type {};
131template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
132 typename... UnitsT_,
typename QuantitiesOtherT_,
typename CoordinateSystemOtherT_>
135 template <
typename TransformationT_>
136 static auto transform(
const TransformationT_& transformation,
139 return internal::pullBack<ToT_, FromT_>(transformation.inverse().getQuantities(),
object);
143template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
144 typename... UnitsT_,
typename QuantitiesOtherT_,
typename CoordinateSystemOtherT_>
147 template <
typename TransformationT_>
148 static auto transform(
const TransformationT_& transformation,
151 return internal::pullBack<ToT_, FromT_>(transformation.inverse().getQuantities(),
object);
155template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
156 typename... UnitsT_,
typename QuantitiesOtherT_,
typename CoordinateSystemOtherT_,
typename AbsoluteOtherT_>
158 Tensor<
Indices<
Up>, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_>> {
159 template <
typename TransformationT_>
160 static auto transform(
const TransformationT_& transformation,
161 const Tensor<
Indices<Up>, QuantitiesOtherT_, CoordinateSystemOtherT_, AbsoluteOtherT_>&
object) {
163 return internal::pushForward<FromT_, ToT_>(transformation.getQuantities(),
object);
167template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
168 typename... UnitsT_,
typename QuantitiesOtherT_,
typename CoordinateSystemOtherT_>
171 template <
typename TransformationT_>
172 static auto transform(
const TransformationT_& transformation,
175 return internal::withQuantities<FromT_, ToT_>(
177 innerProduct(transformation.getQuantities(),
innerProduct(
object.getQuantities(), transformation.inverse().getQuantities())));
181template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
182 typename... UnitsT_,
typename QuantitiesOtherT_,
typename CoordinateSystemOtherT_>
185 template <
typename TransformationT_>
186 static auto transform(
const TransformationT_& transformation,
189 return internal::pushForward<FromT_, ToT_>(transformation.getQuantities(),
object);
194template <
template <
typename,
int,
int>
typename ValuesLhsT_,
typename ValueLhsT_,
typename FromLhsT_,
typename ToLhsT_,
int DimensionLhsV_,
195 typename... UnitsLhsT_,
template <
typename,
int,
int>
typename ValuesRhsT_,
typename ValueRhsT_,
typename FromRhsT_,
196 typename ToRhsT_,
int DimensionRhsV_,
typename... UnitsRhsT_>
199 template <
typename LhsT_,
typename RhsT_>
200 static auto compose(
const LhsT_& lhs,
const RhsT_& rhs) {
201 return internal::makePassiveLinearTransformation<ValuesLhsT_, FromRhsT_, ToLhsT_>(
202 innerProduct(lhs.getQuantities(), rhs.getQuantities()));
206template <
template <
typename,
int,
int>
typename ValuesLhsT_,
typename ValueLhsT_,
typename FromLhsT_,
typename ToLhsT_,
int DimensionLhsV_,
207 typename... UnitsLhsT_,
template <
typename,
int,
int>
typename ValuesRhsT_,
typename ValueRhsT_,
typename FromRhsT_,
208 typename ToRhsT_,
int DimensionRhsV_,
typename... UnitsRhsT_>
211 static_assert(internal::SameFrames<std::remove_cvref_t<
decltype(lhs)>, std::remove_cvref_t<
decltype(rhs)>>::value);
215template <
template <
typename,
int,
int>
typename ValuesLhsT_,
typename ValueLhsT_,
typename FromLhsT_,
typename ToLhsT_,
int DimensionLhsV_,
216 typename... UnitsLhsT_,
template <
typename,
int,
int>
typename ValuesRhsT_,
typename ValueRhsT_,
typename FromRhsT_,
217 typename ToRhsT_,
int DimensionRhsV_,
typename... UnitsRhsT_>
220 return !(lhs == rhs);
223template <
template <
typename,
int,
int>
typename ValuesT_,
typename ValueT_,
typename FromT_,
typename ToT_,
int DimensionV_,
Container to store quantities.
A tensor of rank 0, 1 or 2, whose components are quantities, expressed in a coordinate system,...
Any coordinate system: a specialization of CoordinateSystem, including the intermediate ones of trans...
The alias template ValueMatrix<ValueT_, RowsV_, ColsV_> of any value matrix backend,...
Whether constructing a Class from the arguments copies or moves it, i.e. whether they are a single Cl...
bool operator!=(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
std::ostream & operator<<(std::ostream &lhs, const Quantities< ValuesT_, UnitsT_ > &rhs)
auto innerProduct(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
internal::AbsoluteImpl< false > Relative
bool operator==(const Quantities< ValuesLhsT_, UnitsLhsT_ > &lhs, const Quantities< ValuesRhsT_, UnitsRhsT_ > &rhs)
typename CreateTypeMatrix< RowsV_, ColsV_, Types... >::type TypeMatrix
A matrix storing types at compile-time.
The composition lhs * rhs of two transformations, which applies rhs first, then lhs: (lhs * rhs)....
A lower, or covariant, index, e.g. of a covector w_i, whose components transform with the inverse of ...
The indices of a tensor, in their order, e.g. Indices<Up, Down> for a linear map T^i_j,...
static constexpr ValueT_ value()
An upper, or contravariant, index, e.g. of a vector v^i, whose components transform like the coordina...