Update some type info

This commit is contained in:
Jan Petykiewicz 2020-01-06 00:08:08 -08:00
parent f408689ef3
commit dcc9e7c2ad
2 changed files with 11 additions and 8 deletions

View File

@ -8,20 +8,20 @@ Fields, Functions, and Operators
Discrete fields are stored in one of two forms: Discrete fields are stored in one of two forms:
- The `field_t` form is a multidimensional `numpy.ndarray` - The `fdfield_t` form is a multidimensional `numpy.ndarray`
+ For a scalar field, this is just `U[m, n, p]`, where `m`, `n`, and `p` are + For a scalar field, this is just `U[m, n, p]`, where `m`, `n`, and `p` are
discrete indices referring to positions on the x, y, and z axes respectively. discrete indices referring to positions on the x, y, and z axes respectively.
+ For a vector field, the first index specifies which vector component is accessed: + For a vector field, the first index specifies which vector component is accessed:
`E[:, m, n, p] = [Ex[m, n, p], Ey[m, n, p], Ez[m, n, p]]`. `E[:, m, n, p] = [Ex[m, n, p], Ey[m, n, p], Ez[m, n, p]]`.
- The `vfield_t` form is simply a vectorzied (i.e. 1D) version of the `field_t`, - The `vfdfield_t` form is simply a vectorzied (i.e. 1D) version of the `field_t`,
as obtained by `meanas.fdmath.vectorization.vec` (effectively just `numpy.ravel`) as obtained by `meanas.fdmath.vectorization.vec` (effectively just `numpy.ravel`)
Operators which act on fields also come in two forms: Operators which act on fields also come in two forms:
+ Python functions, created by the functions in `meanas.fdmath.functional`. + Python functions, created by the functions in `meanas.fdmath.functional`.
The generated functions act on fields in the `field_t` form. The generated functions act on fields in the `fdfield_t` form.
+ Linear operators, usually 2D sparse matrices using `scipy.sparse`, created + Linear operators, usually 2D sparse matrices using `scipy.sparse`, created
by `meanas.fdmath.operators`. These operators act on vectorized fields in the by `meanas.fdmath.operators`. These operators act on vectorized fields in the
`vfield_t` form. `vfdfield_t` form.
The operations performed should be equivalent: `functional.op(*args)(E)` should be The operations performed should be equivalent: `functional.op(*args)(E)` should be
equivalent to `unvec(operators.op(*args) @ vec(E), E.shape[1:])`. equivalent to `unvec(operators.op(*args) @ vec(E), E.shape[1:])`.

View File

@ -29,12 +29,15 @@ dx_lists_t = List[List[numpy.ndarray]]
''' '''
'dxes' datastructure which contains grid cell width information in the following format: 'dxes' datastructure which contains grid cell width information in the following format:
[[[dx_e_0, dx_e_1, ...], [dy_e_0, ...], [dz_e_0, ...]], [[[dx_e[0], dx_e[1], ...], [dy_e[0], ...], [dz_e[0], ...]],
[[dx_h_0, dx_h_1, ...], [dy_h_0, ...], [dz_h_0, ...]]] [[dx_h[0], dx_h[1], ...], [dy_h[0], ...], [dz_h[0], ...]]]
where `dx_e_0` is the x-width of the `x=0` cells, as used when calculating dE/dx, 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. and `dy_h[0]` is the y-width of the `y=0` cells, as used when calculating dH/dy, etc.
''' '''
fdfield_updater_t = Callable[[fdfield_t], fdfield_t] fdfield_updater_t = Callable[[fdfield_t], fdfield_t]
'''
Convenience type for functions which take and return an fdfield_t
'''