summaryrefslogtreecommitdiffstats
path: root/deco.c
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-21 10:15:31 -0700
committerGravatar Dirk Hohndel <dirk@hohndel.org>2015-08-21 10:16:06 -0700
commitc7d8e72607870fee24fd03df3b54877a80c55102 (patch)
tree939a839df7a5d8441edc278c32b6c1a4dbef9450 /deco.c
parent652f7e9864b5a28ba03bdaa641139230364dae0e (diff)
downloadsubsurface-c7d8e72607870fee24fd03df3b54877a80c55102.tar.gz
Use our pressure type to avoid bar / mbar confusion
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'deco.c')
-rw-r--r--deco.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/deco.c b/deco.c
index 6f8f0f6d4..d802ca539 100644
--- a/deco.c
+++ b/deco.c
@@ -23,7 +23,7 @@
extern bool in_planner();
-extern int first_stop_pressure;
+extern pressure_t first_stop_pressure;
//! Option structure for Buehlmann decompression.
struct buehlmann_config {
@@ -351,7 +351,7 @@ double update_gradient(double next_stop_pressure, double first_gradient)
double first_radius = 2.0 * vpmb_config.surface_tension_gamma / first_gradient;
double A = next_stop_pressure;
double B = -2.0 * vpmb_config.surface_tension_gamma;
- double C = (first_stop_pressure / 1000.0 + 2.0 * vpmb_config.surface_tension_gamma / first_radius) * cube(first_radius);
+ double C = (first_stop_pressure.mbar / 1000.0 + 2.0 * vpmb_config.surface_tension_gamma / first_radius) * cube(first_radius);
double next_radius = solve_cubic(A, B, C);
@@ -366,10 +366,10 @@ void boyles_law(double next_stop_pressure)
return;
// This should be a tautology but prevents a numerical instability.
- if (IS_FP_SAME(next_stop_pressure, first_stop_pressure))
+ if (IS_FP_SAME(next_stop_pressure, first_stop_pressure.mbar / 1000.0))
return;
- if (!first_stop_pressure)
+ if (!first_stop_pressure.mbar)
return;
for (ci = 0; ci < 16; ++ci) {
allowable_n2_gradient[ci] = update_gradient(next_stop_pressure, bottom_n2_gradient[ci]);