https://mooseframework.inl.gov
MFEMSolverBase.h
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 #pragma once
13 #include "MFEMGeneralUserObject.h"
14 #include "libmesh/ignore_warnings.h"
15 #include <mfem.hpp>
16 #include "libmesh/restore_warnings.h"
17 #include <memory>
18 #include "MFEMHyprePatch.h"
19 
24 {
25 public:
27 
29 
32  template <typename T>
33  void setPreconditioner(T & solver);
34 
36  mfem::Solver & getSolver();
37 
39  virtual void updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs) = 0;
40 
42  bool isLOR() const { return _lor || (_preconditioner && _preconditioner->isLOR()); }
43 
44 protected:
46  virtual void constructSolver(const InputParameters & parameters) = 0;
47 
49  virtual void checkSpectralEquivalence(mfem::ParBilinearForm & blf) const;
50 
52  bool _lor;
53 
55  std::unique_ptr<mfem::Solver> _solver;
56 
59 };
60 
61 inline mfem::Solver &
63 {
64  mooseAssert(_solver, "Attempting to retrieve solver before it's been constructed");
65  return *_solver;
66 }
67 
68 #endif
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
virtual void checkSpectralEquivalence(mfem::ParBilinearForm &blf) const
Checks for the correct configuration of quadrature bases for LOR spectral equivalence.
MFEMSolverBase * _preconditioner
Preconditioner to be used for the problem.
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
static InputParameters validParams()
void setPreconditioner(T &solver)
Retrieves the preconditioner userobject if present, sets the member pointer to said object if still u...
This class adds a getMFEMProblem method.
MFEMSolverBase(const InputParameters &parameters)
bool _lor
Variable defining whether to use LOR solver.
Base class for wrapping mfem::Solver-derived classes.
virtual void updateSolver(mfem::ParBilinearForm &a, mfem::Array< int > &tdofs)=0
Updates the solver with the given bilinear form and essential dof list, in case an LOR or algebraic s...
mfem::Solver & getSolver()
Returns the wrapped MFEM solver.
virtual void constructSolver(const InputParameters &parameters)=0
Override in derived classes to construct and set the solver options.
bool isLOR() const
Returns whether or not this solver (or its preconditioner) uses LOR.
std::unique_ptr< mfem::Solver > _solver
Solver to be used for the problem.