-
Notifications
You must be signed in to change notification settings - Fork 66
What do expressions look like?
This is a scratch pad for the types of expressions we want to support.
An expression that reduces to a single variable. Example types:
- bool (stored as an integer)
- integer
- double
- vec3
Ex
Queries compute the result of an expression and stores the result into an identifier that can be accessed by other queries or triggers. This result can be any supported types (e.g., scalars or something more complex like a histogram). These named identifiers can serve as the building blocks for more complicated expressions.
Triggers evaluate an expression that results in a boolean value.
If true
, a set of Ascent actions are executed.
Since queries and triggers are actions within ascent, they execute many times during a simulation run, and with that comes a time history of each query that can be accessed.
- bool:
max("pressure") > 10.0
- integer:
1 + 1
- double:
pow(1.0,0.5)
,magnitude(vec3(1.0, 2.0, 3.0) - coordinate(max("pressure")))
- vec3:
coordinate(max("pressure"))
-
compile time
: This is a 2-phase pass- parse the text and create AST.
-
build_graph
ie, create the flow graph that we can execute.
-
runtime
: execution of the flow graph
There are types. We try to detect type mismatches at "compile time", but some are deferred to "run time".
Any function can return an object(scalar or more complex type) that has attributes. We provide functions to access attributes, like the history function, Example attributes:
- History: named identifiers are evaluated each execution and we store the time history.
- Location: mesh queries can return the spatial location of the result.
max("pressure")
has a location
Special type any_type
for functions that look for attributes and anything else we can think of.