TensorMesh¶
-
class
emg3d.meshes.
TensorMesh
(h=None, origin=None, **kwargs)[source]¶ Bases:
discretize.tensor_mesh.TensorMesh
,emg3d.meshes._TensorMesh
A slightly modified
discretize.TensorMesh
.Adds a few attributes (__eq__, copy, to_dict, and from_dict) to the
discretize.TensorMesh
.Falls back to a minimal TensorMesh if discretize is not installed. Nothing fancy is possible with the minimal TensorMesh, particularly NO plotting nor nice repr-functions.
Parameters: - h : list of three ndarrays
Cell widths in [x, y, z] directions.
- x0 : tuple of length 3
Origin (x, y, z).
- **Required Properties:**
- * **axis_u (
Vector3
): Vector orientation of u-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: X** - * **axis_v (
Vector3
): Vector orientation of v-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: Y** - * **axis_w (
Vector3
): Vector orientation of w-direction. For more details see the docs for therotation_matrix
property., a 3D Vector of <class ‘float’> with shape (3), Default: Z** - * **h (a tuple of
Array
): h is a list containing the cell widths of the tensor mesh in each dimension., a tuple (each item is a list or numpy array of <class ‘float’> with shape (*)) with length between 1 and 3** - * **origin (
Array
): origin of the mesh (dim, ), a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*)** - * **reference_system (
String
): The type of coordinate reference frame. Can take on the values cartesian, cylindrical, or spherical. Abbreviations of these are allowed., a unicode string, Default: cartesian**
Methods Summary
copy
()Return a copy of the TensorMesh. from_dict
(inp)Convert dictionary into TensorMesh
instance.to_dict
([copy])Store the necessary information of the TensorMesh in a dict. Methods Documentation
-
classmethod
from_dict
(inp)[source]¶ Convert dictionary into
TensorMesh
instance.Parameters: - inp : dict
Dictionary as obtained from
TensorMesh.to_dict()
. The dictionary needs the keys hx, hy, hz, and x0.
Returns: - obj :
TensorMesh
instance