to_mesh#

diffsims.utils.generic_utils.to_mesh(x, dx=None, dtype=None)[source]#
Generates dense meshes from grid vectors, broadly:

to_mesh(x)[i,j,…] = (x[0][i], x[1][j], …)

Parameters:
xlist [numpy.ndarray], of shape [(nx,), (ny,), …]

List of grid vectors

dxlist [numpy.ndarray] or None, optional

Basis in which to expand mesh, default is the canonical basis

dtypestr or None, optional

String representing the numpy type of output, default inherits from x

Returns:
Xnumpy.ndarray [dtype], (x[0]:obj:.size, x[1]:obj:.size, …, len(x))

X[i,j,…, k] = x[0][i]*dx[0][k] + x[1][j]*dx[1][k] + …