From: abn Date: Wed, 20 Jan 2016 14:09:27 +0000 (+0100) Subject: MEDCoupling API renaming - stage #2 X-Git-Tag: V8_0_0b1~6 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=f69372fbd5c16c9923633938f0a57e58cd8f4fd5;p=tools%2Fmedcoupling.git MEDCoupling API renaming - stage #2 DataArray*::search -> DataArray*::findIdSequence DataArray*::substr -> DataArray*::subArray --- diff --git a/doc/user/doxygen/fakesources/MEDCouplingMemArray.C b/doc/user/doxygen/fakesources/MEDCouplingMemArray.C index 3f902e5b7..cd0fe1bda 100644 --- a/doc/user/doxygen/fakesources/MEDCouplingMemArray.C +++ b/doc/user/doxygen/fakesources/MEDCouplingMemArray.C @@ -285,7 +285,7 @@ DataArrayDouble::selectByTupleId(const int* new2OldBg, const int* new2OldEnd) co DataArrayDouble::selectByTupleIdSafe(const int* new2OldBg, const int* new2OldEnd) const; DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const; DataArrayDouble::selectByTupleRanges(const std::vector >& ranges) const; -DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd=-1) const; +DataArrayDouble::subArray(int tupleIdBg, int tupleIdEnd=-1) const; DataArrayDouble::rearrange(int newNbOfCompo); DataArrayDouble::transpose(); DataArrayDouble::changeNbOfComponents(int newNbOfComp, double dftValue) const; @@ -480,7 +480,7 @@ DataArrayInt::changeSurjectiveFormat(int targetNb, DataArrayInt *&arr, DataArray DataArrayInt::buildPermArrPerLevel() const; DataArrayInt::isIdentity2(int sizeExpected) const; DataArrayInt::isUniform(int val) const; -DataArrayInt::substr(int tupleIdBg, int tupleIdEnd=-1) const; +DataArrayInt::subArray(int tupleIdBg, int tupleIdEnd=-1) const; DataArrayInt::rearrange(int newNbOfCompo); DataArrayInt::transpose(); DataArrayInt::changeNbOfComponents(int newNbOfComp, int dftValue) const; @@ -585,7 +585,7 @@ DataArrayInt::end() const; DataArrayInt::locateTuple(const std::vector& tupl) const; DataArrayInt::locateValue(int value) const; DataArrayInt::locateValue(const std::vector& vals) const; -DataArrayInt::search(const std::vector& vals) const; +DataArrayInt::findIdSequence(const std::vector& vals) const; DataArrayInt::presenceOfTuple(const std::vector& tupl) const; DataArrayInt::accumulate(int* res) const; DataArrayInt::accumulate(int compId) const; diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 75979d5eb..a53430517 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -1463,7 +1463,7 @@ DataArrayDouble *DataArrayDouble::toNoInterlace() const * Permutes values of \a this array as required by \a old2New array. The values are * permuted so that \c new[ \a old2New[ i ]] = \c old[ i ]. Number of tuples remains * the same as in \c this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] old2New - C array of length equal to \a this->getNumberOfTuples() * giving a new position for i-th old value. @@ -1556,7 +1556,7 @@ DataArrayDouble *DataArrayDouble::renumber(const int *old2New) const * Returns a copy of \a this array with values permuted as required by \a new2Old array. * The values are permuted so that \c new[ i ] = \c old[ \a new2Old[ i ]]. Number of * tuples in the result array remains the same as in \c this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] new2Old - C array of length equal to \a this->getNumberOfTuples() * giving a previous position of i-th new value. @@ -1700,7 +1700,7 @@ DataArrayDouble *DataArrayDouble::selectByTupleIdSafe(const int *new2OldBg, cons * \param [in] step - index increment to get index of the next tuple to copy. * \return DataArrayDouble * - the new instance of DataArrayDouble that the caller * is to delete using decrRef() as it is no more needed. - * \sa DataArrayDouble::substr. + * \sa DataArrayDouble::subArray. */ DataArrayDouble *DataArrayDouble::selectByTupleIdSafeSlice(int bg, int end2, int step) const { @@ -1796,19 +1796,19 @@ DataArray *DataArrayDouble::selectByTupleRanges(const std::vectorgetNumberOfTuples(). * \sa DataArrayDouble::selectByTupleIdSafeSlice */ -DataArrayDouble *DataArrayDouble::substr(int tupleIdBg, int tupleIdEnd) const +DataArrayDouble *DataArrayDouble::subArray(int tupleIdBg, int tupleIdEnd) const { checkAllocated(); int nbt=getNumberOfTuples(); if(tupleIdBg<0) - throw INTERP_KERNEL::Exception("DataArrayDouble::substr : The tupleIdBg parameter must be greater than 0 !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::subArray : The tupleIdBg parameter must be greater than 0 !"); if(tupleIdBg>nbt) - throw INTERP_KERNEL::Exception("DataArrayDouble::substr : The tupleIdBg parameter is greater than number of tuples !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::subArray : The tupleIdBg parameter is greater than number of tuples !"); int trueEnd=tupleIdEnd; if(tupleIdEnd!=-1) { if(tupleIdEnd>nbt) - throw INTERP_KERNEL::Exception("DataArrayDouble::substr : The tupleIdBg parameter is greater or equal than number of tuples !"); + throw INTERP_KERNEL::Exception("DataArrayDouble::subArray : The tupleIdBg parameter is greater or equal than number of tuples !"); } else trueEnd=nbt; @@ -7205,7 +7205,7 @@ DataArrayInt *DataArrayInt::toNoInterlace() const * Permutes values of \a this array as required by \a old2New array. The values are * permuted so that \c new[ \a old2New[ i ]] = \c old[ i ]. Number of tuples remains * the same as in \c this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] old2New - C array of length equal to \a this->getNumberOfTuples() * giving a new position for i-th old value. @@ -7298,7 +7298,7 @@ DataArrayInt *DataArrayInt::renumber(const int *old2New) const * Returns a copy of \a this array with values permuted as required by \a new2Old array. * The values are permuted so that \c new[ i ] = \c old[ \a new2Old[ i ]]. Number of * tuples in the result array remains the same as in \c this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] new2Old - C array of length equal to \a this->getNumberOfTuples() * giving a previous position of i-th new value. @@ -7437,7 +7437,7 @@ DataArrayInt *DataArrayInt::selectByTupleIdSafe(const int *new2OldBg, const int * \param [in] step - index increment to get index of the next tuple to copy. * \return DataArrayInt * - the new instance of DataArrayInt that the caller * is to delete using decrRef() as it is no more needed. - * \sa DataArrayInt::substr. + * \sa DataArrayInt::subArray. */ DataArrayInt *DataArrayInt::selectByTupleIdSafeSlice(int bg, int end2, int step) const { @@ -7853,19 +7853,19 @@ DataArrayDouble *DataArrayInt::convertToDblArr() const \throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples(). * \sa DataArrayInt::selectByTupleIdSafeSlice */ -DataArrayInt *DataArrayInt::substr(int tupleIdBg, int tupleIdEnd) const +DataArrayInt *DataArrayInt::subArray(int tupleIdBg, int tupleIdEnd) const { checkAllocated(); int nbt=getNumberOfTuples(); if(tupleIdBg<0) - throw INTERP_KERNEL::Exception("DataArrayInt::substr : The tupleIdBg parameter must be greater than 0 !"); + throw INTERP_KERNEL::Exception("DataArrayInt::subArray : The tupleIdBg parameter must be greater than 0 !"); if(tupleIdBg>nbt) - throw INTERP_KERNEL::Exception("DataArrayInt::substr : The tupleIdBg parameter is greater than number of tuples !"); + throw INTERP_KERNEL::Exception("DataArrayInt::subArray : The tupleIdBg parameter is greater than number of tuples !"); int trueEnd=tupleIdEnd; if(tupleIdEnd!=-1) { if(tupleIdEnd>nbt) - throw INTERP_KERNEL::Exception("DataArrayInt::substr : The tupleIdBg parameter is greater or equal than number of tuples !"); + throw INTERP_KERNEL::Exception("DataArrayInt::subArray : The tupleIdBg parameter is greater or equal than number of tuples !"); } else trueEnd=nbt; @@ -8966,7 +8966,7 @@ DataArrayInt *DataArrayInt::findIdsNotEqualList(const int *valsBg, const int *va * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. * * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. - * \sa DataArrayInt::search, DataArrayInt::presenceOfTuple. + * \sa DataArrayInt::findIdSequence, DataArrayInt::presenceOfTuple. */ int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const { @@ -9001,12 +9001,12 @@ int DataArrayInt::findIdFirstEqualTuple(const std::vector& tupl) const * This method differs from DataArrayInt::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayInt::findIdFirstEqualTuple. * \sa DataArrayInt::findIdFirstEqualTuple */ -int DataArrayInt::search(const std::vector& vals) const +int DataArrayInt::findIdSequence(const std::vector& vals) const { checkAllocated(); int nbOfCompo=getNumberOfComponents(); if(nbOfCompo!=1) - throw INTERP_KERNEL::Exception("DataArrayInt::search : works only for DataArrayInt instance with one component !"); + throw INTERP_KERNEL::Exception("DataArrayInt::findIdSequence : works only for DataArrayInt instance with one component !"); const int *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); const int *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 1232b7b1e..51723e5f4 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -266,7 +266,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const; MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const; - MEDCOUPLING_EXPORT DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const; + MEDCOUPLING_EXPORT DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); MEDCOUPLING_EXPORT void transpose(); MEDCOUPLING_EXPORT DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const; @@ -522,7 +522,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayInt *buildPermArrPerLevel() const; MEDCOUPLING_EXPORT bool isIota(int sizeExpected) const; MEDCOUPLING_EXPORT bool isUniform(int val) const; - MEDCOUPLING_EXPORT DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const; + MEDCOUPLING_EXPORT DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); MEDCOUPLING_EXPORT void transpose(); MEDCOUPLING_EXPORT DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const; @@ -562,7 +562,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const; MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; - MEDCOUPLING_EXPORT int search(const std::vector& vals) const; + MEDCOUPLING_EXPORT int findIdSequence(const std::vector& vals) const; MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT bool presenceOfValue(int value) const; MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; @@ -728,7 +728,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end, int step) const; MEDCOUPLING_EXPORT bool isUniform(char val) const; MEDCOUPLING_EXPORT void rearrange(int newNbOfCompo); - MEDCOUPLING_EXPORT DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const; + MEDCOUPLING_EXPORT DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const; MEDCOUPLING_EXPORT DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const; MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const; MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other); @@ -757,7 +757,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT const char *end() const { return getConstPointer()+getNbOfElems(); } MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const; MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) const; - MEDCOUPLING_EXPORT int search(const std::vector& vals) const; + MEDCOUPLING_EXPORT int findIdSequence(const std::vector& vals) const; MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const; MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector& vals) const; diff --git a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx index 99d19fbff..077f567e4 100644 --- a/src/MEDCoupling/MEDCouplingMemArrayChar.cxx +++ b/src/MEDCoupling/MEDCouplingMemArrayChar.cxx @@ -379,7 +379,7 @@ DataArrayInt *DataArrayChar::convertToIntArr() const * Permutes values of \a this array as required by \a old2New array. The values are * permuted so that \c new[ \a old2New[ i ]] = \c old[ i ]. Number of tuples remains * the same as in \this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] old2New - C array of length equal to \a this->getNumberOfTuples() * giving a new position for i-th old value. @@ -452,7 +452,7 @@ DataArrayChar *DataArrayChar::renumber(const int *old2New) const * Returns a copy of \a this array with values permuted as required by \a new2Old array. * The values are permuted so that \c new[ i ] = \c old[ \a new2Old[ i ]]. Number of * tuples in the result array remains the same as in \this one. - * If a permutation reduction is needed, substr() or selectByTupleId() should be used. + * If a permutation reduction is needed, subArray() or selectByTupleId() should be used. * For more info on renumbering see \ref numbering. * \param [in] new2Old - C array of length equal to \a this->getNumberOfTuples() * giving a previous position of i-th new value. @@ -647,7 +647,7 @@ void DataArrayChar::rearrange(int newNbOfCompo) /*! * Returns a shorten copy of \a this array. The new DataArrayChar contains all * tuples starting from the \a tupleIdBg-th tuple and including all tuples located before - * the \a tupleIdEnd-th one. This methods has a similar behavior as std::string::substr(). + * the \a tupleIdEnd-th one. This methods has a similar behavior as std::string::subArray(). * This method is a specialization of selectByTupleIdSafeSlice(). * \param [in] tupleIdBg - index of the first tuple to copy from \a this array. * \param [in] tupleIdEnd - index of the tuple before which the tuples to copy are located. @@ -659,7 +659,7 @@ void DataArrayChar::rearrange(int newNbOfCompo) \throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples(). * \sa DataArrayChar::selectByTupleIdSafeSlice */ -DataArrayChar *DataArrayChar::substr(int tupleIdBg, int tupleIdEnd) const +DataArrayChar *DataArrayChar::subArray(int tupleIdBg, int tupleIdEnd) const { checkAllocated(); int nbt=getNumberOfTuples(); @@ -1594,12 +1594,12 @@ DataArrayInt *DataArrayChar::findIdsNotEqual(char val) const * This method differs from DataArrayChar::findIdFirstEqualTuple in that the position is internal raw data is not considered here contrary to DataArrayChar::findIdFirstEqualTuple. * \sa DataArrayChar::findIdFirstEqualTuple */ -int DataArrayChar::search(const std::vector& vals) const +int DataArrayChar::findIdSequence(const std::vector& vals) const { checkAllocated(); int nbOfCompo=getNumberOfComponents(); if(nbOfCompo!=1) - throw INTERP_KERNEL::Exception("DataArrayChar::search : works only for DataArrayChar instance with one component !"); + throw INTERP_KERNEL::Exception("DataArrayChar::findIdSequence : works only for DataArrayChar instance with one component !"); const char *cptr=getConstPointer(); std::size_t nbOfVals=getNbOfElems(); const char *loc=std::search(cptr,cptr+nbOfVals,vals.begin(),vals.end()); @@ -1618,7 +1618,7 @@ int DataArrayChar::search(const std::vector& vals) const * the input vector. An INTERP_KERNEL::Exception is thrown too if \b this is not allocated. * * \return tuple id where \b tupl is. -1 if no such tuple exists in \b this. - * \sa DataArrayChar::search. + * \sa DataArrayChar::findIdSequence. */ int DataArrayChar::findIdFirstEqualTuple(const std::vector& tupl) const { diff --git a/src/MEDCoupling/MEDCouplingPointSet.cxx b/src/MEDCoupling/MEDCouplingPointSet.cxx index 1710b932d..eb1c284eb 100644 --- a/src/MEDCoupling/MEDCouplingPointSet.cxx +++ b/src/MEDCoupling/MEDCouplingPointSet.cxx @@ -1481,7 +1481,7 @@ void MEDCouplingPointSet::checkDeepEquivalWith(const MEDCouplingMesh *other, int throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !"); m->renumberNodes(da->getConstPointer(),newNbOfNodes); // - MCAuto nodeCor2=da->substr(oldNbOfNodes); + MCAuto nodeCor2=da->subArray(oldNbOfNodes); da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes); // da=m->zipConnectivityTraducer(cellCompPol); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index ff320449f..0bfd7174d 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -1932,7 +1932,7 @@ bool MEDCouplingUMesh::areCellsIncludedIn(const MEDCouplingUMesh *other, int com throw INTERP_KERNEL::Exception(oss.str().c_str()); } MCAuto o2n=mesh->zipConnectivityTraducer(compType,nbOfCells); - arr=o2n->substr(nbOfCells); + arr=o2n->subArray(nbOfCells); arr->setName(other->getName()); int tmp; if(other->getNumberOfCells()==0) diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index bd99d6729..528fc1a3a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -91,12 +91,12 @@ void MEDCouplingBasicsTest1::testArray3() CPPUNIT_ASSERT_EQUAL(7,arr1->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr1->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr1Ref,arr1Ref+14,arr1->getConstPointer())); - DataArrayInt *arr2=arr1->substr(3); + DataArrayInt *arr2=arr1->subArray(3); CPPUNIT_ASSERT_EQUAL(4,arr2->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr2->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr1Ref+6,arr1Ref+14,arr2->getConstPointer())); arr2->decrRef(); - DataArrayInt *arr3=arr1->substr(2,5); + DataArrayInt *arr3=arr1->subArray(2,5); CPPUNIT_ASSERT_EQUAL(3,arr3->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr3->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr1Ref+4,arr1Ref+10,arr3->getConstPointer())); @@ -111,12 +111,12 @@ void MEDCouplingBasicsTest1::testArray3() CPPUNIT_ASSERT_EQUAL(7,arr4->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr4->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr4Ref,arr4Ref+14,arr4->getConstPointer())); - DataArrayDouble *arr5=arr4->substr(3); + DataArrayDouble *arr5=arr4->subArray(3); CPPUNIT_ASSERT_EQUAL(4,arr5->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr5->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr4Ref+6,arr4Ref+14,arr5->getConstPointer())); arr5->decrRef(); - DataArrayDouble *arr6=arr4->substr(2,5); + DataArrayDouble *arr6=arr4->subArray(2,5); CPPUNIT_ASSERT_EQUAL(3,arr6->getNumberOfTuples()); CPPUNIT_ASSERT_EQUAL(2,arr6->getNumberOfComponents()); CPPUNIT_ASSERT(std::equal(arr4Ref+4,arr4Ref+10,arr6->getConstPointer())); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx index 7b75d55bb..229502ee2 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest2.cxx @@ -103,7 +103,7 @@ void MEDCouplingBasicsTest2::testGaussPointField1() CPPUNIT_ASSERT_EQUAL(2,(int)tmpIds.size()); CPPUNIT_ASSERT(std::equal(ids2,ids2+2,tmpIds.begin())); CPPUNIT_ASSERT_THROW(f->checkConsistencyLight(),INTERP_KERNEL::Exception);//<- it's always not ok because undelying array not with the good size. - DataArrayDouble *array2=f->getArray()->substr(0,10); + DataArrayDouble *array2=f->getArray()->subArray(0,10); f->setArray(array2); array2->decrRef(); f->checkConsistencyLight();//<- here it is OK diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx index 27d40f496..bfb65596d 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest3.cxx @@ -941,9 +941,9 @@ void MEDCouplingBasicsTest3::testElementaryDAThrowAndSpecialCases() CPPUNIT_ASSERT(!((ret.str().find("16 15 14 13 12 11 10"))==std::string::npos)); CPPUNIT_ASSERT_THROW(dbl->selectByTupleIdSafeSlice(0,1,-1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dbl->substr(-1,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dbl->substr(8,1),INTERP_KERNEL::Exception); - CPPUNIT_ASSERT_THROW(dbl->substr(0,8),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dbl->subArray(-1,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dbl->subArray(8,1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(dbl->subArray(0,8),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->meldWith(dd),INTERP_KERNEL::Exception); CPPUNIT_ASSERT_THROW(dbl->setPartOfValuesAdv(dbl2,da),INTERP_KERNEL::Exception); //dbl dbl2 not have the same number of components diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py index 94e074eae..549527b6b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest1.py @@ -45,11 +45,11 @@ class MEDCouplingBasicsTest1(unittest.TestCase): self.assertEqual(7,arr1.getNumberOfTuples()); self.assertEqual(2,arr1.getNumberOfComponents()); self.assertEqual(arr1Ref,list(arr1.getValues())); - arr2=arr1.substr(3); + arr2=arr1.subArray(3); self.assertEqual(4,arr2.getNumberOfTuples()); self.assertEqual(2,arr2.getNumberOfComponents()); self.assertEqual(arr1Ref[6:],list(arr2.getValues())); - arr3=arr1.substr(2,5); + arr3=arr1.subArray(2,5); self.assertEqual(3,arr3.getNumberOfTuples()); self.assertEqual(2,arr3.getNumberOfComponents()); self.assertEqual(arr1Ref[4:10],list(arr3.getValues())); @@ -63,14 +63,14 @@ class MEDCouplingBasicsTest1(unittest.TestCase): for i in xrange(14): self.assertTrue(abs(arr4Ref[i]-tmp[i])<1e-14); pass - arr5=arr4.substr(3); + arr5=arr4.subArray(3); self.assertEqual(4,arr5.getNumberOfTuples()); self.assertEqual(2,arr5.getNumberOfComponents()); tmp=arr5.getValues() for i in xrange(8): self.assertTrue(abs(arr4Ref[6+i]-tmp[i])<1e-14); pass - arr6=arr4.substr(2,5); + arr6=arr4.subArray(2,5); self.assertEqual(3,arr6.getNumberOfTuples()); self.assertEqual(2,arr6.getNumberOfComponents()); tmp=arr6.getValues() @@ -2122,7 +2122,7 @@ class MEDCouplingBasicsTest1(unittest.TestCase): tmpIds=f.getCellIdsHavingGaussLocalization(0); self.assertEqual(ids2,list(tmpIds.getValues())); self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- it's always not ok because undelying array not with the good size. - array2=f.getArray().substr(0,10); + array2=f.getArray().subArray(0,10); f.setArray(array2); f.checkConsistencyLight();#<- here it is OK f2=f.clone(True); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py index 4a63f9ac2..fabd7936e 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest2.py @@ -1727,9 +1727,9 @@ class MEDCouplingBasicsTest2(unittest.TestCase): self.assertTrue(not ((dbl.reprZip().find("Number of components : 1"))==-1)); self.assertRaises(InterpKernelException, dbl.selectByTupleIdSafeSlice, 0, 1, -1); - self.assertRaises(InterpKernelException, dbl.substr, -1, 1); - self.assertRaises(InterpKernelException, dbl.substr, 8, 1); - self.assertRaises(InterpKernelException, dbl.substr, 0, 8); + self.assertRaises(InterpKernelException, dbl.subArray, -1, 1); + self.assertRaises(InterpKernelException, dbl.subArray, 8, 1); + self.assertRaises(InterpKernelException, dbl.subArray, 0, 8); self.assertRaises(InterpKernelException, dbl.meldWith, dd); self.assertRaises(InterpKernelException, dbl.setPartOfValuesAdv, dbl2, da); #dbl dbl2 not have the same number of components diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py index 76b25ab88..a4106d88b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest4.py @@ -958,8 +958,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertEqual(0,da.index(7)) self.assertEqual(10,da.index(47)) self.assertTrue(14 not in da) - self.assertEqual(5,da.search([9,9])) - self.assertEqual(-1,da.search([5,8])) + self.assertEqual(5,da.findIdSequence([9,9])) + self.assertEqual(-1,da.findIdSequence([5,8])) da.rearrange(2) self.assertTrue([47,16] not in da) self.assertTrue([5,6] not in da) @@ -2762,8 +2762,8 @@ class MEDCouplingBasicsTest4(unittest.TestCase): self.assertTrue(e.isEqual(DataArrayInt([0,1,2,5,6,7,10,11,12,15,16,17,20,21,22,25,26,27,30,31,32,35,36,37,40,41,42,45,46,47,50,51,52,55,56,57,61,62]))) self.assertEqual(("d",6),dd3.getMaxValue()) self.assertEqual(("A",0),dd3.getMinValue()) - self.assertEqual(26,dd3.search("LGYYM")) - self.assertEqual(-1,dd3.search("LGYYN")) + self.assertEqual(26,dd3.findIdSequence("LGYYM")) + self.assertEqual(-1,dd3.findIdSequence("LGYYN")) dd3.rearrange(5) self.assertEqual(7,dd3.findIdFirstEqualTuple("OPGYY")) self.assertTrue("OPGYY" in dd3) diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index a56db7e2e..455b6bd3c 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -52,7 +52,7 @@ %newobject MEDCoupling::DataArrayInt::__iter__; %newobject MEDCoupling::DataArrayInt::convertToDblArr; %newobject MEDCoupling::DataArrayInt::performCopyOrIncrRef; -%newobject MEDCoupling::DataArrayInt::substr; +%newobject MEDCoupling::DataArrayInt::subArray; %newobject MEDCoupling::DataArrayInt::changeNbOfComponents; %newobject MEDCoupling::DataArrayInt::accumulatePerChunck; %newobject MEDCoupling::DataArrayInt::checkAndPreparePermutation; @@ -132,7 +132,7 @@ %newobject MEDCoupling::DataArrayByte::__iter__; %newobject MEDCoupling::DataArrayByte::performCopyOrIncrRef; %newobject MEDCoupling::DataArrayByteTuple::buildDAByte; -%newobject MEDCoupling::DataArrayChar::substr; +%newobject MEDCoupling::DataArrayChar::subArray; %newobject MEDCoupling::DataArrayAsciiChar::New; %newobject MEDCoupling::DataArrayAsciiChar::__iter__; %newobject MEDCoupling::DataArrayAsciiChar::performCopyOrIncrRef; @@ -150,7 +150,7 @@ %newobject MEDCoupling::DataArrayDouble::Multiply; %newobject MEDCoupling::DataArrayDouble::Divide; %newobject MEDCoupling::DataArrayDouble::Pow; -%newobject MEDCoupling::DataArrayDouble::substr; +%newobject MEDCoupling::DataArrayDouble::subArray; %newobject MEDCoupling::DataArrayDouble::changeNbOfComponents; %newobject MEDCoupling::DataArrayDouble::accumulatePerChunck; %newobject MEDCoupling::DataArrayDouble::findIdsInRange; @@ -555,7 +555,7 @@ namespace MEDCoupling DataArrayInt *convertToIntArr() const throw(INTERP_KERNEL::Exception); DataArrayDouble *fromNoInterlace() const throw(INTERP_KERNEL::Exception); DataArrayDouble *toNoInterlace() const throw(INTERP_KERNEL::Exception); - DataArrayDouble *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); + DataArrayDouble *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); void transpose() throw(INTERP_KERNEL::Exception); DataArrayDouble *changeNbOfComponents(int newNbOfComp, double dftValue) const throw(INTERP_KERNEL::Exception); void meldWith(const DataArrayDouble *other) throw(INTERP_KERNEL::Exception); @@ -2622,7 +2622,7 @@ namespace MEDCoupling DataArrayInt *buildPermArrPerLevel() const throw(INTERP_KERNEL::Exception); bool isIota(int sizeExpected) const throw(INTERP_KERNEL::Exception); bool isUniform(int val) const throw(INTERP_KERNEL::Exception); - DataArrayInt *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); + DataArrayInt *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); void transpose() throw(INTERP_KERNEL::Exception); DataArrayInt *changeNbOfComponents(int newNbOfComp, int dftValue) const throw(INTERP_KERNEL::Exception); void meldWith(const DataArrayInt *other) throw(INTERP_KERNEL::Exception); @@ -2647,7 +2647,7 @@ namespace MEDCoupling int findIdFirstEqualTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception); int findIdFirstEqual(const std::vector& vals) const throw(INTERP_KERNEL::Exception); - int search(const std::vector& vals) const throw(INTERP_KERNEL::Exception); + int findIdSequence(const std::vector& vals) const throw(INTERP_KERNEL::Exception); bool presenceOfTuple(const std::vector& tupl) const throw(INTERP_KERNEL::Exception); bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception); bool presenceOfValue(const std::vector& vals) const throw(INTERP_KERNEL::Exception); @@ -4968,7 +4968,7 @@ namespace MEDCoupling DataArrayChar *renumberR(const int *new2Old) const throw(INTERP_KERNEL::Exception); DataArrayChar *renumberAndReduce(const int *old2NewBg, int newNbOfTuple) const throw(INTERP_KERNEL::Exception); bool isUniform(char val) const throw(INTERP_KERNEL::Exception); - DataArrayChar *substr(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); + DataArrayChar *subArray(int tupleIdBg, int tupleIdEnd=-1) const throw(INTERP_KERNEL::Exception); DataArrayChar *changeNbOfComponents(int newNbOfComp, char dftValue) const throw(INTERP_KERNEL::Exception); void meldWith(const DataArrayChar *other) throw(INTERP_KERNEL::Exception); void setPartOfValuesAdv(const DataArrayChar *a, const DataArrayChar *tuplesSelec) throw(INTERP_KERNEL::Exception); @@ -5301,14 +5301,14 @@ namespace MEDCoupling return self->findIdFirstEqualTuple(vals); } - int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) + int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) { int sz=-1,sw=-1; int ival=-1; std::vector ivval; const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval); std::vector vals(sz); std::copy(pt,pt+sz,vals.begin()); - return self->search(vals); + return self->findIdSequence(vals); } PyObject *getTuple(int tupleId) throw(INTERP_KERNEL::Exception) @@ -5849,14 +5849,14 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayAsciiChar::findIdFirstEqualTuple : only strings in input supported !"); } - int search(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) + int findIdSequence(PyObject *strOrListOfInt) const throw(INTERP_KERNEL::Exception) { if(PyString_Check(strOrListOfInt)) { Py_ssize_t sz=PyString_Size(strOrListOfInt); std::vector vals(sz); std::copy(PyString_AsString(strOrListOfInt),PyString_AsString(strOrListOfInt)+sz,vals.begin()); - return self->search(vals); + return self->findIdSequence(vals); } else throw INTERP_KERNEL::Exception("DataArrayAsciiChar::search : only strings in input supported !"); diff --git a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py index 4b954c468..6e99259a3 100644 --- a/src/MEDCoupling_Swig/MEDCouplingPickleTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingPickleTest.py @@ -271,7 +271,7 @@ class MEDCouplingPickleTest(unittest.TestCase): tmpIds=f.getCellIdsHavingGaussLocalization(0); self.assertEqual(ids2,list(tmpIds.getValues())); self.assertRaises(InterpKernelException,f.checkConsistencyLight);#<- it's always not ok because undelying array not with the good size. - array2=f.getArray().substr(0,10); + array2=f.getArray().subArray(0,10); f.setArray(array2); f.checkConsistencyLight(); #### diff --git a/src/MEDLoader/MEDFileField.cxx b/src/MEDLoader/MEDFileField.cxx index 8a0509d16..c22cc1484 100644 --- a/src/MEDLoader/MEDFileField.cxx +++ b/src/MEDLoader/MEDFileField.cxx @@ -928,7 +928,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++) { int startOfEltIdOfChunk=(*it)->_start; - MCAuto newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); + MCAuto newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval); MCAuto rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges); MCAuto idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges); // @@ -945,7 +945,7 @@ bool MEDFileFieldPerMeshPerTypePerDisc::RenumberChunks(int offset, const std::ve // MCAuto renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel(); // - MCAuto arrPart=arr->substr(offset,offset+szTuples); + MCAuto arrPart=arr->subArray(offset,offset+szTuples); arrPart->renumberInPlace(renumTupleIds->begin()); arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1); bool ret=false; diff --git a/src/MEDLoader/MEDFileMeshLL.cxx b/src/MEDLoader/MEDFileMeshLL.cxx index a9a458b0f..f46f9b0c7 100644 --- a/src/MEDLoader/MEDFileMeshLL.cxx +++ b/src/MEDLoader/MEDFileMeshLL.cxx @@ -1233,11 +1233,11 @@ void MEDFileUMeshSplitL1::write(med_idt fid, const std::string& mName, int mdim) MCAuto fam,num; MCAuto names; if((const DataArrayInt *)_fam) - fam=_fam->substr(start,end); + fam=_fam->subArray(start,end); if((const DataArrayInt *)_num) - num=_num->substr(start,end); + num=_num->subArray(start,end); if((const DataArrayAsciiChar *)_names) - names=static_cast(_names->substr(start,end)); + names=static_cast(_names->subArray(start,end)); MEDFileUMeshPerType::Write(fid,mName,mdim,(*it),fam,num,names); start=end; } diff --git a/src/MEDLoader/Swig/MEDLoaderTest3.py b/src/MEDLoader/Swig/MEDLoaderTest3.py index 29aa66cb7..95bd6a69a 100644 --- a/src/MEDLoader/Swig/MEDLoaderTest3.py +++ b/src/MEDLoader/Swig/MEDLoaderTest3.py @@ -2162,10 +2162,10 @@ class MEDLoaderTest(unittest.TestCase): namesCellL0=DataArrayAsciiChar(6,16) namesCellL0[:]=["CellL0#%.3d "%(i) for i in xrange(6)] mm.setNameFieldAtLevel(0,namesCellL0) - namesCellL1=DataArrayAsciiChar.Aggregate([namesCellL0,namesCellL0,namesCellL0.substr(2)]) + namesCellL1=DataArrayAsciiChar.Aggregate([namesCellL0,namesCellL0,namesCellL0.subArray(2)]) namesCellL1[:]=["CellLM1#%.3d "%(i) for i in xrange(16)] mm.setNameFieldAtLevel(-1,namesCellL1) - namesNodes=namesCellL1.substr(4,16) + namesNodes=namesCellL1.subArray(4,16) namesNodes[:]=["Node#%.3d "%(i) for i in xrange(12)] mm.setNameFieldAtLevel(1,namesNodes) mm.write(fname,2)