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 : #pragma once 13 : 14 : #include "MFEMSolverBase.h" 15 : 16 : namespace Moose::MFEM 17 : { 18 : 19 : /** 20 : * Wrapper for mfem::SuperLUSolver that creates a SuperLURowLocMatrix from the operator when set. 21 : */ 22 : class SuperLUSolver : public mfem::SuperLUSolver 23 : { 24 : public: 25 68 : SuperLUSolver(MPI_Comm comm, int npdep = 1) 26 68 : : mfem::SuperLUSolver(comm), _s_superlu(std::make_unique<mfem::SuperLUSolver>(comm, npdep)) {}; 27 80 : void SetOperator(const mfem::Operator & op) override 28 : { 29 80 : _a_superlu = std::make_unique<mfem::SuperLURowLocMatrix>(op); 30 80 : _s_superlu->SetOperator(*_a_superlu.get()); 31 80 : } 32 80 : void Mult(const mfem::Vector & x, mfem::Vector & y) const override { _s_superlu->Mult(x, y); } 33 : 34 : private: 35 : std::unique_ptr<mfem::SuperLURowLocMatrix> _a_superlu{nullptr}; 36 : std::unique_ptr<mfem::SuperLUSolver> _s_superlu{nullptr}; 37 : }; 38 : } // namespace Moose::MFEM 39 : 40 : /** 41 : * Wrapper for Moose::MFEM::SuperLUSolver. 42 : */ 43 : class MFEMSuperLU : public MFEMSolverBase 44 : { 45 : public: 46 : static InputParameters validParams(); 47 : 48 : MFEMSuperLU(const InputParameters & parameters); 49 : 50 : protected: 51 : void constructSolver() override; 52 : 53 : /// Updates the solver with the bilinear form in case LOR solve is required 54 : void updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs) override; 55 : }; 56 : 57 : #endif