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:
  • x (list [numpy.ndarray], of shape [(nx,), (ny,), …]) – List of grid vectors

  • dx (list [numpy.ndarray] or None, optional) – Basis in which to expand mesh, default is the canonical basis

  • dtype (str or None, optional) – String representing the numpy type of output, default inherits from x

Returns:

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

Return type:

numpy.ndarray [dtype], (x[0].size, x[1].size, …, len(x))