LCOV - code coverage report
Current view: top level - src/actions - AddElementalFieldAction.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 419b9d Lines: 22 23 95.7 %
Date: 2025-08-08 20:01:16 Functions: 4 4 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             : // MOOSE includes
      11             : #include "AddElementalFieldAction.h"
      12             : #include "FEProblem.h"
      13             : #include "MooseMesh.h"
      14             : 
      15             : #include "libmesh/fe.h"
      16             : 
      17             : registerMooseAction("MooseApp", AddElementalFieldAction, "add_elemental_field_variable");
      18             : 
      19             : InputParameters
      20        3158 : AddElementalFieldAction::validParams()
      21             : {
      22        3158 :   InputParameters params = AddVariableAction::validParams();
      23        3158 :   params.addClassDescription("Adds elemental auxiliary variable for adaptivity system.");
      24        3158 :   params.ignoreParameter<std::string>("type");
      25             : 
      26        3158 :   return params;
      27           0 : }
      28             : 
      29        2752 : AddElementalFieldAction::AddElementalFieldAction(const InputParameters & params)
      30        2752 :   : AddVariableAction(params)
      31             : {
      32        2752 : }
      33             : 
      34             : void
      35        2744 : AddElementalFieldAction::init()
      36             : {
      37        2744 :   _moose_object_pars.set<MooseEnum>("order") = "CONSTANT";
      38        2744 :   _moose_object_pars.set<MooseEnum>("family") = "MONOMIAL";
      39             : 
      40        2744 :   _fe_type = libMesh::FEType(CONSTANT, MONOMIAL);
      41             : 
      42        2744 :   _type = "MooseVariableConstMonomial";
      43             : 
      44        2744 :   _scalar_var = false;
      45             : 
      46             :   // Need static_cast to resolve overloads
      47        5488 :   _problem_add_var_method = static_cast<void (FEProblemBase::*)(
      48        2744 :       const std::string &, const std::string &, InputParameters &)>(&FEProblemBase::addAuxVariable);
      49        2744 : }
      50             : 
      51             : void
      52        2744 : AddElementalFieldAction::act()
      53             : {
      54        2744 :   init();
      55             : 
      56        2744 :   std::string variable = name();
      57        2744 :   addVariable(variable);
      58        2744 : }

Generated by: LCOV version 1.14