16 template <
typename MyType,
typename ParentType>
26 auto eval = [](
const auto& vec) ->
MyVecType {
27 if (vec.cols() == 1) {
30 if constexpr (std::is_same_v<MyType, wmtk::Rational>) {
31 return vec.rowwise().sum() / int(vec.cols());
33 return vec.rowwise().mean();
38 if constexpr (std::is_same_v<MyType, wmtk::Rational>) {
39 if constexpr (std::is_same_v<ParentType, wmtk::Rational>) {
42 constexpr
auto cast_rational = [](
const auto& x) -> MyType {
43 if constexpr (std::is_same_v<ParentType, double>) {
49 return eval(v.unaryExpr(cast_rational));
54 if constexpr (std::is_same_v<ParentType, wmtk::Rational>) {
55 constexpr
auto cast_from_rational = [](
const auto& x) -> MyType {
58 return eval(v.unaryExpr(cast_from_rational));
60 return eval(v.template cast<MyType>());
MatType< ParentType > ParentMatType
VecType< MyType > MyVecType
CastAttributeTransferStrategy(const attribute::MeshAttributeHandle &my_handle, const attribute::MeshAttributeHandle &parent_handle)
static MyVecType convert(const ParentMatType &v)