From 1ae36f72a79b2eb58512b1f28ca61aaabba4c85f Mon Sep 17 00:00:00 2001 From: "Robert C. Helling" Date: Sat, 10 Dec 2016 09:27:42 +0100 Subject: [PATCH] Output a (mathematica) list of (depth, momentary gf) pairs to stdout To: subsurface@subsurface-divelog.org --- core/profile.c | 13 +++++++------ core/profile.h | 1 + 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/core/profile.c b/core/profile.c index bc67031..d0e79ff 100644 --- a/core/profile.c +++ b/core/profile.c @@ -1015,13 +1015,19 @@ void calculate_deco_information(struct dive *dive, struct divecomputer *dc, stru time_clear_ceiling = t1; } } + int max_gf = 0; for (j = 0; j < 16; j++) { double m_value = buehlmann_inertgas_a[j] + entry->ambpressure / buehlmann_inertgas_b[j]; entry->ceilings[j] = deco_allowed_depth(tolerated_by_tissue[j], surface_pressure, dive, 1); entry->percentages[j] = tissue_inertgas_saturation[j] < entry->ambpressure ? tissue_inertgas_saturation[j] / entry->ambpressure * AMB_PERCENTAGE : AMB_PERCENTAGE + (tissue_inertgas_saturation[j] - entry->ambpressure) / (m_value - entry->ambpressure) * (100.0 - AMB_PERCENTAGE); + if (entry->percentages[j] > max_gf) + max_gf = entry->percentages[j]; } + entry->max_gf = max_gf; + printf("{%d, %d},\n",entry->depth, max_gf); + /* should we do more calculations? * We don't for print-mode because this info doesn't show up there @@ -1405,12 +1411,7 @@ static void plot_string(struct plot_info *pi, struct plot_data *entry, struct me } } } - int max_gf = 0; - for (int k = 0; k < 16; k++) - if (entry->percentages[k] > max_gf) - max_gf = entry->percentages[k]; - put_format(b, translate("gettextFromC", "GF: %.2d%\n"), max_gf); - printf("%d %d\n",entry->depth, max_gf); + put_format(b, translate("gettextFromC", "GF: %.2d%\n"), entry->max_gf); if (entry->heartbeat && prefs.hrgraph) put_format(b, translate("gettextFromC", "heartbeat: %d\n"), entry->heartbeat); if (entry->bearing) diff --git a/core/profile.h b/core/profile.h index 8491303..61d1f6b 100644 --- a/core/profile.h +++ b/core/profile.h @@ -34,6 +34,7 @@ struct plot_data { int ceiling; int ceilings[16]; int percentages[16]; + int max_gf; int ndl; int tts; int rbt; -- 2.9.3 (Apple Git-75)