bfieldtools.mesh_calculus.gradient_matrix

bfieldtools.mesh_calculus.gradient_matrix(mesh, rotated=False)

Calculate a (rotated) gradient matrix for hat basis functions (stream functions) in a mesh.

Parameters
mesh: Trimesh mesh object
rotated: boolean

If True, rotate gradient 90 degrees clockwise

Returns
3 sparse csr_matrices
Gx ,Gy, Gx (Ntris, Nverts) matrices

for calculating the components of gradient at triangles