Commit eb483d92f9137900b21fd18d9186450f7bb6dc3c

Authored by Hacene SI HADJ MOHAND
2 parents a98a1504 66b49969

Merge branch 'develop' into rm_8932

src/ExternLib/FramesTransformation/ProcessFramesTransformation.cc
... ... @@ -66,7 +66,7 @@ TimeStamp ProcessFramesTransformation::init() {
66 66 _toFrame = _attributList[1];
67 67  
68 68 if (_attributList.size() == 3)
69   - _isPosition = (_attributList[2].compare("true") || _attributList[2].compare("1"));
  69 + _isPosition = ((_attributList[2].compare("true") == 0) || (_attributList[2].compare("1") == 0));
70 70  
71 71 return ProcessFramesTransformationBase::init();
72 72 }
... ...
src/ExternLib/GetClbInfoByIndex/GetClbInfoByIndex.hh
... ... @@ -69,7 +69,7 @@ public:
69 69 * @details Create the ParamData type of the input ParamData.
70 70 */
71 71 GetClbInfoByIndex(Process& pProcess, TParamData& paramInput)
72   - : Base::GetClbInfoByIndex(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DDouble()) {
  72 + : Base::GetClbInfoByIndex(pProcess), _paramInput(paramInput), _paramOutput(new ParamDataTab1DDouble()), _maxTableSize(0) {
73 73 _paramDataOutput=_paramOutput;
74 74 }
75 75  
... ... @@ -93,6 +93,8 @@ public:
93 93 BOOST_THROW_EXCEPTION(AMDA::AMDA_exception() << AMDA::errno_code(AMDA_PROCESS_ERR) << AMDA::ex_msg(std::string("GetClbInfoByIndex::init - Cannot find calibInfo "+clbInfoIndexName)));
94 94 }
95 95 _calibrationInfoList[i]=lInfoList[clbInfoIndexName].get();
  96 + if (_calibrationInfoList[i]->size() > _maxTableSize)
  97 + _maxTableSize = _calibrationInfoList[i]->size();
96 98 }
97 99 }
98 100  
... ... @@ -102,7 +104,16 @@ public:
102 104 void write(ParamDataIndexInfo &pParamDataIndexInfo) {
103 105 unsigned int index = pParamDataIndexInfo._startIndex;
104 106 for (; index< pParamDataIndexInfo._startIndex + pParamDataIndexInfo._nbDataToProcess; index++) {
105   - _paramOutput->pushTime(_paramInput.getTime(index));
  107 + _paramOutput->pushTime(_paramInput.getTime(index));
  108 + if (isNAN(_paramInput.getDataList()[index])) {
  109 + std::vector<double> emptyVec;
  110 + if (_maxTableSize > 0) {
  111 + emptyVec.resize(_maxTableSize);
  112 + emptyVec << NotANumber();
  113 + }
  114 + _paramOutput->getDataList().push_back(emptyVec);
  115 + continue;
  116 + }
106 117 _paramOutput->getDataList().push_back(*(_calibrationInfoList[(int)floor(_paramInput.getDataList()[index])]));
107 118 }
108 119 }
... ... @@ -119,6 +130,8 @@ private:
119 130 ParamDataTab1DDouble *_paramOutput;
120 131  
121 132  
  133 + double _maxTableSize;
  134 +
122 135 /**
123 136 * @brief map of calibrationInfo.
124 137 * @detail for expression #getClbInfo($ETableN;0:ImaEner_0;1:ImaEner_1)
... ...
src/ExternLib/StatisticProcesses/MinMaxMeanStatistic.hh
... ... @@ -56,6 +56,9 @@ namespace AMDA {
56 56 _paramInput(param), _timeIntervalList(pTimeIntervalList),
57 57 _currentTimeInterval(_timeIntervalList->begin()),
58 58 _funcType(funcType), _dimDef("unknown") {
  59 + ElementType fillValue;
  60 + fillValue << NotANumber();
  61 + initDimSize(fillValue);
59 62 resetData(StatisticOperation<TResultData>::_resultData);
60 63 }
61 64  
... ... @@ -154,6 +157,16 @@ namespace AMDA {
154 157 }
155 158  
156 159 private:
  160 + template<typename Type>
  161 + void initDimSize(Type &/*a*/) {
  162 + _dimDef.str("1");
  163 + }
  164 +
  165 + template<typename Type>
  166 + void initDimSize(std::vector<Type> &/*a*/) {
  167 + _dimDef.str("unknown");
  168 + }
  169 +
