This patch upgrades the PartitionedArrays dependency from the 0.3.x
release series to 0.5.x (closes#17). Also updates documentation build
dependencies.
This patch adds the functions
`HYPRE.GetFinalRelativeResidualNorm(::HYPRESolver)` and
`HYPRE.GetNumIterations(::HYPRESolver)` for querying final residual norm
and number of iterations from solvers. These functions dispatches on the
solver to the corresponding C API wrappers
`LibHYPRE.HYPRE_${Solver}GetFinalRelativeResidualNorm` and
`LibHYPRE.HYPRE_${Solver}GetNumIterations`, respectively.
This patch adds an assembler interface such that it is possible to
directly assemble HYPRE(Vector|Matrix) without going through a sparse
matrix datastructure in Julia. This is done as follows:
1. Create a new (empty) matrix/vector using the constructor.
2. Create an assembler and initialize the assembly using
HYPRE.start_assemble!.
3. Assemble all contributions using HYPRE.assemble!.
4. Finalize the assembly using HYPRE.finish_assemble!.
HYPRE.start_assemble!
The assembler caches some buffers that are (re)used by every call to
HYPRE.assemble! so this should be efficient. All MPI communication
should happen in the finalization step.
This patch wraps the HYPRE_Destroy functions for the HYPRESolvers in a
functtion that checks if the pointer is NULL before calling the Destroy
function. While this makes sense on it self, it also makes it possible
to override a finalizer by adding a second one that sets the pointer to
NULL. This is utilized in the set_precond(::Hybrid, p) function, since
the Hybrid solver currently frees the provied preconditioner too.
This patch adds the function `HYPRE.Init()` which i) calls `MPI.Init`
(unless MPI is already initialized), ii) calls `HYPRE_Init`, and iii)
adds a Julia exit hook which calls `HYPRE_Finalize` (if the keyword
argument `finalize_atexit` is `true`).
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...