Interface Methods#
All different solvers can be generated using the interface class. Note that if you specify the gpu interface, but your system does not support it (or you did not install it), you will only get a cpu solver.
- static FIMPY.create_fim_solver(points: numpy.ndarray, elems: numpy.ndarray, metrics: typing.Optional[numpy.ndarray] = None, precision=<class 'numpy.float32'>, device='gpu', use_active_list=True) fimpy.fim_base.FIMBase#
Creates a Fast Iterative Method solver for solving the anisotropic eikonal equation
\[\begin{split}\left\{ \begin{array}{rll} \left<\nabla \phi, D \nabla \phi \right> &= 1 \quad &\text{on} \; \Omega \\ \phi(\mathbf{x}_0) &= g(\mathbf{x}_0) \quad &\text{on} \; \Gamma \end{array} \right. .\end{split}\]- Parameters
points (Union[np.ndarray (float), cp.ndarray (float)]) – Array of points, \(n \times d\)
elems (Union[np.ndarray (int), cp.ndarray (int)]) – Array of elements, \(m \times d_e\)
metrics (Union[np.ndarray (float), cp.ndarray (float)], optional) – Specifies the initial \(D \in \mathbb{R}^{d \times d}\) tensors. If not specified, you later need to provide them in
comp_fim, by default Noneprecision (np.dtype, optional) – precision of all calculations and the final result, by default np.float32
device (str, optional) – Specifies the target device for the computations. One of [cpu, gpu], by default ‘gpu’
use_active_list (bool, optional) – If set to true, you will get an active list solver that only computes the necessary subset of points in each iteration. If set to false, a Jacobi solver will be returned that updates all points of the mesh in each iteration. By default True
- Returns
Returns a Fast Iterative Method solver
- Return type
FIMBase
Computing the anisotropic eikonal equation can be easily achieved by calling fimpy.fim_base.FIMBase.comp_fim() on the returned solver.
- FIMBase.comp_fim(x0, x0_vals, metrics=None, max_iterations=10000000000)#
Computes the solution \(\phi\) to the anisotropic eikonal equation
\[\begin{split}\left\{ \begin{array}{rll} \left<\nabla \phi, D \nabla \phi \right> &= 1 \quad &\text{on} \; \Omega \\ \phi(\mathbf{x}_0) &= g(\mathbf{x}_0) \quad &\text{on} \; \Gamma \end{array} \right. .\end{split}\]- Parameters
x0 (ndarray (int)) – Array of [k] discrete point indices of the mesh where we prescribe initial values \(\mathbf{x}_0\).
x0_vals (ndarray (float)) – Array of [k] discrete prescribed initial values that prescribe \(g(\mathbf{x}_0)\).
metrics (np.ndarray(float), optional) – Specifies the tensor \(D\) of the anisotropic eikonal equation as a discrete [m, d, d] array. This is optional only if you specified the metrics already at construction time (
FIMBase), by default Nonemax_iterations (int, optional) – Maximum number of iterations before aborting the algorithm. If the algorithm stops before reaching convergence, some vertices might still be set to
undef_val. By default int(1e10)
- Returns
The solution to the anisotropic eikonal equation, \(\phi\) as a [n] array.
- Return type
ndarray (float, cupy or numpy)