API Reference
The API reference is organized into several categories:
- Core Types — The main cache types (
ConductivityEvaluatorCache,FIMCache). - Solver — The main solver entry point.
- Active List Management — Functions for managing the active list.
- Utilities — Helper functions for conductivity evaluation and caches reinitialization.
Core Types
FastIterativeMethod.ConductivityEvaluatorCache — Type
ConductivityEvaluatorCache{CC, T, QPT, ConductivityT}A cache wrapper that stores conductivity information and evaluation points.
Fields
cell_cache::CC— Optional cell cache for backend-specific implementations (e.g., Ferrite).quadtrature_points::QPT— Vector of 7 reference evaluation points used internally.conductivity::ConductivityT— Conductivity value or callable; designed to be extended by other packages/extensions.
Notes
The package provides a default implementation where cell_cache = Nothing and conductivity is a constant scalar. Other implementations can extend the evaluate, reinit!, and change_conductivity! functions for custom backends.
FastIterativeMethod.FIMCache — Type
FIMCache{T, CECT, ACT, V2CT}The main cache structure for the Fast Iterative Method solver. Holds mesh topology, field values, and state required to run solve!.
Fields
vertices::Vector{Vec{3, T}}— 3D vertex coordinates.cells::Vector{NTuple{4, Int}}— Cell connectivity (each cell contains 4 vertex indices).vertex_to_cell::V2CT— Mapping from vertex index to cell indices containing that vertex.active_list::ACT— Active list of vertices to be updated (seeinit_active_list).Φ::Vector{T}— Field values (typically arrival times) at each vertex; updated in-place bysolve!.can_reset::BitVector— Flag per vertex indicating whether Φ can be reset toInfduring initialization.conductivity_evaluator_cache::CECT—ConductivityEvaluatorCachemanaging conductivity evaluation.
Notes
Construct a FIMCache by specifying all fields. The package does not provide a high-level constructor because mesh setup varies by backend. See the documentation for usage examples.
See also solve!, reset!, ConductivityEvaluatorCache.
FastIterativeMethod.UniqueVector — Type
UniqueVector{VT}An active list implementation using a vector to store active vertex indices and a BitVector to track visited status. This provides ordered iteration over active vertices uniquely.
Fields
data::VT— Vector storing active vertex indices.isvisited::BitVector— Tracks which vertices have been added to active list.
See also init_active_list, BitVector.
Solver
FastIterativeMethod.solve! — Function
solve!(fim_cache::FIMCache, vertex_set=Set(eachindex(fim_cache.vertices)); ϵ=1e-6)Run the Fast Iterative Method solver on the given cache. Updates fim_cache.Φ in-place.
Arguments
fim_cache::FIMCache— The FIM cache containing mesh, field, and solver state.vertex_set— Optional set of vertex indices to solve for (defaults to all vertices).ϵ— Convergence tolerance (default:1e-6).
Notes
The solver modifies fim_cache.Φ and fim_cache.active_list in-place. Use reset! to reinitialize the cache before solving.
FastIterativeMethod.reset! — Function
Active List Management
FastIterativeMethod.init_active_list — Function
init_active_list(::Type{BitVector}, length::Int=0) -> BitVectorInitialize a BitVector-based active list of given length (all false initially).
Example
active = init_active_list(BitVector, 100)See also UniqueVector, make_vertex_active!, reset_active_list!.
init_active_list(::Type{UniqueVector{T}}, length::Int=0) -> UniqueVectorInitialize a UniqueVector-based active list of given length.
See also init_active_list(::Type{BitVector}, ...) , UniqueVector.
FastIterativeMethod.reset_active_list! — Function
reset_active_list!(active_list::Union{BitVector, UniqueVector})Reset the active list to an empty/false state.
See also init_active_list, make_vertex_active!.
FastIterativeMethod.make_vertex_active! — Function
make_vertex_active!(active_list::Union{BitVector, UniqueVector}, vertex::Int)Mark a vertex as active in the active list.
See also make_vertex_inactive!, isactive_condition, get_active_vertex.
FastIterativeMethod.make_vertex_inactive! — Function
make_vertex_inactive!(active_list::Union{BitVector, UniqueVector}, vertex::Int)Mark a vertex as inactive in the active list.
See also make_vertex_active!, isactive_condition.
FastIterativeMethod.isactive_condition — Function
isactive_condition(active_list::Union{BitVector, UniqueVector})Check whether the active list has any active vertices.
See also get_active_vertex.
FastIterativeMethod.get_active_vertex — Function
get_active_vertex(active_list::Union{BitVector, UniqueVector})Retrieve the next active vertex from the active list.
See also isactive_condition, make_vertex_active!.
Utilities
FastIterativeMethod.create_custom_quadrature_points — Function
create_custom_quadrature_points(indices)Generate 7 custom evaluation points on a reference tetrahedron based on vertex index permutation.
Arguments
indices— Vector/tuple of 4 vertex indices used to permute the reference coordinates.
Returns
A static vector of 7 Vec{3,Float64} evaluation points.
Notes
This function is used internally during FIM solve operations to compute conductivity-weighted distances. The 7 points include edge midpoints, face centroids, and the element centroid.
See also ConductivityEvaluatorCache, reinit!.
FastIterativeMethod.change_conductivity! — Function
change_conductivity!(conductivity_cache::ConductivityEvaluatorCache, val)Update the conductivity value in the cache. Designed to be overridden by backend-specific implementations (e.g., for Ferrite or Thunderbolt).
Notes
The default implementation raises an error for non-Nothing cell caches. Backends should override this function to handle conductivity updates appropriately.
See also ConductivityEvaluatorCache, evaluate.
FastIterativeMethod.reinit! — Function
reinit!(conductivity_cache::ConductivityEvaluatorCache, cell_id::Int) -> ConductivityEvaluatorCacheReinitialize the conductivity cache for a specific cell. Designed to be overridden by backend-specific implementations.
Notes
The default implementation for ConductivityEvaluatorCache{Nothing} is a no-op. Other backends should override this function to update internal cell-specific state.
See also ConductivityEvaluatorCache, evaluate.
reinit!(conductivity_cache::ConductivityEvaluatorCache{Nothing}, cell_id::Int)No-op reinitialize for the default constant-conductivity cache.
reinit!(fim_cache::FIMCache, cell_id::Int, active_vertex::Int) -> SVector{4, Int}Reinitialize FIM cache state for a given cell and active vertex. Returns the reordered vertex indices with the active vertex first.
Notes
This function updates the evqluation points and conductivity cache for the cell, and reorders vertices so the active vertex is at index 1.
FastIterativeMethod.evaluate — Function
evaluate(conductivity_cache::ConductivityEvaluatorCache{Nothing}, i::Int)Evaluate conductivity for the default constant-conductivity cache. Returns the stored conductivity value regardless of quadrature point index.
See also ConductivityEvaluatorCache, change_conductivity!.