Skip to content

Progress & Events

ferreus_rbf.progress.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.

Callback types

ProgressEvent is an exported marker class. Callbacks receive one of the concrete payload classes above, rather than an instance of this marker. ProgressCallback describes the callback signature in type annotations.

ferreus_rbf.progress.ProgressEvent

Marker exported by the extension; callbacks receive the concrete payload classes above.

ferreus_rbf.progress.ProgressCallback = Callable[[Union[SolverIteration, DuplicatesRemoved, SurfacingProgress, Message]], None] module-attribute

Callable accepting a concrete event payload and returning None.

Example use:

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

# Create a function to handle each concrete payload type
def on_progress(event: Union[DuplicatesRemoved, SolverIteration, SurfacingProgress, Message]) -> 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: Projecting seeds  0.0%
Isovalue: 0.0  Stage: Expanding wavefront  5.0%
Isovalue: 0.0  Stage: Clustering vertices  70.0%
Isovalue: 0.0  Stage: Building facets  82.0%
Isovalue: 0.0  Stage: Cleaning mesh  94.0%
Isovalue: 0.0  Stage: Boundary closure  97.0%
Isovalue: 0.0  Stage: Finished  100.0%