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 "MFEMExecutioner.h" 13 : #include "MFEMProblem.h" 14 : 15 : InputParameters 16 17732 : MFEMExecutioner::validParams() 17 : { 18 17732 : InputParameters params = Executioner::validParams(); 19 17732 : params.addClassDescription("Executioner for MFEM problems."); 20 17732 : params.addParam<std::string>("device", "Run app on the chosen device."); 21 17732 : MooseEnum assembly_levels("legacy full element partial none", "legacy", true); 22 17732 : params.addParam<MooseEnum>( 23 : "assembly_level", 24 : assembly_levels, 25 : "Matrix assembly level. Options: legacy, full, element, partial, none."); 26 : 27 35464 : return params; 28 17732 : } 29 : 30 236 : MFEMExecutioner::MFEMExecutioner(const InputParameters & parameters) 31 : : Executioner(parameters), 32 236 : _mfem_problem(dynamic_cast<MFEMProblem &>(feProblem())), 33 472 : _problem_data(_mfem_problem.getProblemData()) 34 : { 35 236 : if (const auto compute_device = _app.getComputeDevice()) 36 204 : _app.setMFEMDevice(*compute_device, Moose::PassKey<MFEMExecutioner>()); 37 : else 38 64 : _app.setMFEMDevice(isParamValid("device") ? getParam<std::string>("device") 39 32 : : _app.isUltimateMaster() ? "cpu" 40 : : "", 41 268 : Moose::PassKey<MFEMExecutioner>()); 42 236 : } 43 : 44 : #endif