[PATCH] Fix default gradient factor setting

Dirk Hohndel dirk at hohndel.org
Fri Jan 11 12:39:50 PST 2013

Linus Torvalds <torvalds at linux-foundation.org> writes:

> Testing the new "don't even bother saving default values" showed that the 
> default values for the deco gradient factors were undefined.
> Or rather, they were over-defined.
> We had defaults for the UI (30 and 75 for GFlow/GFhigh respectively - the 
> config ones are in percent), *and* we had defaults in deco.c for the deco 
> code itself (0.35 and 0.75 respectively - in deco.c they are represented 
> as fractions, not percent).

That is an overall issue with the deco code vs. the rest of Subsurface.

We operate in mm, mbar and percent and all in int. deco.c does most
everything in doubles and uses bar, fractions of 1). I decided not to
change the code in deco.c to try to do integer math and instead convert
at the 'API' level. And I think Robert seemed to agree that this was the
right way to do this.

The over definition is just part of this - the config values are defined
as fractions and at first weren't configurable. When I then added the UI
support I did the 'normal' thing and expressed them as percentage. Of
course the default should have been set only once. My mistake.

> And if the config entries had never been written, and were assumed to be 
> the defaults, the UI code thought the defaults were 30/75, but they had 
> never been *set* to those defaults, so actual default calculations 
> silently used the 35/75 in deco.c, which is very confusing (you could go 
> to the preferences page, see the 30/75 there, and it would not actually 
> match th evalues used for computation).

Ouch. Even worse.

Thanks for catching this.


More information about the subsurface mailing list