Commit d7d55a0222f1f412a24d78ca0469ef494501317d

Authored by Hacene SI HADJ MOHAND
1 parent 5f604c87

ok for getClbInfo such as sum_into_table_range_mex_els_spec_sum

src/ExternLib/GetClbInfo/GetClbInfoProcess.cc
... ... @@ -50,19 +50,24 @@ TimeStamp GetClbInfoProcess::init() {
50 50 dynamic_cast<Base::GetClbInfo*>(_operation)->init(*_parameterInput,_attributList);
51 51 _paramData = ParamDataSPtr(_operation->getParamOutput());
52 52 _paramData->setMinSampling(_paramInput->getMinSampling());
  53 + AMDA::Parameters::SemiVariableTable semiVariableTableElements;
  54 + int i = 0;
  55 + unsigned int nbHeader = 0;
  56 + for (auto info : lInfoList){
  57 + semiVariableTableElements.tabValues[i] = *info.second;
  58 + if (nbHeader < (*info.second).size())
  59 + nbHeader = (*info.second).size();
  60 + i++;
  61 + }
  62 + for (unsigned int i = 0 ; i < nbHeader; i++)
  63 + semiVariableTableElements.tabHeader.push_back("Energy[" + std::to_string(i)+"]");
  64 + this->setSemiVariableTable(semiVariableTableElements);
  65 + if (!semiVariableTableElements.tabValues.empty())
  66 + _parameterInput->setIsTableIndexParam(true);
  67 +
53 68 return timeStamp;
54   -}
55   -std::list<std::string> GetClbInfoProcess::getUsedClbInfo(){
56   - std::list<std::string> clbInfoList ;
57   - Parameter::InfoList lInfoList = _parameterInput->getInfoList();
58   - if( ! lInfoList.empty()){
59   - for(auto info: lInfoList ){
60   - clbInfoList.push_back(info.first);
61   - }
62   - }
63   -
64   - return clbInfoList;
65   -}
  69 + }
  70 +
