LCOV - code coverage report
Current view: top level - src/auxkernels - FunctorVectorElementalAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 18 20 90.0 %
Date: 2025-08-08 20:01:16 Functions: 6 6 100.0 %
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             : #include "FunctorVectorElementalAux.h"
      11             : #include "metaphysicl/raw_type.h"
      12             : 
      13             : registerMooseObject("MooseApp", FunctorVectorElementalAux);
      14             : registerMooseObject("MooseApp", ADFunctorVectorElementalAux);
      15             : 
      16             : template <bool is_ad>
      17             : InputParameters
      18       28731 : FunctorVectorElementalAuxTempl<is_ad>::validParams()
      19             : {
      20       28731 :   InputParameters params = AuxKernel::validParams();
      21       28731 :   params.addClassDescription(
      22             :       "Evaluates a vector functor (material property usually) on the current element."
      23             :       "For finite volume, this evaluates the vector functor at the centroid.");
      24       28731 :   params.addRequiredParam<MooseFunctorName>("functor", "The functor to evaluate");
      25       28731 :   params.addRequiredParam<unsigned int>("component", "Component of the vector functor");
      26       28731 :   params.addParam<MooseFunctorName>("factor", 1, "A factor to apply on the functor");
      27             : 
      28       28731 :   return params;
      29           0 : }
      30             : 
      31             : template <bool is_ad>
      32          98 : FunctorVectorElementalAuxTempl<is_ad>::FunctorVectorElementalAuxTempl(
      33             :     const InputParameters & parameters)
      34             :   : AuxKernel(parameters),
      35          98 :     _functor(getFunctor<GenericRealVectorValue<is_ad>>("functor")),
      36          98 :     _component(getParam<unsigned int>("component")),
      37         196 :     _factor(getFunctor<GenericReal<is_ad>>("factor"))
      38             : {
      39          98 :   if (isNodal())
      40           0 :     paramError("variable", "This AuxKernel only supports Elemental fields");
      41          98 : }
      42             : 
      43             : template <bool is_ad>
      44             : Real
      45        4272 : FunctorVectorElementalAuxTempl<is_ad>::computeValue()
      46             : {
      47        4272 :   const auto elem_arg = makeElemArg(_current_elem);
      48        4272 :   const auto state = determineState();
      49        5712 :   return MetaPhysicL::raw_value(_factor(elem_arg, state)) *
      50        5712 :          MetaPhysicL::raw_value(_functor(elem_arg, state)(_component));
      51             : }

Generated by: LCOV version 1.14