mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
profile: fix displaying of profiles with multiple pressure sensors
When removing the MAX_CYLINDERS restriction, the layout of the pressure readings was changed from a (cylinder,sample) to a (sample,cylinder) scheme. I.e. previously there were one cylinder block for each sample, then one sample block for one cylinder. However, after populating the samples, the array size was reduced to the actual number of used samples. With the new layout this breaks indexing. Therefore, restore the old layout. Fixes #2887 Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
628c7c8f13
commit
4ec88aa564
1 changed files with 2 additions and 2 deletions
|
@ -109,12 +109,12 @@ extern int get_maxdepth(const struct plot_info *pi);
|
||||||
|
|
||||||
static inline int get_plot_pressure_data(const struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder)
|
static inline int get_plot_pressure_data(const struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder)
|
||||||
{
|
{
|
||||||
return pi->pressures[cylinder * pi->nr + idx].data[sensor];
|
return pi->pressures[cylinder + idx * pi->nr_cylinders].data[sensor];
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void set_plot_pressure_data(struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder, int value)
|
static inline void set_plot_pressure_data(struct plot_info *pi, int idx, enum plot_pressure sensor, int cylinder, int value)
|
||||||
{
|
{
|
||||||
pi->pressures[cylinder * pi->nr + idx].data[sensor] = value;
|
pi->pressures[cylinder + idx * pi->nr_cylinders].data[sensor] = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int get_plot_sensor_pressure(const struct plot_info *pi, int idx, int cylinder)
|
static inline int get_plot_sensor_pressure(const struct plot_info *pi, int idx, int cylinder)
|
||||||
|
|
Loading…
Reference in a new issue