Deco calculation oddities..

Linus Torvalds torvalds at linux-foundation.org
Fri Feb 8 01:35:47 PST 2013


Robert (and others interested in the deco calculations), please
double-check me on this..

Since I did the no-fly code, and was looking at the effect of
GFlow/GFhigh, I noted some *serious* oddities in the deco code that
makes me go hmm..

In particular, the tissue_tolerated_ambient_pressure[] array seems
entirely pointless. It is a write-only array, and there is no reason
for it existing as far as I can tell. T\Yes, there is technically a
single reader, but that reader is *immediately* after the write to the
array, so the read of the array could just trivially be bypassed and
the value just taken from the calculation directly.

Similarly, the code saves/restores it in the deco_cache_state() and
deco_restore_state() functions as if it had some long-term meaning,
but it definitely does *not* have any such long-term use at all. So
somebody has been just confused.

I wonder if it was written that way for debugging purposes (ie you
want to see the arrays just while debugging the algorithm, even if the
algorithm itself doesn't use the data long-term), but as it is, it is
actively confusing.

In particular, it turns out that GF_low/high have absolutely *zero*
impact on the actual long-term deco calculations - they only matter
for the "convert deco state to a pressure tolerance and thus a depth",
but not for the state itself.

So as far as I can tell, the array should be removed, and replaced
with just a single variable in the loop that calculates the per-tissue
thing. Something like the attached patch.

Comments? Am I missing something? Where does that array come from, and
why was it done that way?

                    Linus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.diff
Type: application/octet-stream
Size: 4461 bytes
Desc: not available
URL: <http://lists.hohndel.org/pipermail/subsurface/attachments/20130208/38e3717c/attachment-0001.obj>


More information about the subsurface mailing list