spectral_galerkin_heat.core.vector

Immutable 3-component value type for coordinate triples.

Vec3 groups the (x, y, z) scalar triples used throughout the geometry and state-construction code (domain size, mesh counts, grid spacing).

Classes

Vec3

An immutable (x, y, z) triple of scalars.

Module Contents

class spectral_galerkin_heat.core.vector.Vec3

An immutable (x, y, z) triple of scalars.

Iterable (so a, b, c = v and zip(v, w) work) and supports element-wise division for the common size / n -> spacing idiom.

Variables:

z (x, y,) – The three components, in natural (x, y, z) order.

Examples

>>> size = Vec3(4.0, 2.0, 1.0)
>>> n = Vec3(8, 4, 2)
>>> tuple(size / n)
(0.5, 0.5, 0.5)
>>> tuple(n.zyx())
(2, 4, 8)
zyx()

Return the triple reversed to (z, y, x), the array-index order.

Arrays in the solver are indexed [z, y, x].

Return type:

Vec3

map(f)

Return a new Vec3 with f applied to each component.

Parameters:

f (collections.abc.Callable[[Number], Number])

Return type:

Vec3