RegularGridProlongator#

class emg3d.solver.RegularGridProlongator(cx, cy, x, y)[source]#

Bases: object

Prolongate field from coarse to fine grid.

This is a heavily modified and adapted version of scipy.interpolate.RegularGridInterpolator.

The main difference (besides the different signature and different pre-sets) is that this version allows to initiate an instance with the coarse and fine grids. This initialize will compute the required weights, and it has therefore only to be done once.

After this, interpolating values from the coarse to the fine grid can be carried out much faster.

Simplifications in comparison to scipy.interpolate.RegularGridInterpolator:

  • No sanity checks;

  • Only 2D data;

  • method='linear';

  • bounds_error=False;

  • fill_value=None.

It results in a speed-up factor of about 2, independent of grid size, for this particular case.

Parameters:
cx, cy, x, yndarray

The coordinates defining the coarse (cx, cy) and fine (x, y) grids.

Methods Summary

__call__(values)

Return values of coarse grid on fine grid locations.

Methods Documentation

__call__(values)[source]#

Return values of coarse grid on fine grid locations.

Parameters:
valuesndarray

Values corresponding to fine-grid (x/y) coordinates.

Returns:
resultndarray

Values corresponding to coarse-grid (cx/cy) coordinates.