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