aboutsummaryrefslogtreecommitdiffstats
path: root/core/qthelper.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/qthelper.cpp')
-rw-r--r--core/qthelper.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index b9698e6b8..e6a4e056a 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -1710,3 +1710,21 @@ char *intdup(int index)
tmpbuf[20] = 0;
return strdup(tmpbuf);
}
+
+QHash<int, double> factor_cache;
+
+extern "C" double cache_value(int tissue, int timestep, enum inertgas inertgas)
+{
+ int key = (timestep << 5) + (tissue << 1);
+ if (inertgas == HE)
+ ++key;
+ return factor_cache.value(key);
+}
+
+extern "C" void cache_insert(int tissue, int timestep, enum inertgas inertgas, double value)
+{
+ int key = (timestep << 5) + (tissue << 1);
+ if (inertgas == HE)
+ ++key;
+ factor_cache.insert(key, value);
+}