LCOV - code coverage report
Current view: top level - include/mfem/solvers - MFEMHypreLOBPCG.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 12 12 100.0 %
Date: 2026-07-23 16:15:30 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 Hypre LOBPCG eigensolver
      18             :  */
      19             : class MFEMHypreLOBPCG : public Moose::MFEM::EigensolverBase
      20             : {
      21             : public:
      22             :   static InputParameters validParams();
      23             : 
      24             :   MFEMHypreLOBPCG(const InputParameters & parameters);
      25             : 
      26             :   /// Sets the operator for the eigensolver and propagates it to the preconditioner.
      27          13 :   virtual void SetOperator(mfem::Operator & op) override
      28             :   {
      29          13 :     if (_preconditioner)
      30          13 :       _preconditioner->SetOperator(op);
      31          13 :     _eigensolver->SetOperator(op);
      32          13 :   }
      33             : 
      34             :   /// Sets the mass matrix for the eigensolver
      35          13 :   virtual void SetMassMatrix(mfem::Operator & mass) override { _eigensolver->SetMassMatrix(mass); }
      36             : 
      37             :   /// Solves the eigenvalue problem
      38          13 :   virtual void Solve() override { _eigensolver->Solve(); }
      39             : 
      40             :   /// Retrieves the computed eigenvalues
      41          26 :   virtual void GetEigenvalues(mfem::Array<mfem::real_t> & eigenvalues) const override
      42             :   {
      43          26 :     _eigensolver->GetEigenvalues(eigenvalues);
      44          26 :   }
      45             : 
      46             :   /// Retrieves the computed eigenvector corresponding to the given index
      47          78 :   virtual const mfem::HypreParVector & GetEigenvector(int index) const override
      48             :   {
      49          78 :     return _eigensolver->GetEigenvector(index);
      50             :   }
      51             : 
      52             : protected:
      53             :   /// Override in derived classes to construct and set the solver options.
      54             :   virtual void ConstructSolver() override;
      55             : 
      56             :   /// Eigensolver to be used for the problem
      57             :   std::unique_ptr<mfem::HypreLOBPCG> _eigensolver;
      58             : };
      59             : 
      60             : #endif

Generated by: LCOV version 1.14