66 71  
67 72 } /* namespace GetClbInfo */
68 73 } /* namespace AMDA */
... ...
src/ExternLib/GetClbInfo/GetClbInfoProcess.hh
... ... @@ -39,7 +39,6 @@ namespace GetClbInfo {
39 39 */
40 40 AMDA::Parameters::TimeStamp init();
41 41  
42   - std::list<std::string> getUsedClbInfo();
43 42 };
44 43  
45 44 } /* namespace GetClbInfo */
... ...
src/Info/ParamTable.cc
... ... @@ -186,7 +186,7 @@ namespace AMDA {
186 186 void ParamTable::addSemiVariableTableInfo(ParameterManager* parameterManager, int dim, std::string paramId, std::string tabKey, std::vector<std::pair<std::string, std::string>>&infoMap) {
187 187 AMDA::Parameters::ParameterSPtr pParam = parameterManager->getParameter(paramId);
188 188 Process* lProcess = dynamic_cast<Process*> (pParam->getDataWriterTemplate().get());
189   - if (lProcess != NULL) {
  189 + if (lProcess != NULL) {
190 190 AMDA::Parameters::SemiVariableTable semiVariableTable = lProcess ->getSemiVariableTable();
191 191 std::list<std::string>::iterator it;
192 192 it = std::find(_printedTables.begin(), _printedTables.end(), paramId);
... ... @@ -199,39 +199,60 @@ namespace AMDA {
199 199 }
200 200 PUSHINFO(infoMap, "", head.str());
201 201 // recuperer les centres
  202 + bool variableSizes = false;
202 203 int nModes = semiVariableTable.tabValues.size();
203   - int nValues = semiVariableTable.tabValues.begin()->second.size();
204   - std::vector<double> energyVec;
205   - std::map<std::string, std::vector<double>> paramsTableData;
206   - std::map<int, std::vector<double>> semiVariableTableData;
207   - for (int i = 0; i < nValues; ++i) {
208   - energyVec.clear();
209   - for (int j = 0; j < nModes; ++j) {
210   - energyVec.push_back(semiVariableTable.tabValues[j][i]);
211   - }
212   - paramsTableData[tabKey] = energyVec;
213   - for (int j = 0; j < 2 * nModes; j = j + 2) {
214   - t_TableBound bound = getBound(parameterManager, j / 2, &paramsTableData);
215   - semiVariableTableData[j].push_back(bound.min);
216   - semiVariableTableData[j + 1].push_back(bound.max);
217   - }
  204 + int nValues = semiVariableTable.tabHeader.size();
  205 + for (auto tabValues : semiVariableTable.tabValues) {
  206 + if (tabValues.second.size() != nValues)
  207 + variableSizes = true;
218 208 }
219   - int l = 0;
220   - int k = 0;
221   - for (auto v : semiVariableTableData) {
  209 + if (variableSizes) {
222 210 std::ostringstream values;
223   - std::string born;
224   - (l % 2 == 0) ? born = " Min " : born = " Max ";
225   - values << std::to_string(k) << born;
226   - // Convert all doubles to string ","
227   - std::copy(v.second.begin(), v.second.end(),
228   - std::ostream_iterator<double>(values, " "));
229   - PUSHINFO(infoMap, "", values.str());
230   - values.str("");
231   - if (l % 2 != 0)
232   - k++;
233   - l++;
  211 + for (auto tabValues : semiVariableTable.tabValues) {
  212 + values << std::to_string(tabValues.first) << " ";
  213 + for (unsigned int i = 0; i < nValues; i++) {
  214 + if (i < tabValues.second.size()) {
  215 + values << std::to_string(tabValues.second[i]) << " ";
  216 + } else {
  217 + values << "NAN ";
  218 + }
  219 + }
  220 + PUSHINFO(infoMap, "", values.str());
  221 + values.str("");
  222 + }
  223 + } else {
  224 + std::vector<double> energyVec;
  225 + std::map<std::string, std::vector<double>> paramsTableData;
  226 + std::map<int, std::vector<double>> semiVariableTableData;
  227 + for (int i = 0; i < nValues; ++i) {
  228 + energyVec.clear();
  229 + for (int j = 0; j < nModes; ++j) {
  230 + energyVec.push_back(semiVariableTable.tabValues[j][i]);
  231 + }
  232 + paramsTableData[tabKey] = energyVec;
  233 + for (int j = 0; j < 2 * nModes; j = j + 2) {
  234 + t_TableBound bound = getBound(parameterManager, j / 2, &paramsTableData);
  235 + semiVariableTableData[j].push_back(bound.min);
  236 + semiVariableTableData[j + 1].push_back(bound.max);
  237 + }
  238 + }
  239 + int l = 0;
  240 + int k = 0;
  241 + for (auto v : semiVariableTableData) {
  242 + std::ostringstream values;
  243 + std::string born;
  244 + (l % 2 == 0) ? born = " Min " : born = " Max ";
  245 + values << std::to_string(k) << born;
  246 + // Convert all doubles to string ","
  247 + std::copy(v.second.begin(), v.second.end(),
  248 + std::ostream_iterator<double>(values, " "));
  249 + PUSHINFO(infoMap, "", values.str());
  250 + values.str("");
  251 + if (l % 2 != 0)
  252 + k++;
  253 + l++;
234 254  
  255 + }
235 256 }
236 257 _printedTables.push_back(paramId);
237 258 }
... ...
src/Parameters/Process.hh
... ... @@ -86,10 +86,6 @@ public:
86 86  
87 87 void setAttributList(AttributeList pAttributList) { _attributList = pAttributList; }
88 88  
89   - virtual std::list<std::string> getUsedClbInfo(){
90   - std::list<std::string> clbInfoList;
91   - return clbInfoList;
92   - }
93 89  
94 90 AMDA::Parameters::SemiVariableTable getSemiVariableTable(){
95 91 return _semiVariableTable;
... ...