LCOV - code coverage report
Current view: top level - src/actions - AddAuxKernelAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 14 14 100.0 %
Date: 2025-08-08 20:01:16 Functions: 3 3 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 "AddAuxKernelAction.h"
      11             : #include "FEProblem.h"
      12             : 
      13             : registerMooseAction("MooseApp", AddAuxKernelAction, "add_aux_kernel");
      14             : 
      15             : InputParameters
      16         681 : AddAuxKernelAction::validParams()
      17             : {
      18         681 :   InputParameters params = MooseObjectAction::validParams();
      19             : 
      20             :   // This is to help with input file validation.  When AuxKernels are created with
      21             :   // this action, they are nested underneath an AuxVariable in the input file - so
      22             :   // we implicitly already know the variable name from this nesting and users
      23             :   // don't need to specify it for us with the parameter.  So we say here that
      24             :   // the variable param is provided by the action.
      25        1362 :   params.set<std::vector<std::string>>("_object_params_set_by_action") = {"variable"};
      26             : 
      27         681 :   return params;
      28        1362 : }
      29             : 
      30         478 : AddAuxKernelAction::AddAuxKernelAction(const InputParameters & params) : MooseObjectAction(params)
      31             : {
      32         478 : }
      33             : 
      34             : void
      35         471 : AddAuxKernelAction::act()
      36             : {
      37         471 :   std::vector<std::string> elements;
      38         471 :   MooseUtils::tokenize<std::string>(_pars.blockFullpath(), elements);
      39             : 
      40             :   // The variable name will be the second to last element in the path name
      41         471 :   std::string & var_name = elements[elements.size() - 2];
      42         471 :   _moose_object_pars.set<AuxVariableName>("variable") = var_name;
      43         471 :   _problem->addAuxKernel(_type, var_name, _moose_object_pars);
      44         471 : }

Generated by: LCOV version 1.14