diff --git a/MMVII/include/MMVII_nums.h b/MMVII/include/MMVII_nums.h index 2d5f504d8c..e68148faa6 100755 --- a/MMVII/include/MMVII_nums.h +++ b/MMVII/include/MMVII_nums.h @@ -902,7 +902,8 @@ class cCelCC : public cMemCheck public : std::vector mEquivCode; /// all codes equivalent size_t mLowCode; ///< lower representant - bool mTmp; /// some marker to use when convenient + bool mTmp; ///< some marker to use when convenient + int mNum; ///< Num used so that names is alway the same whatever maybe the selection size_t HammingDist(const cCelCC &) const; @@ -930,6 +931,7 @@ class cCompEquiCodes : public cMemCheck const std::vector & VecOfCells() const; ///< Accessor const cCelCC & CellOfCodeOK(size_t aCode) const; ///< Error if null const cCelCC * CellOfCode(size_t) const; ///< nullptr if bad range or no cell + cCelCC * CellOfCode(size_t) ; ///< nullptr if bad range or no cell ~cCompEquiCodes(); static void Bench(size_t aNBB,size_t aPer,bool Miror); diff --git a/MMVII/src/CodedTarget/cGenerateEncoding.cpp b/MMVII/src/CodedTarget/cGenerateEncoding.cpp index 98681c6fa9..4647494398 100755 --- a/MMVII/src/CodedTarget/cGenerateEncoding.cpp +++ b/MMVII/src/CodedTarget/cGenerateEncoding.cpp @@ -427,7 +427,8 @@ int cAppliGenerateEncoding::Exe() for (size_t aK=0 ; aKCellOfCode(aVCode[aK].y()); + cCelCC * aCel = mCEC->CellOfCode(aVCode[aK].y()); + aCel->mNum = aVCode[aK].x(); MMVII_INTERNAL_ASSERT_bench(aCel!=0,"CellOfCode in3D AICON"); MMVII_INTERNAL_ASSERT_bench(aVCode[aK].y()==(int)aCel->mLowCode,"CellOfCode in3D AICON"); } @@ -539,6 +540,9 @@ int cAppliGenerateEncoding::Exe() for (size_t aK1=0 ; aK1mNum << "\n"; + MMVII_INTERNAL_ASSERT_strong(mVOC[aK1]->mNum>=0,"Num was not correctly set in cCelCC"); + aNum = mVOC[aK1]->mNum; size_t aCode = mVOC[aK1]->mLowCode; aBE.AddOneEncoding(aNum,aCode); // add a new encoding diff --git a/MMVII/src/UtiMaths/bitcoding.cpp b/MMVII/src/UtiMaths/bitcoding.cpp index ce705356b9..c2b63ac9ae 100755 --- a/MMVII/src/UtiMaths/bitcoding.cpp +++ b/MMVII/src/UtiMaths/bitcoding.cpp @@ -227,7 +227,8 @@ size_t MaxRun2Length(tU_INT4 aVal,size_t aPow2) /* *************************** */ cCelCC::cCelCC(size_t aLowestCode) : - mLowCode (aLowestCode) + mLowCode (aLowestCode), + mNum (-1) { } @@ -257,7 +258,7 @@ size_t cCelCC::HammingDist(const cCelCC & aC2) const cCompEquiCodes::cCompEquiCodes(size_t aNbBits,size_t aPer,bool WithMirror) : mNbBits (aNbBits), mPeriod (aPer), - mNbCodeUC (size_t(1)<mNum = mVecOfCells.size(); mVecOfCells.push_back(aNewCel); AddCodeWithPermCirc(aCode,aNewCel); @@ -314,10 +316,14 @@ const cCelCC & cCompEquiCodes::CellOfCodeOK(size_t aCode) const const cCelCC * cCompEquiCodes::CellOfCode(size_t aCode) const { if (aCode>=mVCodes2Cell.size()) return nullptr; - return mVCodes2Cell.at(aCode); } +cCelCC * cCompEquiCodes::CellOfCode(size_t aCode) +{ + if (aCode>=mVCodes2Cell.size()) return nullptr; + return mVCodes2Cell.at(aCode); +} void cCompEquiCodes::AddCodeWithPermCirc(size_t aCode,cCelCC * aNewCel)