Having a data construct that handles loading transparently, the results could be cached at the level of the data construct.
E.g. when data.fluids["gas"].get("2d", "mass density", 0) is called, the result of the call could be cached. On a second call with the same query information (e.g. when calculating the difference to the initial values for all outputs) the cached data could be used instead of having to load it again.
A good place to implement such a caching mechanism might be at the level of the get function inside Scalar and Field. Using a wrapper, the caching could be transparently handled and calls to the get functions could be analyzed as to whether there is a cached result already present or not.
Having a data construct that handles loading transparently, the results could be cached at the level of the data construct.
E.g. when
data.fluids["gas"].get("2d", "mass density", 0)is called, the result of the call could be cached. On a second call with the same query information (e.g. when calculating the difference to the initial values for all outputs) the cached data could be used instead of having to load it again.A good place to implement such a caching mechanism might be at the level of the
getfunction insideScalarandField. Using a wrapper, the caching could be transparently handled and calls to thegetfunctions could be analyzed as to whether there is a cached result already present or not.