LCOV - code coverage report
Current view: top level - src/numerics - preconditioner.C (source / functions) Hit Total Coverage
Test: libMesh/libmesh: #4229 (6a9aeb) with base 727f46 Lines: 5 14 35.7 %
Date: 2025-08-19 19:27:09 Functions: 1 4 25.0 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : // The libMesh Finite Element Library.
       2             : // Copyright (C) 2002-2025 Benjamin S. Kirk, John W. Peterson, Roy H. Stogner
       3             : 
       4             : // This library is free software; you can redistribute it and/or
       5             : // modify it under the terms of the GNU Lesser General Public
       6             : // License as published by the Free Software Foundation; either
       7             : // version 2.1 of the License, or (at your option) any later version.
       8             : 
       9             : // This library is distributed in the hope that it will be useful,
      10             : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      11             : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
      12             : // Lesser General Public License for more details.
      13             : 
      14             : // You should have received a copy of the GNU Lesser General Public
      15             : // License along with this library; if not, write to the Free Software
      16             : // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
      17             : 
      18             : 
      19             : 
      20             : // Local Includes
      21             : #include "libmesh/preconditioner.h"
      22             : #include "libmesh/eigen_preconditioner.h"
      23             : #include "libmesh/petsc_preconditioner.h"
      24             : #include "libmesh/trilinos_preconditioner.h"
      25             : #include "libmesh/enum_solver_package.h"
      26             : #include "libmesh/enum_preconditioner_type.h"
      27             : 
      28             : 
      29             : // C++ Includes
      30             : #include <memory>
      31             : 
      32             : 
      33             : namespace libMesh
      34             : {
      35             : 
      36             : template <typename T>
      37             : inline
      38         350 : Preconditioner<T>::Preconditioner (const libMesh::Parallel::Communicator & comm_in) :
      39             :   ParallelObject(comm_in),
      40         330 :   _matrix(nullptr),
      41         330 :   _preconditioner_type (ILU_PRECOND),
      42         350 :   _is_initialized      (false)
      43             : {
      44         350 : }
      45             : 
      46             : 
      47             : 
      48             : template <typename T>
      49             : std::unique_ptr<Preconditioner<T>>
      50           0 : Preconditioner<T>::build_preconditioner(const libMesh::Parallel::Communicator & comm,
      51             :                                         const SolverPackage solver_package)
      52             : {
      53             :   // Avoid unused parameter warnings when no solver packages are enabled.
      54           0 :   libmesh_ignore(comm);
      55             : 
      56             :   // Build and return the appropriate Preconditioner object.
      57           0 :   switch (solver_package)
      58             :     {
      59             : 
      60             : #ifdef LIBMESH_HAVE_PETSC
      61           0 :     case PETSC_SOLVERS:
      62             :       {
      63           0 :         return std::make_unique<PetscPreconditioner<T>>(comm);
      64             :       }
      65             : #endif
      66             : 
      67             : #ifdef LIBMESH_TRILINOS_HAVE_EPETRA
      68             :     case TRILINOS_SOLVERS:
      69             :       return std::make_unique<TrilinosPreconditioner<T>>(comm);
      70             : #endif
      71             : 
      72             : #ifdef LIBMESH_HAVE_EIGEN
      73           0 :     case EIGEN_SOLVERS:
      74           0 :       return std::make_unique<EigenPreconditioner<T>>(comm);
      75             : #endif
      76             : 
      77           0 :     default:
      78           0 :       libmesh_error_msg("ERROR:  Unrecognized solver package: " << solver_package);
      79             :     }
      80             : }
      81             : 
      82             : 
      83             : 
      84             : //------------------------------------------------------------------
      85             : // Explicit instantiations
      86             : template class LIBMESH_EXPORT Preconditioner<Number>;
      87             : 
      88             : } // namespace libMesh

Generated by: LCOV version 1.14