https://mooseframework.inl.gov
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 {
21 public:
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 
47 protected:
49  virtual void SetOperatorImpl(mfem::Operator & op) override
50  {
51  if (_preconditioner)
52  _preconditioner->SetOperator(op);
53  _eigensolver->SetOperator(op);
54  }
55 
57  std::unique_ptr<mfem::HypreLOBPCG> _eigensolver;
58 };
59 
60 #endif
std::unique_ptr< mfem::HypreLOBPCG > _eigensolver
Eigensolver to be used for the problem.
const InputParameters & parameters() const
Get the parameters of the object.
Definition: MooseBase.h:131
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.
std::shared_ptr< LinearSolverBase > _preconditioner
Preconditioner to be used for the problem.
static InputParameters validParams()
virtual void ConstructSolver() override
Override in derived classes to construct and set the solver options.
virtual void GetEigenvalues(mfem::Array< mfem::real_t > &eigenvalues) const override
Retrieves the computed eigenvalues.
virtual void SetOperatorImpl(mfem::Operator &op) override
Sets the operator for the eigensolver and propagates it to the preconditioner.
MFEMHypreLOBPCG(const InputParameters &parameters)
virtual void Solve() override
Solves the eigenvalue problem.
virtual const mfem::HypreParVector & GetEigenvector(int index) const override
Retrieves the computed eigenvector corresponding to the given index.
Base class for eigensolvers.