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