Skip to content

Progress & Events

ferreus_rbf.Progress(callback=None)

Wrapper for progress event reporting.

Parameters:

Name Type Description Default
callback ProgressCallback

Function invoked with each :data:ProgressEvent.

None
Notes

Use this to receive events from long-running operations such as DDM/FGMRES solves and isosurface extraction.

Event payloads

ferreus_rbf.progress.DuplicatesRemoved

Event indicating that duplicate input points were removed.

Attributes:

Name Type Description
num_duplicates int

Number of points removed as duplicates.

ferreus_rbf.progress.SolverIteration

Event indicating iteration status for an iterative solver.

Attributes:

Name Type Description
iter int

Zero-based iteration counter.

residual float

Current residual norm.

progress float

Fraction in [0, 1] indicating overall progress.

ferreus_rbf.progress.Message

Arbitrary informational message.

Attributes:

Name Type Description
message str

The message text.

ferreus_rbf.progress.SurfacingProgress

Even indicating progress for isosurface extraction.

Attributes:

Name Type Description
isovalue float

Isovalue currently being surfaced.

stage str

Human-readable stage name (e.g., "Calculating surface intersections", "Building faces").

progress float

Fraction in [0, 1] for the current isovalue.

Type aliases

ferreus_rbf.progress.ProgressEvent = Union[SolverIteration, DuplicatesRemoved, SurfacingProgress, Message] module-attribute

Union of all progress event payloads passed to :class:Progress callbacks.

ferreus_rbf.progress.ProgressCallback = Callable[[ProgressEvent], None] module-attribute

Callable accepting one :data:ProgressEvent and returning None.

Example use:

from ferreus_rbf.progress import (
    Progress,
    SolverIteration,
    SurfacingProgress,
    DuplicatesRemoved,
    Message,
    ProgressEvent
)

# Create a function to handle each ProgressEvent type
def on_progress(event: ProgressEvent) -> None:
    if isinstance(event, DuplicatesRemoved):
        print(f"Removed duplicates: {event.num_duplicates}")
    elif isinstance(event, SolverIteration):
        print(f"Iteration: {event.iter:3d}  {event.residual:>.5E}  {(event.progress * 100):.1f}%")
    elif isinstance(event, Message):
        print(event.message)
    elif isinstance(event, SurfacingProgress):
        print(f"Isovalue: {event.isovalue}  Stage: {event.stage}  {(event.progress * 100):.1f}%")

# Create a Progress instance using the on_progress function
prog = Progress(callback=on_progress)

Example DuplicatesRemove output:

Removed duplicates: 15

Example SolverIteration output:

Iteration:   1  1.80801E+02  16.2%
Iteration:   2  1.53657E+01  37.3%
Iteration:   3  2.42940E+00  53.1%
Iteration:   4  5.06244E-01  66.5%
Iteration:   5  1.35629E-01  77.7%
Iteration:   6  4.87250E-02  86.5%
Iteration:   7  1.17505E-02  98.6%
Iteration:   8  2.45231E-03  100.0%

Example Message output:

Took 2.870149s to solve RBF for 26988 points using the following settings:
Kernel: Spheroidal, Polynomial degree: -1
Fitting accuracy: 0.01, Tolerance type: Absolute

Example SurfacingProgress output:

Isovalue: 0.0  Stage: Calculating surface intersections  0.0%
Isovalue: 0.0  Stage: Calculating surface intersections  38.9%
Isovalue: 0.0  Stage: Calculating normals  70.0%
Isovalue: 0.0  Stage: Building quads  80.0%
Isovalue: 0.0  Stage: Building faces  90.0%
Isovalue: 0.0  Stage: Finished  100.0%