| 77 | |
| 78 | |
| 79 | void VariableGridData::Init() |
| 80 | { |
| 81 | m_col_hdrs.Clear(); |
| 82 | m_var_names.Clear(); |
| 83 | m_var_labels.Clear(); |
| 84 | // m_vsVariableData.clear(); |
| 85 | m_var_info_lookup_vec.clear(); |
| 86 | m_var_table_vec.clear(); |
| 87 | VarInfoLookup vi_not_calculated; |
| 88 | VarTable vt_not_calculated; |
| 89 | size_t i, n; |
| 90 | |
| 91 | if (m_cases.size() > 0) |
| 92 | { |
| 93 | m_col_hdrs.push_back("Variable"); |
| 94 | m_col_hdrs.push_back("Label"); |
| 95 | if (m_cases.size() == 1) |
| 96 | { |
| 97 | m_col_hdrs.push_back(m_pf->GetCaseName(m_cases[0])); |
| 98 | // if (m_vt) |
| 99 | // m_var_table_vec.push_back(m_vt); // for parametric simulation |
| 100 | // else |
| 101 | // m_var_table_vec.push_back(&m_cases[0]->Values(0));// TODO: hybrids |
| 102 | ConfigInfo* ci = m_cases[0]->GetConfiguration(); |
| 103 | if (!ci) return; // throw error? |
| 104 | n = ci->Technology.size(); |
| 105 | if (m_vts) { |
| 106 | m_var_table_vec.push_back(*m_vts); // for parametric simulation |
| 107 | } |
| 108 | else { |
| 109 | std::vector<VarTable*> pvt; |
| 110 | for (i = 0; i < n; i++) |
| 111 | pvt.push_back(&m_cases[0]->Values(i)); |
| 112 | m_var_table_vec.push_back(pvt); |
| 113 | } |
| 114 | std::vector<VarInfoLookup*> pvil; |
| 115 | for (i = 0; i < n; i++) |
| 116 | pvil.push_back(&m_cases[0]->Variables(i)); |
| 117 | m_var_info_lookup_vec.push_back(pvil); |
| 118 | } |
| 119 | else |
| 120 | { |
| 121 | for (std::vector<Case*>::iterator it = m_cases.begin(); it != m_cases.end(); ++it) |
| 122 | { |
| 123 | m_col_hdrs.push_back(m_pf->GetCaseName(*it)); |
| 124 | |
| 125 | ConfigInfo* ci = (*it)->GetConfiguration(); |
| 126 | if (!ci) return; // throw error? |
| 127 | n = ci->Technology.size(); |
| 128 | |
| 129 | std::vector<VarTable*> pvt; |
| 130 | for (i = 0; i < n; i++) |
| 131 | pvt.push_back(&(*it)->Values(i)); |
| 132 | m_var_table_vec.push_back(pvt); |
| 133 | |
| 134 | std::vector<VarInfoLookup*> pvil; |
| 135 | for (i = 0; i < n; i++) |
| 136 | pvil.push_back(&(*it)->Variables(i)); |
nothing calls this directly
no test coverage detected