meanas/meanas/fdmath/types.py

49 lines
1.3 KiB
Python
Raw Normal View History

2019-08-04 13:48:41 -07:00
"""
Types shared across multiple submodules
"""
2020-06-11 19:26:17 -07:00
from typing import Sequence, Callable, MutableSequence
import numpy # type: ignore
2019-08-04 13:48:41 -07:00
# Field types
2019-11-26 01:47:52 -08:00
# TODO: figure out a better way to set the docstrings without creating actual subclasses?
# Probably not a big issue since they're only used for type hinting
2019-11-27 22:59:52 -08:00
class fdfield_t(numpy.ndarray):
2019-11-26 01:47:52 -08:00
"""
Vector field with shape (3, X, Y, Z) (e.g. `[E_x, E_y, E_z]`)
This is actually is just an unaltered `numpy.ndarray`
"""
pass
2019-11-27 22:59:52 -08:00
class vfdfield_t(numpy.ndarray):
2019-11-26 01:47:52 -08:00
"""
Linearized vector field (single vector of length 3*X*Y*Z)
This is actually just an unaltered `numpy.ndarray`
"""
pass
2019-08-04 13:48:41 -07:00
2020-06-11 19:26:17 -07:00
dx_lists_t = Sequence[Sequence[numpy.ndarray]]
2019-08-04 13:48:41 -07:00
'''
'dxes' datastructure which contains grid cell width information in the following format:
2019-11-26 01:47:52 -08:00
2020-01-06 00:08:08 -08:00
[[[dx_e[0], dx_e[1], ...], [dy_e[0], ...], [dz_e[0], ...]],
[[dx_h[0], dx_h[1], ...], [dy_h[0], ...], [dz_h[0], ...]]]
2019-11-26 01:47:52 -08:00
2020-01-06 00:08:08 -08:00
where `dx_e[0]` is the x-width of the `x=0` cells, as used when calculating dE/dx,
and `dy_h[0]` is the y-width of the `y=0` cells, as used when calculating dH/dy, etc.
2019-08-04 13:48:41 -07:00
'''
2020-06-11 19:26:17 -07:00
dx_lists_mut = MutableSequence[MutableSequence[numpy.ndarray]]
'''
Mutable version of `dx_lists_t`
'''
2019-08-04 13:48:41 -07:00
2020-01-08 00:51:56 -08:00
fdfield_updater_t = Callable[..., fdfield_t]
2020-01-06 00:08:08 -08:00
'''
Convenience type for functions which take and return an fdfield_t
'''