mirror of
https://github.com/subsurface/subsurface.git
synced 2025-01-31 23:43:24 +00:00
core: move get_surface_pressure() to struct dive
Feel natural in a C++ code base. Remove the second parameter, because all callers where passing `true` anyway. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
6e29c00f35
commit
c812dd140b
5 changed files with 9 additions and 12 deletions
|
@ -221,7 +221,7 @@ double tissue_tolerance_calc(struct deco_state *ds, const struct dive *dive, dou
|
||||||
double ret_tolerance_limit_ambient_pressure = 0.0;
|
double ret_tolerance_limit_ambient_pressure = 0.0;
|
||||||
double gf_high = buehlmann_config.gf_high;
|
double gf_high = buehlmann_config.gf_high;
|
||||||
double gf_low = buehlmann_config.gf_low;
|
double gf_low = buehlmann_config.gf_low;
|
||||||
double surface = get_surface_pressure_in_mbar(dive, true) / 1000.0;
|
double surface = dive->get_surface_pressure().mbar / 1000.0;
|
||||||
double lowest_ceiling = 0.0;
|
double lowest_ceiling = 0.0;
|
||||||
double tissue_lowest_ceiling[16];
|
double tissue_lowest_ceiling[16];
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ void set_vpmb_conservatism(short conservatism)
|
||||||
|
|
||||||
double get_gf(struct deco_state *ds, double ambpressure_bar, const struct dive *dive)
|
double get_gf(struct deco_state *ds, double ambpressure_bar, const struct dive *dive)
|
||||||
{
|
{
|
||||||
double surface_pressure_bar = get_surface_pressure_in_mbar(dive, true) / 1000.0;
|
double surface_pressure_bar = dive->get_surface_pressure().mbar / 1000.0;
|
||||||
double gf_low = buehlmann_config.gf_low;
|
double gf_low = buehlmann_config.gf_low;
|
||||||
double gf_high = buehlmann_config.gf_high;
|
double gf_high = buehlmann_config.gf_high;
|
||||||
double gf;
|
double gf;
|
||||||
|
|
|
@ -2382,12 +2382,10 @@ bool dive::cache_is_valid() const
|
||||||
return git_id != null_id;
|
return git_id != null_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null)
|
pressure_t dive::get_surface_pressure() const
|
||||||
{
|
{
|
||||||
int mbar = dive->surface_pressure.mbar;
|
return surface_pressure.mbar > 0 ? surface_pressure
|
||||||
if (!mbar && non_null)
|
: pressure_t { SURFACE_PRESSURE };
|
||||||
mbar = SURFACE_PRESSURE;
|
|
||||||
return mbar;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This returns the conversion factor that you need to multiply
|
/* This returns the conversion factor that you need to multiply
|
||||||
|
|
|
@ -89,6 +89,7 @@ struct dive {
|
||||||
duration_t totaltime() const; /* maximum over divecomputers (with samples) */
|
duration_t totaltime() const; /* maximum over divecomputers (with samples) */
|
||||||
temperature_t dc_airtemp() const; /* average over divecomputers */
|
temperature_t dc_airtemp() const; /* average over divecomputers */
|
||||||
temperature_t dc_watertemp() const; /* average over divecomputers */
|
temperature_t dc_watertemp() const; /* average over divecomputers */
|
||||||
|
pressure_t get_surface_pressure() const;
|
||||||
|
|
||||||
struct get_maximal_gas_result { int o2_p; int he_p; int o2low_p; };
|
struct get_maximal_gas_result { int o2_p; int he_p; int o2low_p; };
|
||||||
get_maximal_gas_result get_maximal_gas() const;
|
get_maximal_gas_result get_maximal_gas() const;
|
||||||
|
@ -158,8 +159,6 @@ struct dive_components {
|
||||||
extern fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner);
|
extern fraction_t best_o2(depth_t depth, const struct dive *dive, bool in_planner);
|
||||||
extern fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2);
|
extern fraction_t best_he(depth_t depth, const struct dive *dive, bool o2narcotic, fraction_t fo2);
|
||||||
|
|
||||||
extern int get_surface_pressure_in_mbar(const struct dive *dive, bool non_null);
|
|
||||||
|
|
||||||
extern struct dive_site *get_dive_site_for_dive(const struct dive *dive);
|
extern struct dive_site *get_dive_site_for_dive(const struct dive *dive);
|
||||||
extern std::string get_dive_country(const struct dive *dive);
|
extern std::string get_dive_country(const struct dive *dive);
|
||||||
extern std::string get_dive_location(const struct dive *dive);
|
extern std::string get_dive_location(const struct dive *dive);
|
||||||
|
|
|
@ -537,7 +537,7 @@ int dive_table::init_decompression(struct deco_state *ds, const struct dive *div
|
||||||
printf("Yes\n");
|
printf("Yes\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
surface_pressure = get_surface_pressure_in_mbar(&pdive, true) / 1000.0;
|
surface_pressure = pdive.get_surface_pressure().mbar / 1000.0;
|
||||||
/* Is it the first dive we add? */
|
/* Is it the first dive we add? */
|
||||||
if (!deco_init) {
|
if (!deco_init) {
|
||||||
#if DECO_CALC_DEBUG & 2
|
#if DECO_CALC_DEBUG & 2
|
||||||
|
@ -575,7 +575,7 @@ int dive_table::init_decompression(struct deco_state *ds, const struct dive *div
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
surface_pressure = get_surface_pressure_in_mbar(dive, true) / 1000.0;
|
surface_pressure = dive->get_surface_pressure().mbar / 1000.0;
|
||||||
/* We don't have had a previous dive at all? */
|
/* We don't have had a previous dive at all? */
|
||||||
if (!deco_init) {
|
if (!deco_init) {
|
||||||
#if DECO_CALC_DEBUG & 2
|
#if DECO_CALC_DEBUG & 2
|
||||||
|
|
|
@ -841,7 +841,7 @@ static void calculate_deco_information(struct deco_state *ds, const struct deco_
|
||||||
const struct divecomputer *dc, struct plot_info &pi)
|
const struct divecomputer *dc, struct plot_info &pi)
|
||||||
{
|
{
|
||||||
int i, count_iteration = 0;
|
int i, count_iteration = 0;
|
||||||
double surface_pressure = (dc->surface_pressure.mbar ? dc->surface_pressure.mbar : get_surface_pressure_in_mbar(dive, true)) / 1000.0;
|
double surface_pressure = (dc->surface_pressure.mbar ? dc->surface_pressure.mbar : dive->get_surface_pressure().mbar) / 1000.0;
|
||||||
bool first_iteration = true;
|
bool first_iteration = true;
|
||||||
int prev_deco_time = 10000000, time_deep_ceiling = 0;
|
int prev_deco_time = 10000000, time_deep_ceiling = 0;
|
||||||
bool in_planner = planner_ds != NULL;
|
bool in_planner = planner_ds != NULL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue