LCOV - code coverage report
Current view: top level - src/auxkernels - FunctorVectorElementalAux.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #32971 (54bef8) with base c6cf66 Lines: 18 20 90.0 %
Date: 2026-05-29 20:35:17 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        6306 : FunctorVectorElementalAuxTempl<is_ad>::validParams()
      19             : {
      20        6306 :   InputParameters params = AuxKernel::validParams();
      21       12612 :   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       25224 :   params.addRequiredParam<MooseFunctorName>("functor", "The functor to evaluate");
      25       25224 :   params.addRequiredParam<unsigned int>("component", "Component of the vector functor");
      26       18918 :   params.addParam<MooseFunctorName>("factor", 1, "A factor to apply on the functor");
      27             : 
      28        6306 :   return params;
      29           0 : }
      30             : 
      31             : template <bool is_ad>
      32          91 : FunctorVectorElementalAuxTempl<is_ad>::FunctorVectorElementalAuxTempl(
      33             :     const InputParameters & parameters)
      34             :   : AuxKernel(parameters),
      35          91 :     _functor(getFunctor<GenericRealVectorValue<is_ad>>("functor")),
      36         182 :     _component(getParam<unsigned int>("component")),
      37         273 :     _factor(getFunctor<GenericReal<is_ad>>("factor"))
      38             : {
      39          91 :   if (isNodal())
      40           0 :     paramError("variable", "This AuxKernel only supports Elemental fields");
      41          91 : }
      42             : 
      43             : template <bool is_ad>
      44             : Real
      45        3824 : FunctorVectorElementalAuxTempl<is_ad>::computeValue()
      46             : {
      47        3824 :   const auto elem_arg = makeElemArg(_current_elem);
      48        3824 :   const auto state = determineState();
      49        5104 :   return MetaPhysicL::raw_value(_factor(elem_arg, state)) *
      50        5104 :          MetaPhysicL::raw_value(_functor(elem_arg, state)(_component));
      51             : }

Generated by: LCOV version 1.14