helpers.transfer_helper module¶
- border_padding(grid, l, r, pad_type='mirror')[source]¶
Function to pad/embed an array at the boundaries
- Parameters:
grid (np.npdarray) – the input array
l – left boundary
r – right boundary
pad_type – type of padding
- Returns:
the padded array
- Return type:
np.npdarray
- continue_periodic_array(arr, nn)[source]¶
Function to append an array for nn neighbors for periodicity
- Parameters:
arr (np.ndarray) – the input array
nn (list) – the neighbors
- Returns:
the continued array
- Return type:
np.ndarray
- interpolation_matrix_1d(fine_grid, coarse_grid, k=2, periodic=False, pad=1, equidist_nested=True)[source]¶
Function to contruct the restriction matrix in 1d using barycentric interpolation
- Parameters:
fine_grid (np.ndarray) – a one dimensional 1d array containing the nodes of the fine grid
coarse_grid (np.ndarray) – a one dimensional 1d array containing the nodes of the coarse grid
k (int) – order of the restriction
periodic (bool) – flag to indicate periodicity
pad (int) – padding parameter for boundaries
equidist_nested (bool) – shortcut possible, if nodes are equidistant and nested
- Returns:
interpolation matrix
- Return type:
sprs.csc_matrix
- next_neighbors(p, ps, k)[source]¶
Function to find the next neighbors for a non-periodic setup
This function gives for a value p the k points next to it which are found in in the vector ps
- Parameters:
p – the current point
ps (np.ndarray) – the grid with the potential neighbors
k (int) – number of neighbors to find
- Returns:
the k next neighbors
- Return type:
list
- next_neighbors_periodic(p, ps, k)[source]¶
Function to find the next neighbors for a periodic setup
This function gives for a value p the k points next to it which are found in in the vector ps and the points which are found periodically.
- Parameters:
p – the current point
ps (np.ndarray) – the grid with the potential neighbors
k (int) – number of neighbors to find
- Returns:
the k next neighbors
- Return type:
list
- restriction_matrix_1d(fine_grid, coarse_grid, k=2, periodic=False, pad=1)[source]¶
Function to contruct the restriction matrix in 1d using barycentric interpolation
- Parameters:
fine_grid (np.ndarray) – a one dimensional 1d array containing the nodes of the fine grid
coarse_grid (np.ndarray) – a one dimensional 1d array containing the nodes of the coarse grid
k (int) – order of the restriction
periodic (bool) – flag to indicate periodicity
pad (int) – padding parameter for boundaries
- Returns:
restriction matrix
- Return type:
sprs.csc_matrix