Skip to main content

Crate energyml_section

Crate energyml_section 

Source
Expand description

The section view - long and cross sections of a model along a trace.

ADR-0015 is this crate’s specification: every non-trivial choice in the code follows the decision recorded there.

§Three stages, three costs

inputs ──► read (per package) ──► assemble ──► Catalogue      expensive, cached
                                                │
                                      View ──► layout ──► Layout ──► svg::write
  1. read::contribution reads one package’s objects - wells, surfaces, grids - reprojected into the scene’s system and cut along every section trace. It is the only stage that touches a store.
  2. assemble::assemble joins the contributions of every package into a model::Catalogue: wells projected on each section, frames and trajectories of one wellbore folded into one line, every object’s fate.
  3. layout::layout turns a catalogue and a model::View into a layout::Layout - scales, ticks, fills, labels, all in numbers - and svg::write writes it. Nothing is read or recomputed here: the front end redraws on every view change, the export draws the same view.

The same split as energyml-sheet (Board → layout → svg::write), the precedent of a drawing computed in Rust.

§No native dependency

wasm is a hard requirement (see ADR-0007): everything here is computation over a ValueSource, and the SVG is a String.

Modules§

assemble
From every package’s contribution to the catalogue (ADR-0015).
crosses
The traces of every section: the long one, and its cross sections (ADR-0015; fence::crosslines generalised).
erosion
Erosions suspected from the surfaces’ ages (ADR-0015): detect erosions from the ages of the surfaces, propose local corrections or suggestions of corrections when something is wrong, and colour the portions identified as erosions).
inputs
Checking the inputs before anything is read (ADR-0015).
layout
A catalogue and a view, laid out in numbers (ADR-0015).
markers
The markers a section can carry, declared - the shapes read from the model, the places listed (ADR-0015).
model
The data of the section view - what goes in, what one package gives, what the calculation answers, and how it is looked at.
paint
What the front end’s scene paints along an object, laid on a section (View::paints, View::joints) - the resolver the front end supplies; without a paint, layout draws as before (the default resolver).
panels
The section fills, put back on the trace - the coloured panels of the 3D view (ADR-0015).
png
A section view as a PNG - the SVG rendered in Rust (the font is embedded, and resvg is an optional dependency whose absence returns an error saying it has to be installed).
read
What one package gives the calculation (ADR-0015).
spatial
A static R-tree over 2D boxes, with an overflow list for what is added after the build (ADR-0010).
style
The styles the portions of a well with no strata information can be drawn in, declared (several styles are offered: fixed colour, texture, dashes…, and the front end must adapt dynamically to the styles proposed).
svg
A layout written as SVG (ADR-0015).

Structs§

Opened
One package handed to compute_packages: the store id its objects are asked under (Asked::store), where they are read, what the face already knows of it, and - when the face keeps one - its cache.

Enums§

RedrawError
Why a drawing could not be made again.

Functions§

compute
The whole calculation for one call: the sections’ traces, one contribution per package - read by read_one, which is the face’s, since only the face holds the packages - and the catalogue.
compute_packages
The whole calculation over one or several packages, each with its own selection (Inputs::objects, one Asked per package): every package read through its cache, the contributions merged by assemble::assemble into one catalogue - the wells of all packages projected on the same sections, their surfaces cut along the same traces, in the scene’s one system.
draw
A catalogue drawn for a view: layout::layout then svg::write - what the screen, the download, the CLI and the package all call (one drawer, so the export is what was shown).
redraw
A drawing made again from what its own metadata says it was made of - the inputs and the view - over the packages given (--from-svg).