LCOV - code coverage report
Current view: top level - include/utils - RawValueFunctor.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 53 60 88.3 %
Date: 2025-07-17 01:28:37 Functions: 30 64 46.9 %
Legend: Lines: hit not hit

          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 "MooseFunctor.h"
      13             : 
      14             : namespace Moose
      15             : {
      16             : template <typename T>
      17             : class RawValueFunctor : public FunctorBase<T>
      18             : {
      19             : public:
      20             :   using typename Moose::FunctorBase<T>::ValueType;
      21             :   using typename Moose::FunctorBase<T>::GradientType;
      22             :   using typename Moose::FunctorBase<T>::DotType;
      23             : 
      24      176312 :   RawValueFunctor(const FunctorBase<typename ADType<T>::type> & ad_functor)
      25      176312 :     : FunctorBase<T>(ad_functor.functorName() + "_raw_value", {EXEC_ALWAYS}),
      26      528936 :       _ad_functor(ad_functor)
      27             :   {
      28      352624 :   }
      29             : 
      30           0 :   virtual bool isExtrapolatedBoundaryFace(const FaceInfo & fi,
      31             :                                           const Elem * const elem,
      32             :                                           const Moose::StateArg & state) const override
      33             :   {
      34           0 :     return _ad_functor.isExtrapolatedBoundaryFace(fi, elem, state);
      35             :   }
      36           0 :   virtual bool isConstant() const override { return _ad_functor.isConstant(); }
      37       31832 :   virtual bool hasBlocks(const SubdomainID id) const override { return _ad_functor.hasBlocks(id); }
      38           0 :   virtual bool hasFaceSide(const FaceInfo & fi, const bool fi_elem_side) const override
      39             :   {
      40           0 :     return _ad_functor.hasFaceSide(fi, fi_elem_side);
      41             :   }
      42             : 
      43           0 :   bool supportsFaceArg() const override final { return _ad_functor.supportsFaceArg(); }
      44           0 :   bool supportsElemSideQpArg() const override final { return _ad_functor.supportsElemSideQpArg(); }
      45             : 
      46             : protected:
      47             :   ///@{
      48             :   /**
      49             :    * Forward calls to wrapped object
      50             :    */
      51       11841 :   ValueType evaluate(const ElemArg & elem, const StateArg & state) const override
      52             :   {
      53       11841 :     return MetaPhysicL::raw_value(_ad_functor(elem, state));
      54             :   }
      55        5577 :   ValueType evaluate(const FaceArg & face, const StateArg & state) const override
      56             :   {
      57        5577 :     return MetaPhysicL::raw_value(_ad_functor(face, state));
      58             :   }
      59      123012 :   ValueType evaluate(const ElemQpArg & qp, const StateArg & state) const override
      60             :   {
      61      123012 :     return MetaPhysicL::raw_value(_ad_functor(qp, state));
      62             :   }
      63        3865 :   ValueType evaluate(const ElemSideQpArg & qp, const StateArg & state) const override
      64             :   {
      65        3865 :     return MetaPhysicL::raw_value(_ad_functor(qp, state));
      66             :   }
      67         537 :   ValueType evaluate(const ElemPointArg & elem_point, const StateArg & state) const override
      68             :   {
      69         537 :     return MetaPhysicL::raw_value(_ad_functor(elem_point, state));
      70             :   }
      71       77347 :   ValueType evaluate(const NodeArg & node, const StateArg & state) const override
      72             :   {
      73       77347 :     return MetaPhysicL::raw_value(_ad_functor(node, state));
      74             :   }
      75             : 
      76           1 :   GradientType evaluateGradient(const ElemArg & elem, const StateArg & state) const override
      77             :   {
      78           1 :     return MetaPhysicL::raw_value(_ad_functor.gradient(elem, state));
      79             :   }
      80           1 :   GradientType evaluateGradient(const FaceArg & face, const StateArg & state) const override
      81             :   {
      82           1 :     return MetaPhysicL::raw_value(_ad_functor.gradient(face, state));
      83             :   }
      84        1671 :   GradientType evaluateGradient(const ElemQpArg & qp, const StateArg & state) const override
      85             :   {
      86        1671 :     return MetaPhysicL::raw_value(_ad_functor.gradient(qp, state));
      87             :   }
      88           1 :   GradientType evaluateGradient(const ElemSideQpArg & qp, const StateArg & state) const override
      89             :   {
      90           1 :     return MetaPhysicL::raw_value(_ad_functor.gradient(qp, state));
      91             :   }
      92           1 :   GradientType evaluateGradient(const ElemPointArg & elem_point,
      93             :                                 const StateArg & state) const override
      94             :   {
      95           1 :     return MetaPhysicL::raw_value(_ad_functor.gradient(elem_point, state));
      96             :   }
      97           1 :   GradientType evaluateGradient(const NodeArg & node, const StateArg & state) const override
      98             :   {
      99           1 :     return MetaPhysicL::raw_value(_ad_functor.gradient(node, state));
     100             :   }
     101             : 
     102        7561 :   DotType evaluateDot(const ElemArg & elem, const StateArg & state) const override
     103             :   {
     104        7561 :     return MetaPhysicL::raw_value(_ad_functor.dot(elem, state));
     105             :   }
     106           1 :   DotType evaluateDot(const FaceArg & face, const StateArg & state) const override
     107             :   {
     108           1 :     return MetaPhysicL::raw_value(_ad_functor.dot(face, state));
     109             :   }
     110         385 :   DotType evaluateDot(const ElemQpArg & qp, const StateArg & state) const override
     111             :   {
     112         385 :     return MetaPhysicL::raw_value(_ad_functor.dot(qp, state));
     113             :   }
     114           1 :   DotType evaluateDot(const ElemSideQpArg & qp, const StateArg & state) const override
     115             :   {
     116           1 :     return MetaPhysicL::raw_value(_ad_functor.dot(qp, state));
     117             :   }
     118           1 :   DotType evaluateDot(const ElemPointArg & elem_point, const StateArg & state) const override
     119             :   {
     120           1 :     return MetaPhysicL::raw_value(_ad_functor.dot(elem_point, state));
     121             :   }
     122           1 :   DotType evaluateDot(const NodeArg & node, const StateArg & state) const override
     123             :   {
     124           1 :     return MetaPhysicL::raw_value(_ad_functor.dot(node, state));
     125             :   }
     126             : 
     127           1 :   GradientType evaluateGradDot(const ElemArg & elem, const StateArg & state) const override
     128             :   {
     129           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(elem, state));
     130             :   }
     131           1 :   GradientType evaluateGradDot(const FaceArg & face, const StateArg & state) const override
     132             :   {
     133           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(face, state));
     134             :   }
     135           1 :   GradientType evaluateGradDot(const ElemQpArg & qp, const StateArg & state) const override
     136             :   {
     137           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(qp, state));
     138             :   }
     139           1 :   GradientType evaluateGradDot(const ElemSideQpArg & qp, const StateArg & state) const override
     140             :   {
     141           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(qp, state));
     142             :   }
     143           1 :   GradientType evaluateGradDot(const ElemPointArg & elem_point,
     144             :                                const StateArg & state) const override
     145             :   {
     146           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(elem_point, state));
     147             :   }
     148           1 :   GradientType evaluateGradDot(const NodeArg & node, const StateArg & state) const override
     149             :   {
     150           1 :     return MetaPhysicL::raw_value(_ad_functor.gradDot(node, state));
     151             :   }
     152             :   ///@}
     153             : 
     154             : private:
     155             :   /// Our wrapped AD object
     156             :   const FunctorBase<typename ADType<T>::type> & _ad_functor;
     157             : };
     158             : }

Generated by: LCOV version 1.14