Skip to content

Commit

Permalink
Per #1810, commit a bugfix for tc_gen which can write stat output for…
Browse files Browse the repository at this point in the history
… multiple inputs. Its call to AsciiTable::expand() was not correct. Added logic to determine the actual required output size.
  • Loading branch information
JohnHalleyGotway committed Mar 4, 2022
1 parent 43c7dad commit 91d245f
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions met/src/tools/tc_utils/tc_gen/tc_gen.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1825,7 +1825,12 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) {
}
// Otherwise, resize the existing table
else {
txt_at[i].expand(n_rows, n_cols);
int need_rows = max(txt_at[i].nrows(), i_txt_row[i] + n_rows);
int need_cols = max(txt_at[i].ncols(), n_cols);

if(need_rows > txt_at[i].nrows() || need_cols > txt_at[i].ncols()) {
txt_at[i].expand(need_rows, need_cols);
}
}
} // end if
} // end for i
Expand All @@ -1851,7 +1856,12 @@ void setup_txt_files(int n_model, int max_n_prob, int n_pair) {
}
// Otherwise, resize the existing table
else {
stat_at.expand(stat_rows, stat_cols);
int need_rows = max(stat_at.nrows(), i_stat_row + stat_rows);
int need_cols = max(stat_at.ncols(), stat_cols);

if(need_rows > stat_at.nrows() || need_cols > stat_at.ncols()) {
stat_at.expand(need_rows, need_cols);
}
}

return;
Expand Down

0 comments on commit 91d245f

Please sign in to comment.