8.3. pyafv.FiniteVoronoiSimulator
- class FiniteVoronoiSimulator(pts, phys, backend=None)[source]
Simulator for the active finite Voronoi (AFV) model.
This class provides an interface to simulate the finite Voronoi model. It wraps around the two backend implementations, which may be either a Cython-accelerated version or a pure Python fallback.
- Parameters:
pts (ndarray) – (N,2) array of initial cell center positions.
phys (PhysicalParams) – Physical parameters used within this simulator.
backend (Literal['cython', 'python'] | None) – Optional, specify “python” to force the use of the pure Python fallback implementation. Otherwise, the “cython” backend is used.
- Raises:
ValueError – If pts does not have shape (N,2).
TypeError – If phys is not an instance of
PhysicalParams.
Warning
If the Cython backend cannot be imported (unless backend is set to “python”), a RuntimeWarning is raised and the pure Python implementation is used instead.
Attributes
Preferred areas \(\{A_{0,i}\}\) for all cells (read-only).
Methods
build([connect])Build the finite Voronoi structure and compute forces, returning a dictionary of diagnostics.
plot_2d([ax, show])Build the finite Voronoi structure and render a 2D snapshot.
update_params(phys)Update physical parameters.
update_positions(pts[, A0])Update cell center positions.
Update the preferred areas for all cells.
_build_voronoi_with_extensions([joggle])Build standard Voronoi structure for current points.
_per_cell_geometry(vor, vertices_all, ...)Build the finite Voronoi per-cell geometry and energy contributions.