Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #1577 #1610

Merged
merged 5 commits into from
Dec 1, 2023
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 30 additions & 16 deletions src/variablegrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@ void VariableGridData::Init()
ConfigInfo* ci = m_cases[iCase]->GetConfiguration();
for (size_t iVarTable = 0; iVarTable < m_var_info_lookup_vec[iCase].size(); iVarTable++) {
// iterate over case vartables
wxString prepend = "";
if (ci->Technology.size() > 1) prepend = ci->Technology[iVarTable].Lower() + "_";
wxString prepend = ci->Technology[iVarTable].Lower() + "_";
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Think there's still an issue with some of the prepends having spaces in them, which is causing crashes when opening another case with Inputs Browser open:

image

image

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Issue seems consistent when you open another case with inputs browser open for these prepends with spaces. Might need to do a find and replace for " " or use different naming scheme.


wxArrayString as = m_var_info_lookup_vec[iCase][iVarTable]->ListAll();
for (size_t i = 0; i < as.Count(); i++) {
// if ((!((*it)->Lookup(as[i])->Flags & VF_CALCULATED)) &&
Expand Down Expand Up @@ -216,7 +216,7 @@ bool VariableGridData::UpdateVarNameNdxHybrid(Case *c, const wxString& input_nam
*var_name = input_name;
if (!c) return false;
// decode if necessary for hybrids varname for unsorted index
if (c->GetConfiguration()->Technology.size() > 1) {
// if (c->GetConfiguration()->Technology.size() > 1) {
// split hybrid name and match with Technology name or use "Hybrid" for remainder
wxArrayString as = wxSplit(input_name, '_');
for (size_t j = 0; j < c->GetConfiguration()->Technology.size(); j++) {
Expand All @@ -225,7 +225,7 @@ bool VariableGridData::UpdateVarNameNdxHybrid(Case *c, const wxString& input_nam
*var_name = input_name.Right(input_name.length() - (as[0].length() + 1));
}
}
}
// }
return true;
}

Expand Down Expand Up @@ -613,27 +613,38 @@ bool VariableGridData::ShowRow(int row, int comparison_type, bool show_calculate
case COMPARE_SHOW_DIFFERENT:
case COMPARE_SHOW_SAME:
{ // note that the comparison starts with first case and then check other cases if variable exists - ORDER DEPENDENT
int lookup_row = row;
if (m_sorted) lookup_row = m_sorted_index[row];
Case* c = m_cases[0];
wxString var_name;
size_t ndx_hybrid;
int lookup_row = row;
if (m_sorted) lookup_row = m_sorted_index[row];
Case* c = m_cases[0];
wxString var_name;
size_t ndx_hybrid;
if (m_var_names.size() > 0) {
if (UpdateVarNameNdxHybrid(c, m_var_names[lookup_row], &var_name, &ndx_hybrid)) {
if (m_var_table_vec[0][ndx_hybrid]->Get(var_name)) {
VarValue* vv = m_var_table_vec[0][ndx_hybrid]->Get(var_name);
bool row_varvalues_same = true;
for (int col = 1; col < (int)m_cases.size(); col++) {
if (m_var_table_vec[col][ndx_hybrid]->Get(var_name)) {
VarValue* vv_new = m_var_table_vec[col][ndx_hybrid]->Get(var_name);
if (vv->Type() == vv_new->Type())
row_varvalues_same = (row_varvalues_same && (vv->ValueEqual(*vv_new)));
else{
show = false; // different variable type in row - should not happen
// decode and key off of m_var_names[lookup_row]
wxString col_var_name;
size_t col_ndx_hybrid;
if (UpdateVarNameNdxHybrid(m_cases[col], m_var_names[lookup_row], &col_var_name, &col_ndx_hybrid)) {

if (m_var_table_vec[col][col_ndx_hybrid]->Get(col_var_name)) {
VarValue* vv_new = m_var_table_vec[col][col_ndx_hybrid]->Get(col_var_name);
if (vv->Type() == vv_new->Type())
row_varvalues_same = (row_varvalues_same && (vv->ValueEqual(*vv_new)));
else {
show = false; // different variable type in row - should not happen
continue;
}
}
else {
show = false; // no variable value for (row, col)
continue;
}
}
else {
show = false; // no variable value for (row, col)
show = false; // no m_var_names[lookup_row] value for (row, col)
continue;
}
}
Expand All @@ -648,6 +659,9 @@ bool VariableGridData::ShowRow(int row, int comparison_type, bool show_calculate
else
show = false; // no variable value for (row, col=0)
}
else
show = false; // no var name for (row, col=0)
}
break;
case COMPARE_SHOW_ALL:
default:
Expand Down