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 "MFEMExecutioner.h" 13 : #include "MFEMProblem.h" 14 : 15 : InputParameters 16 17528 : MFEMExecutioner::validParams() 17 : { 18 17528 : InputParameters params = Executioner::validParams(); 19 17528 : params.addClassDescription("Executioner for MFEM problems."); 20 17528 : params.addParam<std::string>("device", "cpu", "Run app on the chosen device."); 21 17528 : MooseEnum assembly_levels("legacy full element partial none", "legacy", true); 22 17528 : params.addParam<MooseEnum>( 23 : "assembly_level", 24 : assembly_levels, 25 : "Matrix assembly level. Options: legacy, full, element, partial, none."); 26 : 27 35056 : return params; 28 17528 : } 29 : 30 134 : MFEMExecutioner::MFEMExecutioner(const InputParameters & parameters) 31 : : Executioner(parameters), 32 134 : _mfem_problem(dynamic_cast<MFEMProblem &>(feProblem())), 33 268 : _problem_data(_mfem_problem.getProblemData()) 34 : { 35 134 : setDevice(); 36 134 : } 37 : 38 : void 39 134 : MFEMExecutioner::setDevice() 40 : { 41 : // TODO: might not be enough should check the device 42 : // your trying to donfigure is the same one that has been configured 43 134 : if (_device.IsConfigured()) 44 24 : return; 45 110 : _device.Configure(getParam<std::string>("device")); 46 110 : _device.Print(Moose::out); 47 : } 48 : 49 : #endif