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 : #ifdef MOOSE_MFEM_ENABLED 11 : 12 : #include "MFEMScalarIC.h" 13 : #include "MFEMProblem.h" 14 : 15 : registerMooseObject("MooseApp", MFEMScalarIC); 16 : 17 : InputParameters 18 3452 : MFEMScalarIC::validParams() 19 : { 20 3452 : auto params = MFEMInitialCondition::validParams(); 21 6904 : params.addClassDescription("Sets the initial values of an MFEM scalar variable from a " 22 : "user-specified scalar coefficient."); 23 10356 : params.addRequiredParam<MFEMScalarCoefficientName>("coefficient", "The scalar coefficient"); 24 3452 : return params; 25 0 : } 26 : 27 677 : MFEMScalarIC::MFEMScalarIC(const InputParameters & params) : MFEMInitialCondition(params) {} 28 : 29 : void 30 677 : MFEMScalarIC::execute() 31 : { 32 1354 : auto & coeff = getScalarCoefficient("coefficient"); 33 1354 : auto grid_function = getMFEMProblem().getGridFunction(getParam<VariableName>("variable")); 34 677 : grid_function->ProjectCoefficient(coeff); 35 677 : } 36 : 37 : #endif