LCOV - code coverage report
Current view: top level - include/mfem/solvers - MFEMHypreAME.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 329044 Lines: 14 14 100.0 %
Date: 2026-08-03 21:12:22 Functions: 5 5 100.0 %
Legend: Lines: hit not hit

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

Generated by: LCOV version 1.14