https://mooseframework.inl.gov
MFEMSuperLU.h
Go to the documentation of this file.
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 #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 
25 class SuperLUSolver : public mfem::SuperLUSolver
26 {
27 public:
28  SuperLUSolver(MPI_Comm comm, int npdep = 1)
29  : mfem::SuperLUSolver(comm), _s_superlu(std::make_unique<mfem::SuperLUSolver>(comm, npdep)) {};
30  void SetOperator(const mfem::Operator & op) override
31  {
32  _a_superlu = std::make_unique<mfem::SuperLURowLocMatrix>(op);
33  _s_superlu->SetOperator(*_a_superlu.get());
34  }
35  void Mult(const mfem::Vector & x, mfem::Vector & y) const override { _s_superlu->Mult(x, y); }
36 
37 private:
38  std::unique_ptr<mfem::SuperLURowLocMatrix> _a_superlu{nullptr};
39  std::unique_ptr<mfem::SuperLUSolver> _s_superlu{nullptr};
40 };
41 } // namespace Moose::MFEM
42 
47 {
48 public:
50 
52 
53 protected:
54  void constructSolver(const InputParameters & parameters) override;
55 
57  void updateSolver(mfem::ParBilinearForm & a, mfem::Array<int> & tdofs) override;
58 };
59 
60 #endif
static InputParameters validParams()
Definition: MFEMSuperLU.C:18
Wrapper for Moose::MFEM::SuperLUSolver.
Definition: MFEMSuperLU.h:46
void SetOperator(const mfem::Operator &op) override
Definition: MFEMSuperLU.h:30
The main MOOSE class responsible for handling user-defined parameters in almost every MOOSE system...
void constructSolver(const InputParameters &parameters) override
Override in derived classes to construct and set the solver options.
Definition: MFEMSuperLU.C:33
void updateSolver(mfem::ParBilinearForm &a, mfem::Array< int > &tdofs) override
Updates the solver with the bilinear form in case LOR solve is required.
Definition: MFEMSuperLU.C:40
SuperLUSolver(MPI_Comm comm, int npdep=1)
Definition: MFEMSuperLU.h:28
std::unique_ptr< mfem::SuperLUSolver > _s_superlu
Definition: MFEMSuperLU.h:39
MFEMSuperLU(const InputParameters &parameters)
Definition: MFEMSuperLU.C:27
std::unique_ptr< mfem::SuperLURowLocMatrix > _a_superlu
Definition: MFEMSuperLU.h:38
Wrapper for mfem::SuperLUSolver that creates a SuperLURowLocMatrix from the operator when set...
Definition: MFEMSuperLU.h:25
Base class for wrapping mfem::Solver-derived classes.
void Mult(const mfem::Vector &x, mfem::Vector &y) const override
Definition: MFEMSuperLU.h:35
const InputParameters & parameters() const
Get the parameters of the object.