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 : // To be removed as soon as we have a fix upstream in either hypre or mfem 11 : 12 : #ifdef MOOSE_MFEM_ENABLED 13 : 14 : namespace mfem 15 : { 16 : namespace patched 17 : { 18 : /** 19 : * Patch for mfem::HypreGMRES to reset preconditioning matrix at every nonlinear/time iteration 20 : */ 21 : class HypreGMRES : public mfem::HypreGMRES 22 : { 23 : public: 24 : using mfem::HypreGMRES::HypreGMRES; 25 187 : void SetOperator(const mfem::Operator & op) 26 : { 27 187 : mfem::HypreGMRES::SetOperator(op); 28 187 : HYPRE_GMRESSetPrecondMatrix(HYPRE_Solver(*this), nullptr); 29 187 : } 30 : }; 31 : 32 : /** 33 : * Patch for mfem::HyprePCG to reset preconditioning matrix at every nonlinear/time iteration 34 : */ 35 : class HyprePCG : public mfem::HyprePCG 36 : { 37 : public: 38 : using mfem::HyprePCG::HyprePCG; 39 534 : void SetOperator(const mfem::Operator & op) 40 : { 41 534 : mfem::HyprePCG::SetOperator(op); 42 534 : HYPRE_PCGSetPrecondMatrix(HYPRE_Solver(*this), nullptr); 43 534 : } 44 : }; 45 : } 46 : } 47 : 48 : #endif