Some unification between Buehlmann and VPM-B

This patch makes deco_allowed_depth() work both for Buehlmann as well as
VPM-B (as long as the VPM-B internal variable total_gradient[] is valid).
As a bonus, in VPM-B mode, in the planner, the ceilings are VPM-B ceilings
and not Buehlmann GF.

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2015-08-12 12:06:52 +02:00 committed by Dirk Hohndel
parent 2455a5dec7
commit a8ce8c3ef1
5 changed files with 54 additions and 51 deletions

View file

@ -33,6 +33,14 @@ int decostoplevels_imperial[] = { 0, 3048, 6096, 9144, 12192, 15240, 18288, 2133
double plangflow, plangfhigh;
bool plan_verbatim, plan_display_runtime, plan_display_duration, plan_display_transitions;
/* This is a bit round about: Currently, we only support VPM-B in the planner,
* so, when we compute ceilings we have to know if we are in planning mode since
* the maximally allowed gradient in the tissues is determined by the critical volume algorithm for
* which we currently have no version for logged dives. But the information about the application state
* is only available in the C++/Qt part. So this global variable is a way to leak this info. */
bool in_planner = false;
const char *disclaimer;
#if DEBUG_PLAN
@ -879,15 +887,11 @@ bool trial_ascent(int trial_depth, int stoplevel, int avg_depth, int bottom_time
tissue_tolerance = add_segment(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0,
gasmix,
TIMESTEP, po2, &displayed_dive, prefs.decosac);
if (prefs.deco_mode != VPMB && deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) {
if (deco_allowed_depth(tissue_tolerance, surface_pressure, &displayed_dive, 1) > trial_depth - deltad) {
/* We should have stopped */
clear_to_ascend = false;
break;
}
if (prefs.deco_mode == VPMB && (!is_vpmb_ok(depth_to_mbar(trial_depth, &displayed_dive) / 1000.0))){
clear_to_ascend = false;
break;
}
trial_depth -= deltad;
}
restore_deco_state(trial_cache);