https://mooseframework.inl.gov
Public Member Functions | Public Attributes | Protected Attributes | List of all members
Moose::MFEM::ProblemOperatorInterface Class Reference

Interface inherited by ProblemOperator and TimeDomainProblemOperator. Removes duplicated code in both classes. More...

#include <ProblemOperatorInterface.h>

Inheritance diagram for Moose::MFEM::ProblemOperatorInterface:
[legend]

Public Member Functions

 ProblemOperatorInterface (MFEMProblemData &problem)
 
virtual ~ProblemOperatorInterface ()=default
 
virtual void SetGridFunctions ()
 
virtual void SetTestVariablesFromTrueVectors ()
 
virtual void SetTrialVariablesFromTrueVectors ()
 
virtual void Init (mfem::BlockVector &X)
 

Public Attributes

mfem::Array< int_block_true_offsets
 
mfem::BlockVector _true_x
 
mfem::BlockVector _true_rhs
 
mfem::OperatorHandle _equation_system_operator
 

Protected Attributes

MFEMProblemData_problem
 Reference to the current problem. More...
 
std::vector< std::string > _test_var_names
 Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve. More...
 
std::vector< mfem::ParGridFunction * > _test_variables
 
const mfem::Vector * _test_true_vector = nullptr
 
std::vector< std::string > _trial_var_names
 Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve. More...
 
std::vector< mfem::ParGridFunction * > _trial_variables
 

Detailed Description

Interface inherited by ProblemOperator and TimeDomainProblemOperator. Removes duplicated code in both classes.

Definition at line 18 of file ProblemOperatorInterface.h.

Constructor & Destructor Documentation

◆ ProblemOperatorInterface()

Moose::MFEM::ProblemOperatorInterface::ProblemOperatorInterface ( MFEMProblemData problem)
inline

Definition at line 21 of file ProblemOperatorInterface.h.

21 : _problem(problem) {}
MFEMProblemData & _problem
Reference to the current problem.

◆ ~ProblemOperatorInterface()

virtual Moose::MFEM::ProblemOperatorInterface::~ProblemOperatorInterface ( )
virtualdefault

Member Function Documentation

◆ Init()

void Moose::MFEM::ProblemOperatorInterface::Init ( mfem::BlockVector &  X)
virtual

Reimplemented in Moose::MFEM::TimeDomainEquationSystemProblemOperator, and Moose::MFEM::EquationSystemProblemOperator.

Definition at line 36 of file ProblemOperatorInterface.C.

Referenced by Moose::MFEM::EquationSystemProblemOperator::Init(), and Moose::MFEM::TimeDomainEquationSystemProblemOperator::Init().

37 {
38  X.Update(_block_true_offsets);
39  for (const auto i : index_range(_test_variables))
40  X.GetBlock(i) = _test_variables[i]->GetTrueVector();
41  // Sync the flags from sub-block vectors to global vector
42  X.SyncFromBlocks();
43 
44  // After initial assignment of X from the grid function, which may contain initial conditions,
45  // we alias the grid function to X
46  for (const auto i : index_range(_test_variables))
47  _test_variables[i]->MakeTRef(_test_variables[i]->ParFESpace(), X, _block_true_offsets[i]);
48  _test_true_vector = &X;
49 
50  // This might seem silly but after making the tref the memory flags of the grid function and its
51  // true vector are in an empty state other than the aliasing. This operation syncs the flags and
52  // should be a no-op in terms of actual data transfer
54 }
std::vector< mfem::ParGridFunction * > _test_variables
auto index_range(const T &sizable)

◆ SetGridFunctions()

void Moose::MFEM::ProblemOperatorInterface::SetGridFunctions ( )
virtual

Reimplemented in Moose::MFEM::TimeDomainEquationSystemProblemOperator, Moose::MFEM::TimeDomainProblemOperator, Moose::MFEM::EquationSystemProblemOperator, and Moose::MFEM::ProblemOperator.

Definition at line 17 of file ProblemOperatorInterface.C.

Referenced by Moose::MFEM::ProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDomainProblemOperator::SetGridFunctions().

