https://mooseframework.inl.gov
MFEMExecutioner.C
Go to the documentation of this file.
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 
17 {
19  params.addClassDescription("Executioner for MFEM problems.");
20  params.addParam<std::string>("device", "cpu", "Run app on the chosen device.");
21  MooseEnum assembly_levels("legacy full element partial none", "legacy", true);
22  params.addParam<MooseEnum>(
23  "assembly_level",
24  assembly_levels,
25  "Matrix assembly level. Options: legacy, full, element, partial, none.");
26 
27  return params;
28 }
29 
31  : Executioner(parameters),
32  _mfem_problem(dynamic_cast<MFEMProblem &>(feProblem())),
33  _problem_data(_mfem_problem.getProblemData())
34 {
35  setDevice();
36 }
37 
38 void
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  if (_device.IsConfigured())
44  return;
45  _device.Configure(getParam<std::string>("device"));
46  _device.Print(Moose::out);
47 }
48 
49 #endif
static InputParameters validParams()
void setDevice()
Set the device to use to solve the FE problem.
MFEMExecutioner(const InputParameters &params)
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
Definition: Executioner.C:26
This is a "smart" enum class intended to replace many of the shortcomings in the C++ enum type It sho...
Definition: MooseEnum.h:33
Executioners are objects that do the actual work of solving your problem.
Definition: Executioner.h:30
mfem::Device _device
void addClassDescription(const std::string &doc_string)
This method adds a description of the class that will be displayed in the input file syntax dump...
void addParam(const std::string &name, const S &value, const std::string &doc_string)
These methods add an optional parameter and a documentation string to the InputParameters object...