aboutsummaryrefslogtreecommitdiffstats
path: root/subsurface-core/gaspressures.c
AgeCommit message (Collapse)Author
2016-03-09Silence warnings in gaspressures.cGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-08Silence warnings in gaspressures.cGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-03-07Silence warnings in gaspressures.cGravatar Tomaz Canabrava
Signed-off-by: Tomaz Canabrava <tomaz.canabrava@gmail.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: incrementally update interpolation dataGravatar Linus Torvalds
Instead of re-calculating all the interpolation data for each plot entry (which means that we have a quadratic algorithm that walks over all the plot-info points for each plot-info point), we can just update it incrementally within any particular interpolation segment. The previous cleanups made the code sane enough to understand, and makes it trivial to see how you don't have to recalculate the full thing. This gets rid of the O(n**2) algorithm, and it instead becomes O(n*m) where 'n' is the number of plot entries, and 'm' is the number of gas segments (which is usually a much smaller numer, typically "1"). Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: further code simplificationGravatar Linus Torvalds
With the two bigger simplications, this just re-organizes the code to do the "interpolate.pressure_time" update that is shared among all the "after segment start" cases in just one place. That leaves the get_pr_interpolate_data() much simpler, and makes it much clearer what it actually does. In particular, it becomes very obvious that "interpolate.pressure_time" is constant for one particular segment (it's the total pressure time), and that "interpolate.acc_pressure_time" is the one that gets updated for every entry. The next step is to only call this for the first entry, and then update just the "acc_pressure_time" in the caller. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: simplify codeGravatar Linus Torvalds
Getting rid of the pointless always-zero pressure now makes it obvious how some of the remaining code can just be removed too: there is no point in re-initializing the pressure_time entries to zero at the segment start, because they started out zero and we just checked that we don't do anything to them before we hit the segment start. Similarly, now that the silly pressure testing is gone, it is obvious that the code for "i < cur" and "i == curr" cases is identical, and the two cases can just be collapsed. Signed-off-by: Linus Torvalds <torvalds@ linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-21pressure interpolation: get rid of pointless and confusing codeGravatar Linus Torvalds
In the function fill_missing_tank_pressures(), we only ever call get_pr_interpolate_data() if "pressure" is zero. So passing it in as an argument, and then testing whether it is zero or not, is just totally pointless, and only obfuscates things. This whole thing seems to be due to people editing the code over time, with the tests becoming superfluous as the code around it changed, and nobody looking at whether it actually made sense any more. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2016-02-07Don't run time consuming gas interpolation without any dataGravatar Dirk Hohndel
If the user hasn't set any pressures at all there is no point in trying to interpolate all these data. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2015-10-30Move all core-functionality to subsurface-coreGravatar Tomaz Canabrava
And adapt a new CMakeLists.txt file for it. On the way I've also found out that we where double-compilling a few files. I've also set the subsurface-core as a include_path but that was just to reduce the noise on this commit, since I plan to remove it from the include path to make it obligatory to specify something like include "subsurface-core/dive.h" for the header files. Since the app is growing quite a bit we ended up having a few different files with almost same name that did similar things, I want to kill that (for instance Dive.h, dive.h, PrintDive.h and such). Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>