-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathMFEMSolverBase.h
More file actions
64 lines (48 loc) · 1.92 KB
/
MFEMSolverBase.h
File metadata and controls
64 lines (48 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//* This file is part of the MOOSE framework
//* https://mooseframework.inl.gov
//*
//* All rights reserved, see COPYRIGHT for full restrictions
//* https://github.com/idaholab/moose/blob/master/COPYRIGHT
//*
//* Licensed under LGPL 2.1, please see LICENSE for details
//* https://www.gnu.org/licenses/lgpl-2.1.html
#ifdef MOOSE_MFEM_ENABLED
#pragma once
#include "MFEMObject.h"
/**
* Base class for wrapping mfem::Solver-derived classes.
*/
class MFEMSolverBase : public MFEMObject
{
public:
static InputParameters validParams();
MFEMSolverBase(const InputParameters & parameters);
/// Retrieves the preconditioner userobject if present, sets the member pointer to
/// said object if still unset, and sets the solver to use this preconditioner.
template <typename T>
void setPreconditioner(T & solver);
/// Returns the wrapped MFEM solver
mfem::Solver & getSolver();
/// Updates the solver with the given bilinear form and essential dof list, in case an LOR or algebraic solver is needed.
virtual void updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs) = 0;
/// Returns whether or not this solver (or its preconditioner) uses LOR
bool isLOR() const { return _lor || (_preconditioner && _preconditioner->isLOR()); }
/// Override in derived classes to construct and set the solver options.
virtual void constructSolver() = 0;
protected:
/// Checks for the correct configuration of quadrature bases for LOR spectral equivalence
virtual void checkSpectralEquivalence(mfem::ParBilinearForm & blf) const;
/// Variable defining whether to use LOR solver
bool _lor;
/// Solver to be used for the problem
std::unique_ptr<mfem::Solver> _solver;
/// Preconditioner to be used for the problem
MFEMSolverBase * _preconditioner;
};
inline mfem::Solver &
MFEMSolverBase::getSolver()
{
mooseAssert(_solver, "Attempting to retrieve solver before it's been constructed");
return *_solver;
}
#endif