This patch adds defaults for ilower and iupper in constructors when i)
using SparseMatrixCS(C|R) and Vector and ii) when no communicator is
passed. In this case we simply assume the users wants a single-processor
solve, and default to passing 1 and size(A, 1) as the default values.
In the future this could possibly use the HYPRE sequential compiler
flag to completely avoid MPI.
This patch changes the argument order from:
HYPREMatrix(::SparseMatrixCS(C|R), ::Integer, ::Integer, ::MPI.Comm)
HYPREVector(::Vector, ::Integer, ::Integer, ::MPI.Comm)
to:
HYPREMatrix(::MPI.Comm, ::SparseMatrixCS(C|R), ::Integer, ::Integer)
HYPREVector(::MPI.Comm, ::Vector, ::Integer, ::Integer)
to match the basic constructor. This also makes it easier to default
owned rows to the full matrix/vector for single process solves. The
methods without the communicator (added in this patch) will in the
future have this default.
This patch adds the communicator and the owned rows to the
`HYPRE(Matrix|Vector)` structs. The `Internals.init_(matrix|vector)`
functions have been removed in favor of:
HYPREMatrix(::MPI.Comm, ::Integer, ::Integer, ::Integer, ::Integer)
HYPREVector(::MPI.Comm, ::Integer, ::Integer)
which more or less mirrors the `IJ(Matrix|Vector)Create` functions.
This patch adds the following methods:
solve( ::HYPRESolver, ::PSparseMatrix, ::PVector)
solve!(::HYPRESolver, ::PVector, ::PSparseMatrix, ::PVector)
which automatically converts to/from HYPRE(Matrix|Vector).
This patch adds a function
solve(::HYPRESolver, ::HYPREMatrix, ::HYPREVector) which initializes an
output vector initialized to 0 and pass it to solve!.
Settings are passed as keyword arguments, just like BoomerAMG. The
Precond argument (corresponding to PCGSetPrecond) is handled separately,
and lets you pass another solver directly, instead of the solver
pointer, the setup and solve functions, as in the SetPrecond C function.
Example:
precond = BoomerAMG(; options...)
solver = PCG(; Precond = precond, options...)
This commits contains the solver interface:
A = HYPREMatrix(...)
b = HYPREVector(...)
x = HYPREVector(...)
solver = HYPRESolver(; options...)
solve!(solver, x, A, b)
where the abstract type HYPRESolver is replaced by a concrete solver
implementation (this commit includes the concrete
implementation/wrapping of BoomerAMG <: HYPRESolver).
Solver settings are passed as keyword arguments to the solver
constructor, cf. SetXXX functions in HYPRE.
For example, to create a BoomerAMG solver, and setting the tolerance:
solver = BoomerAMG(Tol = 1e-7)
Keyword argument names correspond directly to the solvers SetXXX
function in HYPRE; passing Tol corresponds to
HYPRE_BoomerAMGSetTol(solver, 1e-7).
- Move LibHYPRE submodule to it's own file
- Move Internals stub module to it's own file
- Add conversions from PartitionedArrays.(PSparseMatrix|PVector)
- More tests...
Add manual methods for some ::Function signatures where the library wants function
pointers. Instead of creating function pointers to the Julia wrappers we can just look
up the pointer in the library and pass that.