diff options
author | Berthold Stoeger <bstoeger@mail.tuwien.ac.at> | 2021-02-12 17:47:52 +0100 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2021-02-17 07:26:55 -0800 |
commit | 8103e947aa80da275afe692bc19fa7bb88ccd033 (patch) | |
tree | 598ddd2116455308c9133561b5e8b2b01fba536d /core/deco.c | |
parent | 93ecad1b0413645ba59ffe2e50c3636d8673ccb5 (diff) | |
download | subsurface-8103e947aa80da275afe692bc19fa7bb88ccd033.tar.gz |
planner: pass in_planner argument to vpmb_next_gradient()
To remove reliance on global state, pass an "in_planner" argument
to vpmb_next_gradient(). Thus, calls to in_planner() can be removed.
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
Diffstat (limited to 'core/deco.c')
-rw-r--r-- | core/deco.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/core/deco.c b/core/deco.c index 5ca8e1a75..a997668c2 100644 --- a/core/deco.c +++ b/core/deco.c @@ -308,9 +308,9 @@ static double factor(int period_in_seconds, int ci, enum gas_component gas) return 1.0 - exp(-period_in_seconds * 1.155245301e-02 / buehlmann_He_t_halflife[ci]); } -static double calc_surface_phase(double surface_pressure, double he_pressure, double n2_pressure, double he_time_constant, double n2_time_constant) +static double calc_surface_phase(double surface_pressure, double he_pressure, double n2_pressure, double he_time_constant, double n2_time_constant, bool in_planner) { - double inspired_n2 = (surface_pressure - ((in_planner() && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * NITROGEN_FRACTION; + double inspired_n2 = (surface_pressure - ((in_planner && (decoMode() == VPMB)) ? WV_PRESSURE_SCHREINER : WV_PRESSURE)) * NITROGEN_FRACTION; if (n2_pressure > inspired_n2) return (he_pressure / he_time_constant + (n2_pressure - inspired_n2) / n2_time_constant) / (he_pressure + n2_pressure - inspired_n2); @@ -334,7 +334,7 @@ void vpmb_start_gradient(struct deco_state *ds) } } -void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_pressure) +void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_pressure, bool in_planner) { int ci; double n2_b, n2_c; @@ -343,7 +343,7 @@ void vpmb_next_gradient(struct deco_state *ds, double deco_time, double surface_ deco_time /= 60.0; for (ci = 0; ci < 16; ++ci) { - desat_time = deco_time + calc_surface_phase(surface_pressure, ds->tissue_he_sat[ci], ds->tissue_n2_sat[ci], log(2.0) / buehlmann_He_t_halflife[ci], log(2.0) / buehlmann_N2_t_halflife[ci]); + desat_time = deco_time + calc_surface_phase(surface_pressure, ds->tissue_he_sat[ci], ds->tissue_n2_sat[ci], log(2.0) / buehlmann_He_t_halflife[ci], log(2.0) / buehlmann_N2_t_halflife[ci], in_planner); n2_b = ds->initial_n2_gradient[ci] + (vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * desat_time); he_b = ds->initial_he_gradient[ci] + (vpmb_config.crit_volume_lambda * vpmb_config.surface_tension_gamma) / (vpmb_config.skin_compression_gammaC * desat_time); |