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