Line data Source code
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 : 16 : /** 17 : * Class for the HypreAME eigensolver 18 : */ 19 : class MFEMHypreAME : public MFEMEigensolverBase 20 : { 21 : public: 22 : static InputParameters validParams(); 23 : 24 : MFEMHypreAME(const InputParameters & parameters); 25 : 26 : /// Sets the operator for the eigensolver and propagates it to the preconditioner. 27 13 : virtual void setOperator(mfem::OperatorHandle & op) override 28 : { 29 13 : if (_preconditioner) 30 13 : _preconditioner->setOperator(op); 31 13 : _eigensolver->SetOperator(*op.As<mfem::HypreParMatrix>()); 32 13 : } 33 : 34 : /// Sets the mass matrix for the eigensolver 35 13 : virtual void setMassMatrix(mfem::OperatorHandle & mass) override 36 : { 37 13 : _eigensolver->SetMassMatrix(*mass.As<mfem::HypreParMatrix>()); 38 13 : } 39 : 40 : /// Solves the eigenvalue problem 41 13 : virtual void solve() override { _eigensolver->Solve(); } 42 : 43 : /// Retrieves the computed eigenvalues 44 26 : virtual void getEigenvalues(mfem::Array<mfem::real_t> & eigenvalues) const override 45 : { 46 26 : _eigensolver->GetEigenvalues(eigenvalues); 47 26 : } 48 : 49 : /// Retrieves the computed eigenvector corresponding to the given index 50 78 : virtual const mfem::HypreParVector & getEigenvector(int index) const override 51 : { 52 78 : return _eigensolver->GetEigenvector(index); 53 : } 54 : 55 : protected: 56 : /// Override in derived classes to construct and set the solver options. 57 : virtual void constructSolver() override; 58 : 59 : /// Eigensolver to be used for the problem 60 : std::unique_ptr<mfem::HypreAME> _eigensolver; 61 : }; 62 : 63 : #endif