LCOV - code coverage report
Current view: top level - include/mfem/solvers - MFEMLinearSolverBase.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 2 4 50.0 %
Date: 2026-07-23 16:15:30 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        2132 :   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> & /*ess_bdr_markers*/) {}
      43             : 
      44             :   /// Returns whether or not this solver (or its preconditioner) uses LOR
      45        4273 :   bool IsLOR() const { return _lor || (_preconditioner && _preconditioner->IsLOR()); }
      46             : 
      47             :   /// For eigensolvers, this method calls the underlying Solve method
      48           0 :   virtual void Solve() { mooseError("'solve' method not used in this solver type."); }
      49             : 
      50             : protected:
      51             :   /// Checks for the correct configuration of quadrature bases for LOR spectral equivalence
      52             :   virtual void CheckSpectralEquivalence(mfem::ParBilinearForm & blf) const;
      53             : 
      54             :   /// Variable defining whether to use LOR solver
      55             :   bool _lor;
      56             : 
      57             :   /// Preconditioner to be used for the problem
      58             :   std::shared_ptr<LinearSolverBase> _preconditioner;
      59             : 
      60             : private:
      61             :   friend class ::MFEMProblemSolve;
      62             : };
      63             : } // namespace Moose::MFEM
      64             : 
      65             : #endif

Generated by: LCOV version 1.14