xmcd_projection.mesh

class xmcd_projection.mesh.Mesh(points, cells, parts=0)

Bases: object

Object for handling the GMSH .msh files information

edge_faces

Gets the faces of the tetra that are on the outside of the mesh

Returns

Faces on the edge of the mesh

Return type

(m,3) array

edge_points_indices

Indices of the points on the edges of the mesh

faces

Faces of the mesh

Returns

(n,3) array

classmethod from_file(file_path, parts=0, scale=1)

Create the object from file_path. Supports .msh files and .vtu files as exported by mumax.

Parameters
  • file_path (str) –

  • parts (int, optional) – Which parts to use. Defaults to 0.

  • scale (float, optional) – Scale for the coordinates. Defaults to 1.

Returns

Mesh

get_bounding_struct(fix=False)

STL file consisting of the faces on the edge of the mesh. If fix=True, uses trimesh to fix the normals of the faces.

static get_faces_from_tetra(tetra)
get_shuffle_indx(points)

Finds the indices such that points[shuffle_indx, :] = self.points.

This is only necessary when due to the file containing multiple parts, these get mixed up by the magnetization export when compared to the original mesh. These indices can be used to reshuffle the magnetisation: magnetisation = magnetisation[shuffle_indx, :]

Parameters

points ((n, 3) array) – Points to be shuffled.

Returns

Indices of the shuffled array

Return type

(n,) array

tetra

Tetrahedra of the mesh.

Returns

(n,4) array of point indices.

triangles

Triangles representing tetrahedra faces.

Returns

Points of triangles.

Return type

(n,3,3) array