cheatah
Class

space::irbem::FieldContext

cheatah-space v0.1.0-alpha — Biome Standard 0.6.5-alpha

Everything a field evaluation needs to know about when it is, and nothing about where.

Immutable by construction: the data are private, every accessor is const, there are no setters and the constructor is private, so the only way to obtain one is make_field_context and the only contexts that exist are validated ones. Nothing in it can record what the previous evaluation found, which is precisely the affordance IRBEM's COMMON blocks provide and precisely why they cannot be threaded.

Immutability is spelled "private data plus const accessors" rather than const data members on purpose: const members would delete copy assignment and make the type useless in an ephemeris buffer, while preventing nothing that is not already prevented.

Trivially copyable and standard layout, so memcpy into a mapped uniform buffer is a valid way to hand it to a GPU, and passing it by value between CPU workers costs a copy of about a kilobyte and no indirection.

Functions

fn const HotState & hot() const noexcept #

The inner loop's block — tilt, precomputed trigonometry, the five universal drivers, and the GEO<->GSM rotation pair.

Returns

a reference into this context; it lives exactly as long as the context does.

Complexity

O(1).

Allocation

none.

fn const Epoch & epoch() const noexcept #

The instant this context is for.

Returns

the validated epoch.

Complexity

O(1).

Allocation

none.

fn const DriverSet & drivers() const noexcept #

The whole maginput vector, in IRBEM's order, reserved slots included.

Returns

all 25 drivers.

Complexity

O(1).

Allocation

none.

fn double driver(Driver d) const noexcept #

One named driver.

Parameters
d

which driver; Driver's enumerators are the zero-based maginput subscripts.

Returns

its value, in the unit Driver documents.

Complexity

O(1).

Allocation

none.

fn const fixarray::mat3d & rotation_to_geo() const noexcept #

The stored matrix taking F's components to GEO — no arithmetic, just the table entry.

Template parameters
F

the source frame; Cartesian, since an angular frame is not related to anything by a rotation.

Returns

a reference to the matrix M_F for which v_GEO = M_F * v_F.

Complexity

O(1).

Allocation

none.

fn fixarray::mat3d rotation() const noexcept #

The rotation taking From's components to To's, composed through the GEO hub.

The three cases that cost nothing — a frame to itself, anything to GEO, GEO to anything — are chosen at compile time, so only a genuine cross pair such as GSE->SM pays a matrix product. A rotation's inverse is its transpose, which is why the GEO-to-anything case is a transpose and not a solve.

Template parameters
From

the source frame; Cartesian.

To

the destination frame; Cartesian.

Returns

the matrix R for which v_To = R * v_From.

Complexity

O(1); at most one 3x3 product.

Allocation

none.

fn rotate · 2 overloads
Position< To > rotate(Position< From > p) const noexcept#
FieldVector< To > rotate(FieldVector< From > b) const noexcept#

Re-express a position in another frame.

This applies a rotation and only a rotation, so it is defined between Cartesian frames alone. Converting to or from GDZ, SPH or RLL is not a rotation — it involves the reference ellipsoid or a Cartesian-to-angular change of variables — and belongs to the coordinate transform module, not here.

Template parameters
To

the destination frame; Cartesian.

From

the source frame; Cartesian, deduced from p.

Parameters
p

the position, in Earth radii.

Returns

the same point, tagged with and expressed in To.

Complexity

O(1).

Allocation

none.

fn FieldContext(const Epoch &epoch, double tilt_rad, const RotationTable &to_geo, const DriverSet &drivers) #

Assemble the state.

Private: the inputs are assumed already validated by make_field_context, which is the only caller.

Parameters
epoch

the instant.

tilt_rad

the geodipole tilt, radians.

to_geo

the rotations, per RotationTable. drivers all 25 maginput slots.

Complexity

O(1) — two transcendentals and a fixed number of copies, once per epoch.

Allocation

none.

Constants & variables

var HotState hot_ #

The inner loop's cache line and rotation pair.

var ColdState cold_ #

Everything read at most once per evaluation.