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

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

#include <ProblemOperatorBase.h>

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

Public Member Functions

 ProblemOperatorBase (MFEMProblem &problem)
 
virtual ~ProblemOperatorBase ()=default
 
virtual void SetGridFunctions ()
 
virtual void SetTestVariablesFromTrueVectors ()
 
virtual void SetTrialVariablesFromTrueVectors ()
 
virtual void Init (mfem::BlockVector &X)
 
virtual void Solve ()=0
 

Public Attributes

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

Protected Attributes

MFEMProblem_problem
 Reference to the current problem. More...
 
MFEMProblemData_problem_data
 
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 ProblemOperatorBase.h.

Constructor & Destructor Documentation

◆ ProblemOperatorBase()

Moose::MFEM::ProblemOperatorBase::ProblemOperatorBase ( MFEMProblem problem)

Definition at line 19 of file ProblemOperatorBase.C.

20  : _problem(problem), _problem_data(problem.getProblemData())
21 {
22 }
MFEMProblemData & getProblemData()
Method to get the current MFEMProblemData object storing the current data specifying the FE problem...
Definition: MFEMProblem.h:186
MFEMProblem & _problem
Reference to the current problem.

◆ ~ProblemOperatorBase()

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

Member Function Documentation

◆ Init()

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

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

Definition at line 44 of file ProblemOperatorBase.C.

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

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

◆ SetGridFunctions()

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

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

Definition at line 25 of file ProblemOperatorBase.C.

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

26 {
29 
30  // Set operator size and block structure
31  _block_true_offsets.SetSize(_trial_variables.size() + 1);
32  _block_true_offsets[0] = 0;
33  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
34  {
35  _block_true_offsets[ind + 1] = _trial_variables.at(ind)->ParFESpace()->TrueVSize();
36  }
37  _block_true_offsets.PartialSum();
38 
41 }
std::vector< std::string > _test_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
std::vector< std::string > _trial_var_names
Vector of names of state gridfunctions used in formulation, ordered by appearance in block vector dur...
std::vector< mfem::ParGridFunction * > _test_variables
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< mfem::ParGridFunction * > _trial_variables
Moose::MFEM::GridFunctions gridfunctions

◆ SetTestVariablesFromTrueVectors()

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

Definition at line 65 of file ProblemOperatorBase.C.

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

66 {
67  for (unsigned int ind = 0; ind < _test_variables.size(); ++ind)
68  {
69  auto * const test_var = _test_variables.at(ind);
70 
71  // We must sync the memory flags from the true true vector to the grid function copy of the true
72  // vector
73  mooseAssert(_test_true_vector, "The true vector should already have been set");
74  test_var->GetTrueVector().SyncMemory(*_test_true_vector);
75  test_var->SetFromTrueVector();
76  }
77 }
std::vector< mfem::ParGridFunction * > _test_variables
const mfem::Vector * _test_true_vector

◆ SetTrialVariablesFromTrueVectors()

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

Definition at line 80 of file ProblemOperatorBase.C.

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

81 {
82  for (unsigned int ind = 0; ind < _trial_variables.size(); ++ind)
83  {
84  _trial_variables.at(ind)->SetFromTrueVector();
85  }
86 }
std::vector< mfem::ParGridFunction * > _trial_variables

◆ Solve()

virtual void Moose::MFEM::ProblemOperatorBase::Solve ( )
pure virtual

Member Data Documentation

◆ _block_true_offsets

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

◆ _equation_system_operator

mfem::OperatorHandle Moose::MFEM::ProblemOperatorBase::_equation_system_operator

Definition at line 33 of file ProblemOperatorBase.h.

◆ _problem

MFEMProblem& Moose::MFEM::ProblemOperatorBase::_problem
protected

◆ _problem_data

MFEMProblemData& Moose::MFEM::ProblemOperatorBase::_problem_data
protected

◆ _test_true_vector

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

Definition at line 44 of file ProblemOperatorBase.h.

Referenced by Init(), and SetTestVariablesFromTrueVectors().

◆ _test_var_names

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

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

Definition at line 42 of file ProblemOperatorBase.h.

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

◆ _test_variables

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

Definition at line 43 of file ProblemOperatorBase.h.

Referenced by Init(), SetGridFunctions(), and SetTestVariablesFromTrueVectors().

◆ _trial_var_names

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

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

Definition at line 48 of file ProblemOperatorBase.h.

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

◆ _trial_variables

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

◆ _true_rhs

mfem::BlockVector Moose::MFEM::ProblemOperatorBase::_true_rhs

◆ _true_x

mfem::BlockVector Moose::MFEM::ProblemOperatorBase::_true_x

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