Line data Source code
1 : //* This file is part of the MOOSE framework 2 : //* https://mooseframework.inl.gov 3 : //* 4 : //* All rights reserved, see COPYRIGHT for full restrictions 5 : //* https://github.com/idaholab/moose/blob/master/COPYRIGHT 6 : //* 7 : //* Licensed under LGPL 2.1, please see LICENSE for details 8 : //* https://www.gnu.org/licenses/lgpl-2.1.html 9 : 10 : #pragma once 11 : 12 : #include "EigenADReal.h" 13 : #include <Eigen/Dense> 14 : 15 : /** 16 : * A two-component zero initialized vector used for tangential quantities 17 : */ 18 : template <typename T> 19 121937 : class GenericTwoVector : public Eigen::Matrix<T, 2, 1> 20 : { 21 : public: 22 3110 : GenericTwoVector() { this->setZero(); } 23 249953 : using Eigen::Matrix<T, 2, 1>::Matrix; 24 : }; 25 : 26 : using TwoVector = GenericTwoVector<Real>; 27 : using ADTwoVector = GenericTwoVector<ADReal>; 28 : 29 : namespace MetaPhysicL 30 : { 31 : // raw_value AD->non-AD conversion for ADReal valued Eigen::Matrix objects 32 : template <> 33 : struct RawType<ADTwoVector> 34 : { 35 : typedef TwoVector value_type; 36 : 37 : static value_type value(const ADTwoVector & in) 38 : { 39 : return value_type::NullaryExpr([&in](Eigen::Index i) { return raw_value(in(i)); }); 40 : } 41 : }; 42 : }