TensorMesh#

class emg3d.meshes.TensorMesh(h, origin=None, **kwargs)[source]#

Bases: TensorMesh

A slightly modified version of discretize.TensorMesh.

Adds a few custom attributes (__eq__, copy, and {to;from}_dict) to discretize.TensorMesh.

It falls back to a minimal emg3d.meshes.BaseMesh if discretize is not installed. Nothing fancy is possible with the minimal TensorMesh, particularly no plotting.

Parameters:
h[array_like, array_like, array_like]

Cell widths in x, y, and z directions.

originarray_like

Origin (x, y, z).

Methods Summary

copy()

Return a copy of the TensorMesh.

from_dict(inp)

Convert dictionary into emg3d.meshes.TensorMesh instance.

to_dict([copy])

Store the necessary information in a dict for serialization.

Methods Documentation

copy()[source]#

Return a copy of the TensorMesh.

classmethod from_dict(inp)[source]#

Convert dictionary into emg3d.meshes.TensorMesh instance.

Parameters:
inpdict

Dictionary as obtained from emg3d.meshes.TensorMesh.to_dict. The dictionary needs the keys hx, hy, hz, and origin.

Returns:
meshTensorMesh

A emg3d.meshes.TensorMesh instance.

to_dict(copy=False)[source]#

Store the necessary information in a dict for serialization.

Parameters:
copybool, default: False

If True, returns a deep copy of the dict.

Returns:
outdict

Dictionary containing all information to re-create the TensorMesh.