https://mooseframework.inl.gov
Loading...
Searching...
No Matches
MFEMHypreLOBPCG.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
14#include "MFEMEigensolverBase.h"
15
20{
21public:
23
25
27 virtual void SetMassMatrix(mfem::Operator & mass) override { _eigensolver->SetMassMatrix(mass); }
28
30 virtual void Solve() override { _eigensolver->Solve(); }
31
33 virtual void GetEigenvalues(mfem::Array<mfem::real_t> & eigenvalues) const override
34 {
35 _eigensolver->GetEigenvalues(eigenvalues);
36 }
37
39 virtual const mfem::HypreParVector & GetEigenvector(int index) const override
40 {
41 return _eigensolver->GetEigenvector(index);
42 }
43
45 virtual void ConstructSolver() override;
46
47protected:
48 virtual void SetPreconditionerImpl() override
49 {
50 _eigensolver->SetPreconditioner(_preconditioner->GetSolver());
51 }
52
54 virtual void SetOperatorImpl(const mfem::Operator & op) override
55 {
56 _eigensolver->SetOperator(const_cast<mfem::Operator &>(op));
57 }
58
60 std::unique_ptr<mfem::HypreLOBPCG> _eigensolver;
61};
62
63#endif
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system.
Class for the Hypre LOBPCG eigensolver.
virtual void SetMassMatrix(mfem::Operator &mass) override
Sets the mass matrix for the eigensolver.
virtual void GetEigenvalues(mfem::Array< mfem::real_t > &eigenvalues) const override
Retrieves the computed eigenvalues.
virtual const mfem::HypreParVector & GetEigenvector(int index) const override
Retrieves the computed eigenvector corresponding to the given index.
virtual void Solve() override
Solves the eigenvalue problem.
virtual void SetPreconditionerImpl() override
Override in solvers that accept a preconditioner.
virtual void ConstructSolver() override
Override in derived classes to construct and set the solver options.
static InputParameters validParams()
std::unique_ptr< mfem::HypreLOBPCG > _eigensolver
Eigensolver to be used for the problem.
virtual void SetOperatorImpl(const mfem::Operator &op) override
Sets the operator for the eigensolver w/ the necessary casting.
const InputParameters & parameters() const
Get the parameters of the object.
Definition MooseBase.h:131
Base class for eigensolvers.
std::shared_ptr< LinearSolverBase > _preconditioner
Preconditioner to be used for the problem.