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
The inner loop's block — tilt, precomputed trigonometry, the five universal drivers, and the GEO<->GSM rotation pair.
a reference into this context; it lives exactly as long as the context does.
O(1).
none.
The instant this context is for.
the validated epoch.
O(1).
none.
The whole maginput vector, in IRBEM's order, reserved slots included.
all 25 drivers.
O(1).
none.
One named driver.
The stored matrix taking F's components to GEO — no arithmetic, just the table entry.
F | the source frame; Cartesian, since an angular frame is not related to anything by a rotation. |
a reference to the matrix M_F for which v_GEO = M_F * v_F.
O(1).
none.
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.
From | the source frame; Cartesian. |
To | the destination frame; Cartesian. |
the matrix R for which v_To = R * v_From.
O(1); at most one 3x3 product.
none.
rotate · 2 overloads
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.
To | the destination frame; Cartesian. |
From | the source frame; Cartesian, deduced from |
p | the position, in Earth radii. |
the same point, tagged with and expressed in To.
O(1).
none.
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.
epoch | the instant. |
tilt_rad | the geodipole tilt, radians. |
to_geo | the rotations, per RotationTable. drivers all 25 |
O(1) — two transcendentals and a fixed number of copies, once per epoch.
none.
Constants & variables
The inner loop's cache line and rotation pair.
Everything read at most once per evaluation.
