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 MOOSE_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", "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  if (const auto compute_device = _app.getComputeDevice())
37  else
38  _app.setMFEMDevice(isParamValid("device") ? getParam<std::string>("device")
39  : _app.isUltimateMaster() ? "cpu"
40  : "",
42 }
43 
44 #endif
static InputParameters validParams()
bool isUltimateMaster() const
Whether or not this app is the ultimate master app.
Definition: MooseApp.h:846
MFEMExecutioner(const InputParameters &params)
void setMFEMDevice(const std::string &device_string, Moose::PassKey< MFEMExecutioner >)
Create/configure the MFEM device with the provided device_string.
Definition: MooseApp.C:3606
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
std::optional< MooseEnum > getComputeDevice() const
Get the device accelerated computations are supposed to be running on.
bool isParamValid(const std::string &name) const
Test if the supplied parameter is valid.
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
MooseApp & _app
The MOOSE application this is associated with.
Definition: MooseBase.h:84
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...