LCOV - code coverage report
Current view: top level - src/mfem/solvers - MFEMOperatorChebyshevSmoother.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: #33416 (b10b36) with base 9fbd27 Lines: 17 18 94.4 %
Date: 2026-07-23 16:15:30 Functions: 4 4 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             : #include "MFEMOperatorChebyshevSmoother.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMOperatorChebyshevSmoother);
      16             : 
      17             : InputParameters
      18        2144 : MFEMOperatorChebyshevSmoother::validParams()
      19             : {
      20        2144 :   InputParameters params = Moose::MFEM::LinearSolverBase::validParams();
      21        4288 :   params.addClassDescription(
      22             :       "Chebyshev polynomial smoother backed by mfem::OperatorChebyshevSmoother. "
      23             :       "Symmetric positive definite by construction; the maximum eigenvalue of D^{-1}A "
      24             :       "is estimated automatically via a power method. Suitable as a multigrid smoother.");
      25        6432 :   params.addParam<int>("order", 2, "Degree of the Chebyshev polynomial (1-4).");
      26        2144 :   return params;
      27           0 : }
      28             : 
      29           9 : MFEMOperatorChebyshevSmoother::MFEMOperatorChebyshevSmoother(const InputParameters & parameters)
      30          27 :   : LinearSolverBase(parameters), _order(getParam<int>("order"))
      31             : {
      32           9 :   ConstructSolver();
      33           9 : }
      34             : 
      35             : void
      36           9 : MFEMOperatorChebyshevSmoother::ConstructSolver()
      37             : {
      38             :   // Deferred: mfem::OperatorChebyshevSmoother requires the operator and its diagonal,
      39             :   // which are only available at SetOperator() time. _solver is intentionally left null
      40             :   // here; GetSolver() must not be called before SetOperator().
      41           9 : }
      42             : 
      43             : void
      44           7 : MFEMOperatorChebyshevSmoother::SetOperator(mfem::Operator & op)
      45             : {
      46           7 :   _diag.SetSize(op.Height());
      47           7 :   op.AssembleDiagonal(_diag);
      48           7 :   _solver = std::make_unique<mfem::OperatorChebyshevSmoother>(
      49           7 :       op, _diag, _empty_tdofs, _order, getMFEMProblem().getComm());
      50           7 : }
      51             : #endif

Generated by: LCOV version 1.14