OpenSWMM Engine  6.0.0-alpha.4
Data-oriented, plugin-extensible SWMM Engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
openswmm::fv::NativeGmres Class Reference

#include <NativeGmres.hpp>

Collaboration diagram for openswmm::fv::NativeGmres:

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.
 

Detailed Description

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.

Member Typedef Documentation

◆ Apply

using openswmm::fv::NativeGmres::Apply = std::function<bool(const double*, double*)>

Member Enumeration Documentation

◆ Status

Enumerator
Converged 
InvalidInput 
MemoryLimit 
NonFinite 
OperatorFailure 
PreconditionerFailure 
Breakdown 
Stagnated 
IterationLimit 

Member Function Documentation

◆ clearWorkspace()

void openswmm::fv::NativeGmres::clearWorkspace ( )
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.

◆ solve()

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.

Parameters
[in]rhsBorrowed nonempty finite n-vector; output may alias it because final publication follows all RHS use.
[in]matrixRequired synchronous fixed linear operator; reads n entries, overwrites all n outputs and returns success. Must not retain work spans or reenter solver.
[in]inverseOptional fixed linear right-preconditioner with identical span contract; empty means identity. Variable inner solves are unsupported.
[in]controlsrestart>0, max_iterations>=0, stagnant_restarts>0; finite nonnegative absolute/relative tolerances with at least one positive; byte budget bounds retained numeric vectors.
[out]outputAssigned the accepted correction only on convergence; no partial iterate published on a returned failure.
Returns
Status and iteration/restart/operator/true-residual/workspace diagnostics.
Here is the caller graph for this function:

◆ workspaceBytes()

std::size_t openswmm::fv::NativeGmres::workspaceBytes ( ) const
inline

Count retained numerical workspace capacity in bytes.

Returns
Sum of twelve vector capacities times sizeof(double); excludes vector objects/callback/caller memory.

The documentation for this class was generated from the following files: