mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Cache all Buehlmann factors
not just the last one. Signed-off-by: Robert C. Helling <helling@atdotde.de>
This commit is contained in:
parent
515b7b5fea
commit
456e2cec89
5 changed files with 43 additions and 33 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue