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 2958 : AddElementalFieldAction::validParams() 21 : { 22 2958 : InputParameters params = AddVariableAction::validParams(); 23 2958 : params.addClassDescription("Adds elemental auxiliary variable for adaptivity system."); 24 2958 : params.ignoreParameter<std::string>("type"); 25 : 26 2958 : return params; 27 0 : } 28 : 29 2552 : AddElementalFieldAction::AddElementalFieldAction(const InputParameters & params) 30 2552 : : AddVariableAction(params) 31 : { 32 2552 : } 33 : 34 : void 35 2544 : AddElementalFieldAction::init() 36 : { 37 2544 : _moose_object_pars.set<MooseEnum>("order") = "CONSTANT"; 38 2544 : _moose_object_pars.set<MooseEnum>("family") = "MONOMIAL"; 39 : 40 2544 : _fe_type = libMesh::FEType(CONSTANT, MONOMIAL); 41 : 42 2544 : _type = "MooseVariableConstMonomial"; 43 : 44 2544 : _scalar_var = false; 45 : 46 : // Need static_cast to resolve overloads 47 5088 : _problem_add_var_method = static_cast<void (FEProblemBase::*)( 48 2544 : const std::string &, const std::string &, InputParameters &)>(&FEProblemBase::addAuxVariable); 49 2544 : } 50 : 51 : void 52 2544 : AddElementalFieldAction::act() 53 : { 54 2544 : init(); 55 : 56 2544 : std::string variable = name(); 57 2544 : addVariable(variable); 58 2544 : }