![]() |
OpenSWMM Engine
6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
|
#include <NativeGmres.hpp>
Classes | |
| struct | Controls |
| struct | Result |
Public Types | |
| enum class | Status { Converged , InvalidInput , MemoryLimit , NonFinite , OperatorFailure , PreconditionerFailure , Breakdown , Stagnated , IterationLimit } |
| using | Apply = std::function<bool(const double*, double*)> |
Public Member Functions | |
| Result | solve (const std::vector< double > &rhs, const Apply &matrix, const Apply &inverse, const Controls &controls, std::vector< double > &output) |
| Solve a dense-vector linear system with restarted fixed-right-preconditioned GMRES. | |
| std::size_t | workspaceBytes () const |
| Count retained numerical workspace capacity in bytes. | |
| void | clearWorkspace () |
| Release all retained numerical workspace allocations. | |
Native restarted GMRES with FIXED LINEAR right preconditioning. These callbacks overwrite all n entries, allocate no iteration workspace, and must not change their operator during solve(). Variable inner solves need FGMRES, which this class does not implement. No third-party solver code.
| using openswmm::fv::NativeGmres::Apply = std::function<bool(const double*, double*)> |
|
strong |
|
inline |
Release all retained numerical workspace allocations.
Swaps every work vector with empty storage; invalidates borrowed work pointers and requires no active solve. Does not change caller results.
| NativeGmres::Result openswmm::fv::NativeGmres::solve | ( | const std::vector< double > & | rhs, |
| const Apply & | matrix, | ||
| const Apply & | inverse, | ||
| const Controls & | controls, | ||
| std::vector< double > & | output ) |
Solve a dense-vector linear system with restarted fixed-right-preconditioned GMRES.
Starts from zero correction and accepts fresh norm(rhs-A*x)<=absolute+relative*norm(rhs), including happy breakdown. Retained capacity budget excludes caller vectors/callback storage/allocator overhead. Workspace bad_alloc maps to MemoryLimit; callback exceptions and final output-copy allocation can propagate. Mutable workspace makes one instance non-reentrant; caller serializes solve/clear operations.
| [in] | rhs | Borrowed nonempty finite n-vector; output may alias it because final publication follows all RHS use. |
| [in] | matrix | Required synchronous fixed linear operator; reads n entries, overwrites all n outputs and returns success. Must not retain work spans or reenter solver. |
| [in] | inverse | Optional fixed linear right-preconditioner with identical span contract; empty means identity. Variable inner solves are unsupported. |
| [in] | controls | restart>0, max_iterations>=0, stagnant_restarts>0; finite nonnegative absolute/relative tolerances with at least one positive; byte budget bounds retained numeric vectors. |
| [out] | output | Assigned the accepted correction only on convergence; no partial iterate published on a returned failure. |
|
inline |
Count retained numerical workspace capacity in bytes.