Project

EarthSciAST

The EarthSciML Abstract Syntax Tree format: schema, operators, coupling, and five language bindings.

Contents

This is the documentation for the older version v0.15.1. For the latest release, see v0.17.0.

materialize_value_invention

Stable function · Load-time lowering and templates

Tier: stable · Kind: function · Topic: Load-time lowering and templates

JuliaTypeScriptPythonRustGo
not exportednot exportedmaterialize_value_inventionmaterialize_value_inventionnot exported

Julia

Julia does not export this function.

TypeScript

TypeScript does not export this function.

Python

materialize_value_invention(model_json: Mapping[str, Any], const_arrays: Mapping[str, Any] | None = None, params: Mapping[str, Any] | None = None, const_array_boundaries: Mapping[str, Sequence[str]] | None = None, index_sets: Mapping[str, Any] | None = None) -> ValueInventionResult

Run the build-time value-invention engine over a raw model document.

const_arrays supplies the build-time factor arrays (the connectivity / coordinates the keys are computed from); params supplies scalar parameter overrides. A producer that classifies CONTINUOUS is rejected (§5.7 guard 2).

index_sets is the document-scoped index-set registry (RFC §5.2), which lives at the top level of the document rather than on each model — mirrors reference_resolution.build_reference_graph . When omitted it falls back to a model-local model_json["index_sets"] key, so a caller need not splice the document registry onto the model dict before calling.

const_array_boundaries optionally declares a per-const-array, per-dimension out-of-range gather policy: a mapping of array name → an iterable of per-dimension policy strings, each one of “periodic” | “clamp” | “error”. A const-array gather at an out-of-range 1-based index then resolves declaratively (“periodic” wraps via 1-based modulo, “clamp” edge-extends); any array WITHOUT a declared policy (or one with “error”) keeps raising a structured ValueInventionError , so genuine out-of-bounds bugs in connectivity / stencil-weight factors stay caught.

A no-op (empty result) for a model with no distinct producer — the evaluator front-door then behaves byte-identically to before.

Source

Rust

pub fn materialize_value_invention(model_json: &Value, const_arrays: &HashMap<String, ArrayD<f64>>, params: &HashMap<String, f64>, const_array_boundaries: &HashMap<String, Vec<BoundaryKind>>) -> Result<ValueInventionResult, ValueInventionError>

Run the build-time value-invention engine over a raw model document.

Value invention mints new entities from data, once at setup: unique edge IDs from a mesh, dense ranks from a categorical column, bin keys from coordinates. This evaluates every value-invention aggregate in model_json (a faq with distinct: true) and returns what it materialized as a ValueInventionResult . Pass that result to apply_value_invention to rewrite the model so the array runtime can compile it. A caller holding a typed model calls crate::simulate_array::run_value_invention instead.

  • model_json is a model object, with the document’s index_sets registry beside its variables and equations. It is read as a typed model; one with no equations has no producer.
  • const_arrays supplies the build-time factor arrays (connectivity, coordinates) the keys are computed from.
  • params supplies scalar parameter overrides.
  • const_array_boundaries optionally gives a per-array, per-dimension BoundaryKind for a gather at a 1-based index outside 1..=n (periodic wrap or edge clamp). An array absent from the map, or a dimension beyond its listed kinds, errors on an out-of-range index; pass an empty map for that everywhere.

A model with no distinct producer returns an empty result.

Errors

Returns a ValueInventionError when the model or its index sets do not read as typed ones, when a producer classifies as continuous (its entities would change every step, CONFORMANCE_SPEC.md §5.7 guard 2), when a key cannot be evaluated from the build-time data, or on an out-of-range gather with no boundary policy.

Source · Rust docs

Go

Go does not export this function.