DataArrayDouble::selectByTupleIdSafe(const int* new2OldBg, const int* new2OldEnd) const;
DataArrayDouble::selectByTupleId2(int bg, int end2, int step) const;
DataArrayDouble::selectByTupleRanges(const std::vector<std::pair<int,int> >& 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;
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;
DataArrayInt::locateTuple(const std::vector<int>& tupl) const;
DataArrayInt::locateValue(int value) const;
DataArrayInt::locateValue(const std::vector<int>& vals) const;
-DataArrayInt::search(const std::vector<int>& vals) const;
+DataArrayInt::findIdSequence(const std::vector<int>& vals) const;
DataArrayInt::presenceOfTuple(const std::vector<int>& tupl) const;
DataArrayInt::accumulate(int* res) const;
DataArrayInt::accumulate(int compId) 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.
* 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.
* \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
{
\throw If \a tupleIdEnd != -1 && \a tupleIdEnd < \a this->getNumberOfTuples().
* \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;
* 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.
* 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.
* \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
{
\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;
* 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<int>& 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<int>& vals) const
+int DataArrayInt::findIdSequence(const std::vector<int>& 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());
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<std::pair<int,int> >& 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;
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;
MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<int>& tupl) const;
MEDCOUPLING_EXPORT int findIdFirstEqual(int value) const;
MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<int>& vals) const;
- MEDCOUPLING_EXPORT int search(const std::vector<int>& vals) const;
+ MEDCOUPLING_EXPORT int findIdSequence(const std::vector<int>& vals) const;
MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector<int>& tupl) const;
MEDCOUPLING_EXPORT bool presenceOfValue(int value) const;
MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector<int>& vals) const;
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<int>& compoIds) const;
MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other);
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<char>& vals) const;
+ MEDCOUPLING_EXPORT int findIdSequence(const std::vector<char>& vals) const;
MEDCOUPLING_EXPORT int findIdFirstEqualTuple(const std::vector<char>& tupl) const;
MEDCOUPLING_EXPORT int findIdFirstEqual(char value) const;
MEDCOUPLING_EXPORT int findIdFirstEqual(const std::vector<char>& vals) 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.
* 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.
/*!
* 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.
\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();
* 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<char>& vals) const
+int DataArrayChar::findIdSequence(const std::vector<char>& 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());
* 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<char>& tupl) const
{
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some nodes in other are not in this !");
m->renumberNodes(da->getConstPointer(),newNbOfNodes);
//
- MCAuto<DataArrayInt> nodeCor2=da->substr(oldNbOfNodes);
+ MCAuto<DataArrayInt> nodeCor2=da->subArray(oldNbOfNodes);
da=m->mergeNodes(prec,areNodesMerged,newNbOfNodes);
//
da=m->zipConnectivityTraducer(cellCompPol);
throw INTERP_KERNEL::Exception(oss.str().c_str());
}
MCAuto<DataArrayInt> o2n=mesh->zipConnectivityTraducer(compType,nbOfCells);
- arr=o2n->substr(nbOfCells);
+ arr=o2n->subArray(nbOfCells);
arr->setName(other->getName());
int tmp;
if(other->getNumberOfCells()==0)
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()));
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()));
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
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
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()));
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()
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);
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
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)
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)
%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;
%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;
%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;
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);
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);
int findIdFirstEqualTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
int findIdFirstEqual(int value) const throw(INTERP_KERNEL::Exception);
int findIdFirstEqual(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
- int search(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
+ int findIdSequence(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
bool presenceOfTuple(const std::vector<int>& tupl) const throw(INTERP_KERNEL::Exception);
bool presenceOfValue(int value) const throw(INTERP_KERNEL::Exception);
bool presenceOfValue(const std::vector<int>& vals) const throw(INTERP_KERNEL::Exception);
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);
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<int> ivval;
const int *pt=convertObjToPossibleCpp1_Safe(strOrListOfInt,sw,sz,ival,ivval);
std::vector<char> 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)
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<char> 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 !");
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();
####
for(std::vector< const MEDFileFieldPerMeshPerTypePerDisc *>::const_iterator it=entriesOnSameDisc.begin();it!=entriesOnSameDisc.end();it++,id++)
{
int startOfEltIdOfChunk=(*it)->_start;
- MCAuto<DataArrayInt> newEltIds=explicitIdsInMesh->substr(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
+ MCAuto<DataArrayInt> newEltIds=explicitIdsInMesh->subArray(startOfEltIdOfChunk,startOfEltIdOfChunk+(*it)->_nval);
MCAuto<DataArrayInt> rangeIdsForChunk=newEltIds->findRangeIdForEachTuple(ranges);
MCAuto<DataArrayInt> idsInRrangeForChunk=newEltIds->findIdInRangeForEachTuple(ranges);
//
//
MCAuto<DataArrayInt> renumTupleIds=newGeoTypesPerChunk4->buildPermArrPerLevel();
//
- MCAuto<DataArrayDouble> arrPart=arr->substr(offset,offset+szTuples);
+ MCAuto<DataArrayDouble> arrPart=arr->subArray(offset,offset+szTuples);
arrPart->renumberInPlace(renumTupleIds->begin());
arr->setPartOfValues1(arrPart,offset,offset+szTuples,1,0,arrPart->getNumberOfComponents(),1);
bool ret=false;
MCAuto<DataArrayInt> fam,num;
MCAuto<DataArrayAsciiChar> 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<DataArrayAsciiChar *>(_names->substr(start,end));
+ names=static_cast<DataArrayAsciiChar *>(_names->subArray(start,end));
MEDFileUMeshPerType::Write(fid,mName,mdim,(*it),fam,num,names);
start=end;
}
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)