https://mooseframework.inl.gov
MFEMSubMeshTransfer.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 "MFEMSubMeshTransfer.h"
13 #include "MFEMProblem.h"
14 
16 
19 {
21  params.registerBase("MFEMSubMeshTransfer");
22  params.addClassDescription("Class to transfer MFEM variable data to or from a restricted copy of "
23  "the variable defined on "
24  " a subspace of an MFEMMesh, represented as an MFEMSubMesh.");
25  MFEMExecutedObject::addRequiredDependencyParam<VariableName>(
26  params,
27  "from_variable",
28  "MFEM variable to transfer data from. Can be defined on either the parent mesh or a "
29  "submesh of it.");
30  params.addRequiredParam<VariableName>("to_variable",
31  "MFEM variable to transfer data into. Can be defined on "
32  "either the parent mesh or a submesh of it.");
33 
34  return params;
35 }
36 
38  : MFEMExecutedObject(parameters),
39  _source_var_name(getParam<VariableName>("from_variable")),
40  _source_var(*getMFEMProblem().getGridFunction(_source_var_name)),
41  _result_var_name(getParam<VariableName>("to_variable")),
42  _result_var(*getMFEMProblem().getGridFunction(_result_var_name))
43 {
44 }
45 
46 std::optional<std::string>
48 {
49  return _result_var_name;
50 }
51 
52 void
54 {
55  mfem::ParSubMesh::Transfer(_source_var, _result_var);
56 }
57 
58 #endif
MFEMSubMeshTransfer(const InputParameters &parameters)
static InputParameters validParams()
Base class for MFEM objects that participate in execution ordering but are not UserObjects.
const mfem::ParGridFunction & _source_var
Reference to source gridfunction.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
Class to transfer MFEM variable data to or from a restricted copy of the variable defined on an a sub...
static InputParameters validParams()
Declare the common parameters used by MFEM executed objects.
void registerBase(const std::string &value)
This method must be called from every base "Moose System" to create linkage with the Action System...
mfem::ParGridFunction & _result_var
Reference to result gridfunction.
virtual void execute() override
Executes the transfer.
registerMooseObject("MooseApp", MFEMSubMeshTransfer)
const VariableName & _result_var_name
Name of MFEMVariable to store the transferred output in.
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...
virtual std::optional< std::string > suppliedVariableName() const override
Return the variable name supplied by this object, or std::nullopt if none.