LCOV - code coverage report
Current view: top level - include/mfem/solvers - MFEMLinearSolverBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 26ef6a Lines: 2 4 50.0 %
Date: 2026-06-24 21:19:51 Functions: 2 4 50.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 "MFEMSolverBase.h"
      15             : 
      16             : class MFEMProblemSolve;
      17             : 
      18             : namespace Moose::MFEM
      19             : {
      20             : /**
      21             :  * Base class for linear MFEM solvers and preconditioners.
      22             :  */
      23             : class LinearSolverBase : public SolverBase
      24             : {
      25             : public:
      26             :   static InputParameters validParams();
      27             : 
      28             :   LinearSolverBase(const InputParameters & parameters);
      29             : 
      30             :   /// Retrieves the preconditioner userobject if present, sets the member pointer to
      31             :   /// said object if still unset, and sets the solver to use this preconditioner.
      32             :   template <typename T>
      33             :   void SetPreconditioner(T & solver);
      34             : 
      35             :   /// Returns this solver's preconditioner
      36        1975 :   LinearSolverBase * GetPreconditioner() { return _preconditioner.get(); };
      37             : 
      38             :   /// Rebuild any Low-Order-Refined components from the unreduced bilinear form. Called only when
      39             :   /// IsLOR() is true, before the assembled linear operator has been set via SetOperator. Default
      40             :   /// no-op; override in solvers or preconditioners that construct LOR-related data from the
      41             :   /// bilinear form.
      42           0 :   virtual void SetupLOR(mfem::ParBilinearForm & /*a*/, mfem::Array<int> & /*tdofs*/) {}
      43             : 
      44             :   /// Updates the solver at the operator level. Default implementation sets the operator on the
      45             :   /// wrapped MFEM solver
      46             :   virtual void SetOperator(mfem::OperatorHandle & op);
      47             : 
      48             :   /// Returns whether or not this solver (or its preconditioner) uses LOR
      49        3846 :   bool IsLOR() const { return _lor || (_preconditioner && _preconditioner->IsLOR()); }
      50             : 
      51             :   /// For eigensolvers, this method calls the underlying Solve method
      52           0 :   virtual void Solve() { mooseError("'solve' method not used in this solver type."); }
      53             : 
      54             : protected:
      55             :   /// Checks for the correct configuration of quadrature bases for LOR spectral equivalence
      56             :   virtual void CheckSpectralEquivalence(mfem::ParBilinearForm & blf) const;
      57             : 
      58             :   /// Variable defining whether to use LOR solver
      59             :   bool _lor;
      60             : 
      61             :   /// Preconditioner to be used for the problem
      62             :   std::shared_ptr<LinearSolverBase> _preconditioner;
      63             : 
      64             : private:
      65             :   friend class ::MFEMProblemSolve;
      66             : };
      67             : } // namespace Moose::MFEM
      68             : 
      69             : #endif

Generated by: LCOV version 1.14