LCOV - code coverage report
Current view: top level - include/auxkernels - TagAuxBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 7323e9 Lines: 18 18 100.0 %
Date: 2025-11-05 20:01:15 Functions: 11 11 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             : #pragma once
      11             : 
      12             : #include "InputParameters.h"
      13             : #include "MooseVariableBase.h"
      14             : #include "MooseVariableFieldBase.h"
      15             : 
      16             : /**
      17             :  * The value of a tagged vector for a given node and a given variable is coupled to
      18             :  * the current AuxVariable. TagVectorAux returns the coupled nodal value.
      19             :  */
      20             : template <class T>
      21             : class TagAuxBase : public T
      22             : {
      23             : public:
      24             :   static InputParameters validParams();
      25             : 
      26             :   TagAuxBase(const InputParameters & parameters);
      27             : 
      28             : protected:
      29             :   const bool _scaled;
      30             :   /**
      31             :    * check the aux variable acting on this auxkernl has the consistent properties with the input
      32             :    * coupled variable
      33             :    * @param input_var Input coupled variable
      34             :    * @param aux_var Aux variable
      35             :    */
      36             :   void checkCoupledVariable(const MooseVariableBase * input_var,
      37             :                             const MooseVariableFieldBase * aux_var);
      38             : 
      39             :   using T::_var;
      40             :   using T::paramError;
      41             : };
      42             : 
      43             : template <class T>
      44             : InputParameters
      45      145189 : TagAuxBase<T>::validParams()
      46             : {
      47      145189 :   InputParameters params = T::validParams();
      48             : 
      49      435567 :   params.addRequiredCoupledVar("v",
      50             :                                "The coupled variable whose components are coupled to AuxVariable");
      51      435567 :   params.set<ExecFlagEnum>("execute_on", true) = {EXEC_TIMESTEP_END};
      52      290378 :   params.suppressParameter<ExecFlagEnum>("execute_on");
      53      580806 :   params.addDeprecatedParam<bool>(
      54             :       "scaled",
      55      290278 :       true,
      56             :       "Return value depending on the variable scaling/autoscaling. Set this to "
      57             :       "false to obtain unscaled physical reaction forces.",
      58             :       "This parameter has been deprecated.");
      59      145189 :   return params;
      60      145189 : }
      61             : 
      62             : template <class T>
      63        1145 : TagAuxBase<T>::TagAuxBase(const InputParameters & parameters)
      64        2194 :   : T(parameters), _scaled(this->template getParam<bool>("scaled"))
      65             : {
      66        1121 : }
      67             : 
      68             : template <class T>
      69             : void
      70         885 : TagAuxBase<T>::checkCoupledVariable(const MooseVariableBase * input_var,
      71             :                                     const MooseVariableFieldBase * aux_var)
      72             : {
      73         885 :   if (input_var->feType() != aux_var->feType())
      74          16 :     paramError("variable",
      75             :                "The AuxVariable this AuxKernel is acting on has to have the same order and family "
      76             :                "as the variable 'v'");
      77         877 :   if (input_var->count() != aux_var->count())
      78           8 :     paramError("variable",
      79             :                "The AuxVariable this AuxKernel is acting on has to have the same number of "
      80             :                "components as the variable 'v'");
      81         873 : }

Generated by: LCOV version 1.14