Commit f784189da776815a072af6b7413dd4a36881d6c9

Authored by Hacene SI HADJ MOHAND
1 parent 3e19e9d5

in progress

src/Info/ParamTable.cc
... ... @@ -216,20 +216,36 @@ void ParamTable::addVariableTableInfo(ParameterManager * parameterManager, int d
216 216 ParameterSPtr pParam = parameterManager->getParameter(linkedParam.second);
217 217 std::map<std::string, boost::shared_ptr<std::vector<double>>> infoList =pParam->getInfoList();
218 218 if(! infoList.empty()){
219   - for (auto inf : infoList){
220   - if(! inf.second->empty() ) {
221   - std::ostringstream values;
222   - // Convert all but the last element to avoid a trailing ","
223   - std::copy(inf.second->begin(), inf.second->end()-1,
224   - std::ostream_iterator<double>(values, ","));
225   - // Now add the last element with no delimiter
226   - values<< inf.second->back();
227   - std::stringstream infoKey;
228   - infoKey.str("");
229   - infoKey << PARAMETER_INFO<< "[" << inf.first << "]";
230   - PUSHINFO(tableInfo , infoKey.str() , values.str());
231   - }
232   - }
  219 + int nenergy;
  220 + std::map<std::string, boost::shared_ptr<std::vector<double>>>::iterator it = infoList.find("nenergy");
  221 + nenergy = (int)(*it->second)[0];
  222 + int nmass;
  223 + std::map<std::string, boost::shared_ptr<std::vector<double>>>::iterator it2 = infoList.find("nmass");
  224 + nmass = (int)(*it2->second)[0];
  225 + int nswp;
  226 + std::map<std::string, boost::shared_ptr<std::vector<double>>>::iterator it3 = infoList.find("nswp");
  227 + nswp = (int)(*it3->second)[0];
  228 + std::ostringstream head;
  229 + head.str("");
  230 + head << "# mode ";
  231 + for(int j=0; j<nmass; j++){
  232 + for(int l=0; l<nenergy; l++){
  233 + head<<_tableName<"["<<j<<","<<l<<"]";
  234 + }
  235 + }
  236 + PUSHINFO(tableInfo, "", head.str());
  237 + std::ostringstream values;
  238 +
  239 + for(int k= 0; k<nswp; k++){
  240 + for(int e= 0; e<nenergy*nmass; e++){
  241 + std::string energyLevel="energy_" + std::to_string(e);
  242 + it = infoList.find(energyLevel);
  243 + values<<std::to_string(e)<<(*it->second)[e];
  244 + }
  245 + PUSHINFO(tableInfo,"",values.str());
  246 + values.str("");
  247 + }
  248 +
233 249 }
234 250 i++;
235 251 }
... ...
src/ParamOutputImpl/Download/DownloadOutput.cc
... ... @@ -105,7 +105,21 @@ void DownloadOutput::establishConnection()
105 105 paramProperties->setOriginalId(tableParamId.second);
106 106 paramProperties->setOutputId(tableParamId.second);
107 107 _downloadProperties.addParamProperties(paramProperties);
  108 + } /**
  109 + else
  110 + {
  111 + //create info file
  112 + std::string tableFilePath = getTableInfoFilePath(_fileWriter->getExtension());
  113 +
  114 + if (!_fileWriter->createNewFile(tableFilePath))
  115 + {
  116 + LOG4CXX_ERROR(_logger, "DownloadOutput::establishConnection : Cannot create Table info file " << tableFilePath);
  117 + BOOST_THROW_EXCEPTION(AMDA::Parameters::ParamOutput_exception());
  118 + }
  119 + _files.push_back(tableFilePath);
  120 +
108 121 }
  122 + * **/
109 123 }
110 124  
111 125 }
... ... @@ -416,6 +430,10 @@ void DownloadOutput::writeInfo(bool isWriteIntervalInfo,
416 430 if (isFinalizeInfoFile)
417 431 _fileWriter->finalize(true);
418 432 }
  433 +void DownloadOutput::writeTableInfo(){
  434 +
  435 + // writeTableInfo(); comme
  436 +}
419 437  
420 438 void DownloadOutput::writeAMDAInfo(void)
421 439 {
... ... @@ -891,6 +909,14 @@ std::string DownloadOutput::getInfoFilePath(std::string extension)
891 909 return getFilePath(extension, true);
892 910 }
893 911  
  912 +/*
  913 + * @brief Get file table info path in relation with the sequence step (only used if info constant or variable but finite table)
  914 + */
  915 +std::string DownloadOutput::getTableInfoFilePath(std::string extension)
  916 +{
  917 + return "Table"+getFilePath(extension, true);
  918 +}
  919 +
894 920 void DownloadOutput::getParameterDataFromServer(std::string paramId)
895 921 {
896 922 try {
... ...
src/ParamOutputImpl/Download/DownloadOutput.hh
... ... @@ -162,6 +162,11 @@ protected:
162 162 */
163 163 void writeInfo(bool isWriteIntervalInfo, bool isWriteOnlyIntervalInfo,
164 164 bool isFinalizeInfoFile);
  165 +
  166 + /*
  167 + * @brief write Table information in file
  168 + */
  169 + void writeTableInfo();
165 170  
166 171 /*
167 172 * @brief write AMDA information
... ... @@ -212,6 +217,11 @@ protected:
212 217 * @brief Get file info path in relation with the sequence step (only used if info is written is separate file)
213 218 */
214 219 std::string getInfoFilePath(std::string extension);
  220 +
  221 + /*
  222 + * @brief Get file table info path in relation with the sequence step (only used if info constant or variable but finite table)
  223 + */
  224 + std::string getTableInfoFilePath(std::string extension);
215 225  
216 226 /*
217 227 * @brief Apply structure for "one-file"
... ...