LCOV - code coverage report
Current view: top level - include/timeintegrators - LumpedPreconditioner.h (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 2bf808 Lines: 9 9 100.0 %
Date: 2025-07-17 01:28:37 Functions: 3 3 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             : #pragma once
      11             : 
      12             : // MOOSE includes
      13             : #include "NonlinearSystem.h"
      14             : #include "FEProblem.h"
      15             : #include "PetscSupport.h"
      16             : 
      17             : // libMesh includes
      18             : #include "libmesh/sparse_matrix.h"
      19             : #include "libmesh/nonlinear_solver.h"
      20             : #include "libmesh/preconditioner.h"
      21             : 
      22             : // Forward declarations
      23             : class LumpedPreconditioner;
      24             : 
      25             : /**
      26             :  * Class to that applies the lumped mass matrix preconditioner
      27             :  * in the ExplicitTimeIntegrator
      28             :  */
      29             : class LumpedPreconditioner : public libMesh::Preconditioner<Real>
      30             : {
      31             : public:
      32          29 :   LumpedPreconditioner(const NumericVector<Real> & diag_inverse)
      33          29 :     : Preconditioner(diag_inverse.comm()), _diag_inverse(diag_inverse)
      34             :   {
      35          29 :   }
      36             : 
      37         323 :   virtual void init() override
      38             :   {
      39             :     // No more initialization needed here
      40         323 :     _is_initialized = true;
      41         323 :   }
      42             : 
      43        1538 :   virtual void apply(const NumericVector<Real> & x, NumericVector<Real> & y) override
      44             :   {
      45        1538 :     y.pointwise_mult(_diag_inverse, x);
      46        1538 :   }
      47             : 
      48             : protected:
      49             :   /// The inverse of the diagonal of the lumped matrix
      50             :   const NumericVector<Real> & _diag_inverse;
      51             : };

Generated by: LCOV version 1.14