157 170  
158 171 template<typename Type>
159 172 void resetData(Type &a) {
... ... @@ -168,8 +181,6 @@ namespace AMDA {
168 181  
169 182 template<typename Type>
170 183 void computeMin(Type &a) {
171   - _dimDef.str("1");
172   -
173 184 if (isNAN(a))
174 185 return;
175 186  
... ... @@ -210,8 +221,6 @@ namespace AMDA {
210 221  
211 222 template<typename Type>
212 223 void computeMax(Type &a) {
213   - _dimDef.str("1");
214   -
215 224 if (isNAN(a))
216 225 return;
217 226  
... ... @@ -253,8 +262,6 @@ namespace AMDA {
253 262  
254 263 template<typename Type>
255 264 void addForMean(Type &a) {
256   - _dimDef.str("1");
257   -
258 265 if (isNAN(a))
259 266 return;
260 267  
... ... @@ -296,8 +303,6 @@ namespace AMDA {
296 303  
297 304 template<typename Type>
298 305 void addForRMS(Type &a) {
299   - _dimDef.str("1");
300   -
301 306 if (isNAN(a))
302 307 return;
303 308  
... ... @@ -339,7 +344,6 @@ namespace AMDA {
339 344  
340 345 template<typename Type>
341 346 void generateVector(Type &a) {
342   - _dimDef.str("1");
343 347 if (isNAN(a))
344 348 return;
345 349 if (isNAN(StatisticOperation<TResultData>::_resultData._result))
... ...
src/InternLib/Resampling.hh
... ... @@ -467,7 +467,7 @@ public:
467 467 _leftEffect = false;
468 468 } else {
469 469 if (_markerPtr->getTargetTime() <= timeCurrent) {
470   - while (_markerPtr->getTargetTime() <= timeCurrent) {
  470 + while ((_markerPtr->getTargetTime() <= timeCurrent) && !_markerPtr->isFinished()) {
471 471 double deltaT = (float) (timeCurrent - _lastTime);
472 472 if (deltaT <= _gapSize) {
473 473 double coefT = (float) (_markerPtr->getTargetTime() - _lastTime) / deltaT;
... ...
src/Parameters/DataTypeMath.hh
... ... @@ -1390,6 +1390,20 @@ std::vector&lt;Type&gt; total(const AMDA::Parameters::Tab2DData&lt;Type&gt;&amp; a, int mode) {
1390 1390 return sum;
1391 1391 }
1392 1392  
  1393 +// Reshape a Tab2D to a vector
  1394 +template <typename Type>
  1395 +std::vector<Type> reshapeToVector(const AMDA::Parameters::Tab2DData<Type>& a) {
  1396 + std::vector<Type> v;
  1397 + v.resize(a.getDim1Size()*a.getDim2Size());
  1398 + for (int r = 0; r < a.getDim1Size(); ++r) {
  1399 + for (int c = 0; c < a.getDim2Size(); ++c) {
  1400 + v[r*a.getDim2Size() + c] = a[r][c];
  1401 + }
  1402 + }
  1403 +
  1404 + return v;
  1405 +}
  1406 +
1393 1407 template <typename Type1, typename Type2>
1394 1408 std::vector<Type1> operator+(AMDA::Parameters::TabRow<Type1> a, AMDA::Parameters::TabRow<Type2> b) {
1395 1409 std::vector<Type1> av(a);
... ...