18 {
21 
22  // Set operator size and block structure
23  _block_true_offsets.SetSize(_trial_variables.size() + 1);
24  _block_true_offsets[0] = 0;
25  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
26  {
27  _block_true_offsets[ind + 1] = _trial_variables.at(ind)->ParFESpace()->TrueVSize();
28  }
29  _block_true_offsets.PartialSum();
30 
33 }
std::vector< mfem::ParGridFunction * > _trial_variables
MFEMProblemData & _problem
Reference to the current problem.
std::vector< mfem::ParGridFunction * > _test_variables
std::vector< std::string > _test_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
T * Get(const std::string &field_name) const
Returns a non-owning pointer to the field. This is guaranteed to return a non-null pointer...
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
Moose::MFEM::GridFunctions gridfunctions

◆ SetTestVariablesFromTrueVectors()

void Moose::MFEM::ProblemOperatorInterface::SetTestVariablesFromTrueVectors ( )
virtual

Definition at line 57 of file ProblemOperatorInterface.C.

Referenced by Moose::MFEM::TimeDomainEquationSystemProblemOperator::ImplicitSolve(), and Init().

58 {
59  for (unsigned int ind = 0; ind < _test_variables.size(); ++ind)
60  {
61  auto * const test_var = _test_variables.at(ind);
62 
63  // We must sync the memory flags from the true true vector to the grid function copy of the true
64  // vector
65  mooseAssert(_test_true_vector, "The true vector should already have been set");
66  test_var->GetTrueVector().SyncMemory(*_test_true_vector);
67  test_var->SetFromTrueVector();
68  }
69 }
std::vector< mfem::ParGridFunction * > _test_variables

◆ SetTrialVariablesFromTrueVectors()

void Moose::MFEM::ProblemOperatorInterface::SetTrialVariablesFromTrueVectors ( )
virtual

Definition at line 72 of file ProblemOperatorInterface.C.

Referenced by Moose::MFEM::TimeDomainEquationSystemProblemOperator::ImplicitSolve().

73 {
74  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
75  {
76  _trial_variables.at(ind)->SetFromTrueVector();
77  }
78 }
std::vector< mfem::ParGridFunction * > _trial_variables

Member Data Documentation

◆ _block_true_offsets

mfem::Array<int> Moose::MFEM::ProblemOperatorInterface::_block_true_offsets

◆ _equation_system_operator

mfem::OperatorHandle Moose::MFEM::ProblemOperatorInterface::_equation_system_operator

Definition at line 32 of file ProblemOperatorInterface.h.

◆ _problem

MFEMProblemData& Moose::MFEM::ProblemOperatorInterface::_problem
protected

◆ _test_true_vector

const mfem::Vector* Moose::MFEM::ProblemOperatorInterface::_test_true_vector = nullptr
protected

Definition at line 42 of file ProblemOperatorInterface.h.

Referenced by Init(), and SetTestVariablesFromTrueVectors().

◆ _test_var_names

std::vector<std::string> Moose::MFEM::ProblemOperatorInterface::_test_var_names
protected

Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve.

Definition at line 40 of file ProblemOperatorInterface.h.

Referenced by SetGridFunctions(), Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions().

◆ _test_variables

std::vector<mfem::ParGridFunction *> Moose::MFEM::ProblemOperatorInterface::_test_variables
protected

◆ _trial_var_names

std::vector<std::string> Moose::MFEM::ProblemOperatorInterface::_trial_var_names
protected

Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector during solve.

Definition at line 46 of file ProblemOperatorInterface.h.

Referenced by SetGridFunctions(), Moose::MFEM::EquationSystemProblemOperator::SetGridFunctions(), and Moose::MFEM::TimeDomainEquationSystemProblemOperator::SetGridFunctions().

◆ _trial_variables

std::vector<mfem::ParGridFunction *> Moose::MFEM::ProblemOperatorInterface::_trial_variables
protected

◆ _true_rhs

mfem::BlockVector Moose::MFEM::ProblemOperatorInterface::_true_rhs

◆ _true_x

mfem::BlockVector Moose::MFEM::ProblemOperatorInterface::_true_x

The documentation for this class was generated from the following files: