MFEM v4.8.0
Finite element discretization library
Loading...
Searching...
No Matches
solver.cpp
Go to the documentation of this file.
1// Copyright (c) 2010-2025, Lawrence Livermore National Security, LLC. Produced
2// at the Lawrence Livermore National Laboratory. All Rights reserved. See files
3// LICENSE and NOTICE for details. LLNL-CODE-806117.
4//
5// This file is part of the MFEM library. For more information and source code
6// availability visit https://mfem.org.
7//
8// MFEM is free software; you can redistribute it and/or modify it under the
9// terms of the BSD-3 license. We welcome feedback and contributions, see file
10// CONTRIBUTING.md for details.
11
12#include "solver.hpp"
13
14namespace mfem
15{
16
19 : A(A_), mode(mode_), backend(backend_)
20{
21 MFEM_VERIFY(A.SizeI() == A.SizeJ(), "Blocks must be square.");
22 if (mode == LU)
23 {
25 }
26 else
27 {
29 }
30}
31
32void BatchedDirectSolver::Mult(const Vector &x, Vector &y) const
33{
34 if (mode == LU)
35 {
36 y = x;
38 }
39 else
40 {
42 }
43}
44
46{
47 MFEM_ABORT("Not supported.");
48}
49
50} // namespace mfem
Mode mode
Solver mode.
Definition solver.hpp:38
DenseTensor A
The LU factors/inverses of the input matrices.
Definition solver.hpp:36
Mode
Solver mode: whether to use LU factorization or inverses.
Definition solver.hpp:31
@ LU
LU factorization.
Definition solver.hpp:32
void Mult(const Vector &x, Vector &y) const
Sets .
Definition solver.cpp:32
BatchedDirectSolver(const DenseTensor &A_, Mode mode_, BatchedLinAlg::Backend backend_=BatchedLinAlg::GetActiveBackend())
Constructor.
Definition solver.cpp:17
void SetOperator(const Operator &op)
Not supported (aborts).
Definition solver.cpp:45
Array< int > P
Pivots (needed only for LU factors).
Definition solver.hpp:37
BatchedLinAlg::Backend backend
Requested batched linear algebra backend.
Definition solver.hpp:39
virtual void Mult(const DenseTensor &A, const Vector &x, Vector &y) const
See BatchedLinAlg::Mult.
Definition batched.cpp:110
virtual void Invert(DenseTensor &A) const =0
See BatchedLinAlg::Invert.
virtual void LUFactor(DenseTensor &A, Array< int > &P) const =0
See BatchedLinAlg::LUFactor.
virtual void LUSolve(const DenseTensor &LU, const Array< int > &P, Vector &x) const =0
See BatchedLinAlg::LUSolve.
Backend
Available backends for implementations of batched algorithms.
Definition batched.hpp:39
static const BatchedLinAlgBase & Get(Backend backend)
Get the BatchedLinAlgBase object associated with a specific backend.
Definition batched.cpp:103
Rank 3 tensor (array of matrices)
int SizeJ() const
int SizeI() const
Abstract operator.
Definition operator.hpp:25
Vector data type.
Definition vector.hpp:82