LCOV - code coverage report
Current view: top level - src/mfem/solvers - MFEMHypreAMS.C (source / functions) Hit Total Coverage
Test: idaholab/moose framework: 329044 Lines: 24 25 96.0 %
Date: 2026-08-03 21:12:22 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 "MFEMHypreAMS.h"
      13             : #include "MFEMProblem.h"
      14             : 
      15             : registerMooseObject("MooseApp", MFEMHypreAMS);
      16             : 
      17             : InputParameters
      18        2376 : MFEMHypreAMS::validParams()
      19             : {
      20        2376 :   InputParameters params = Moose::MFEM::LORLinearSolverBase<mfem::HypreAMS>::validParams();
      21        4752 :   params.addClassDescription("Hypre auxiliary-space Maxwell solver and preconditioner for the "
      22             :                              "iterative solution of MFEM equation systems.");
      23        9504 :   params.addParam<MFEMFESpaceName>("fespace", "H(curl) FESpace to use in HypreAMS setup.");
      24        7128 :   params.addParam<bool>("singular",
      25        4752 :                         false,
      26             :                         "Declare that the system is singular; use when solving curl-curl problem "
      27             :                         "if mass term is zero");
      28        7128 :   params.addParam<int>("print_level", 2, "Set the solver verbosity.");
      29             : 
      30        2376 :   return params;
      31           0 : }
      32             : 
      33         123 : MFEMHypreAMS::MFEMHypreAMS(const InputParameters & parameters)
      34             :   : Moose::MFEM::LORLinearSolverBase<mfem::HypreAMS>(parameters),
      35         123 :     _mfem_fespace(getMFEMProblem().getMFEMObject<MFEMFESpace>("MFEMFESpace",
      36         369 :                                                               getParam<MFEMFESpaceName>("fespace")))
      37             : {
      38         123 :   ConstructSolver();
      39         123 : }
      40             : 
      41             : void
      42         123 : MFEMHypreAMS::ConstructSolver()
      43             : {
      44         123 :   auto solver = std::make_unique<mfem::HypreAMS>(_mfem_fespace.getFESpace().get());
      45         123 :   SetSolverParameters(*solver);
      46         123 :   _solver = std::move(solver);
      47         123 : }
      48             : 
      49             : void
      50         130 : MFEMHypreAMS::SetSolverParameters(mfem::HypreAMS & solver)
      51             : {
      52         390 :   if (getParam<bool>("singular"))
      53          27 :     solver.SetSingularProblem();
      54         260 :   solver.iterative_mode = getParam<bool>("use_initial_guess");
      55         260 :   solver.SetPrintLevel(getParam<int>("print_level"));
      56         130 : }
      57             : 
      58             : #endif

Generated by: LCOV version 1.14