mammos_mumag.mesh#

Mesh functions.

Functions

find_mesh([mesh_name])

Find available meshes matching given name.

get_mesh_json()

Load mesh JSON file.

Classes

Mesh

Mesh class.

class mammos_mumag.mesh.Mesh[source]#

Mesh class.

This class supports both local mesh (i.e. found on disk and defined by the user) and remote meshes stored on Zenodo. The Zenodo URL is found in the README.json and a list of all available meshes is found using find_mesh().

name#
  • If local mesh, path to the file.

  • If remote mesh, its name is as it appears on the Zenodo record or in the README.json.

info#

dictionary of available information about the mesh. If the mesh is local, this dictionary is initialized with the couple “description”: “User defined mesh.”.

__init__(mesh_name)[source]#

Initialize Mesh.

  • The input mesh_name is initially understood as a location and tried for matches on disk. If such file exists, the mesh is intended as local.

  • Otherwise, mesh_name is given to find_mesh() for matches in the Zenodo record. If multiple matches are found, the initialization will return an error.

Parameters:

mesh_name (str | Path) – Location of local mesh or name of remote mesh.

Raises:
  • RuntimeError – Multiple matches found in the Zenodo record.

  • RuntimeError – No match found, either local or remote.

write(dest)[source]#

Write mesh to destination.

Parameters:

dest (Path | str)

Return type:

None

mammos_mumag.mesh.find_mesh(mesh_name=None)[source]#

Find available meshes matching given name.

Parameters:

mesh_name (str | None) – Desired mesh name. If None, returns all available meshes.

Returns:

List of matches with given name. Empty list if no matches are found.

Return type:

list[str]

mammos_mumag.mesh.get_mesh_json()[source]#

Load mesh JSON file.