From 6af23f4dbc1bc478f024fdd67f086d66deeab9a8 Mon Sep 17 00:00:00 2001 From: emv Date: Fri, 8 Nov 2019 15:03:43 +0300 Subject: [PATCH] LOT2: Replace int with mcIdType and DataArrayInt with DataArrayIdType MEDCouplingMemArray. --- src/MEDCoupling/MEDCouplingMemArray.cxx | 232 ++++++++--------- src/MEDCoupling/MEDCouplingMemArray.hxx | 243 +++++++++--------- src/MEDCoupling/MEDCouplingMemArray.txx | 198 +++++++------- src/MEDCoupling/MEDCouplingPartDefinition.cxx | 84 +++--- src/MEDCoupling/MEDCouplingPartDefinition.hxx | 38 +-- 5 files changed, 396 insertions(+), 399 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index 04ba0b18c..6100a6f41 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -42,39 +42,39 @@ typedef double (*MYFUNCPTR)(double); using namespace MEDCoupling; -template class MEDCoupling::MemArray; +template class MEDCoupling::MemArray; template class MEDCoupling::MemArray; -template class MEDCoupling::DataArrayTemplate; +template class MEDCoupling::DataArrayTemplate; template class MEDCoupling::DataArrayTemplate; -template class MEDCoupling::DataArrayTemplateClassic; +template class MEDCoupling::DataArrayTemplateClassic; template class MEDCoupling::DataArrayTemplateClassic; template class MEDCoupling::DataArrayTemplateFP; template class MEDCoupling::DataArrayIterator; -template class MEDCoupling::DataArrayIterator; +template class MEDCoupling::DataArrayIterator; template class MEDCoupling::DataArrayDiscrete; template class MEDCoupling::DataArrayDiscreteSigned; template class MEDCoupling::DataArrayDiscrete; template class MEDCoupling::DataArrayDiscreteSigned; -template class MEDCoupling::DataArrayTuple; +template class MEDCoupling::DataArrayTuple; template class MEDCoupling::DataArrayTuple; template class MEDCoupling::DataArrayTuple; -template -void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt *c, DataArrayInt *cI) const +template +void DataArrayDouble::findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const { const double *coordsPtr=getConstPointer(); - BBTreePts myTree(bbox,0,0,nbNodes,prec); + BBTreePts myTree(bbox,0,0,nbNodes,prec); std::vector isDone(nbNodes); - for(int i=0;i intersectingElems; + std::vector intersectingElems; myTree.getElementsAroundPoint(coordsPtr+i*SPACEDIM,intersectingElems); if(intersectingElems.size()>1) { - std::vector commonNodes; - for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + std::vector commonNodes; + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) if(*it!=i) if(*it>=limitNodeId) { @@ -83,7 +83,7 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int l } if(!commonNodes.empty()) { - cI->pushBackSilent(cI->back()+(int)commonNodes.size()+1); + cI->pushBackSilent(cI->back()+(mcIdType)commonNodes.size()+1); c->pushBackSilent(i); c->insertAtTheEnd(commonNodes.begin(),commonNodes.end()); } @@ -92,33 +92,33 @@ void DataArrayDouble::findCommonTuplesAlg(const double *bbox, int nbNodes, int l } } -template -void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, int nbOfTuples, double eps, - DataArrayInt *c, DataArrayInt *cI) +template +void DataArrayDouble::FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double eps, + DataArrayIdType *c, DataArrayIdType *cI) { - for(int i=0;i intersectingElems; + std::vector intersectingElems; myTree.getElementsAroundPoint(pos+i*SPACEDIM,intersectingElems); - std::vector commonNodes; - for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) + std::vector commonNodes; + for(std::vector::const_iterator it=intersectingElems.begin();it!=intersectingElems.end();it++) commonNodes.push_back(*it); - cI->pushBackSilent(cI->back()+(int)commonNodes.size()); + cI->pushBackSilent(cI->back()+(mcIdType)commonNodes.size()); c->insertAtTheEnd(commonNodes.begin(),commonNodes.end()); } } -template -void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res) +template +void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res) { double distOpt(dist); const double *p(pos); - int *r(res); - for(int i=0;i::max()) { @@ -132,7 +132,7 @@ void DataArrayDouble::FindClosestTupleIdAlg(const BBTreePts& myTre } } -int DataArray::EffectiveCircPerm(int nbOfShift, int nbOfTuples) +mcIdType DataArray::EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples) { if(nbOfTuples<=0) throw INTERP_KERNEL::Exception("DataArray::EffectiveCircPerm : number of tuples is expected to be > 0 !"); @@ -142,7 +142,7 @@ int DataArray::EffectiveCircPerm(int nbOfShift, int nbOfTuples) } else { - int tmp(-nbOfShift); + mcIdType tmp(-nbOfShift); tmp=tmp%nbOfTuples; return nbOfTuples-tmp; } @@ -316,15 +316,15 @@ void DataArray::setInfoOnComponents(const std::vector& info) * * \sa DataArrayDouble::setPartOfValues3, DataArrayInt::setPartOfValues3, DataArrayChar::setPartOfValues3. */ -void DataArray::setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) +void DataArray::setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!aBase) throw INTERP_KERNEL::Exception("DataArray::setPartOfValuesBase3 : input aBase object is NULL !"); DataArrayDouble *this1(dynamic_cast(this)); - DataArrayInt *this2(dynamic_cast(this)); + DataArrayIdType *this2(dynamic_cast(this)); DataArrayChar *this3(dynamic_cast(this)); const DataArrayDouble *a1(dynamic_cast(aBase)); - const DataArrayInt *a2(dynamic_cast(aBase)); + const DataArrayIdType *a2(dynamic_cast(aBase)); const DataArrayChar *a3(dynamic_cast(aBase)); if(this1 && a1) { @@ -346,18 +346,18 @@ void DataArray::setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples std::vector DataArray::getVarsOnComponent() const { - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfCompo=(mcIdType)_info_on_compo.size(); std::vector ret(nbOfCompo); - for(int i=0;i DataArray::getUnitsOnComponent() const { - int nbOfCompo=(int)_info_on_compo.size(); + mcIdType nbOfCompo=(mcIdType)_info_on_compo.size(); std::vector ret(nbOfCompo); - for(int i=0;i& arrs) if(arr2.empty()) throw INTERP_KERNEL::Exception("DataArray::Aggregate : only null instance in input vector !"); std::vector arrd; - std::vector arri; + std::vector arri; std::vector arrc; for(std::vector::const_iterator it=arr2.begin();it!=arr2.end();it++) { const DataArrayDouble *a=dynamic_cast(*it); if(a) { arrd.push_back(a); continue; } - const DataArrayInt *b=dynamic_cast(*it); + const DataArrayIdType *b=dynamic_cast(*it); if(b) { arri.push_back(b); continue; } const DataArrayChar *c=dynamic_cast(*it); @@ -544,7 +544,7 @@ DataArray *DataArray::Aggregate(const std::vector& arrs) if(arr2.size()==arrd.size()) return DataArrayDouble::Aggregate(arrd); if(arr2.size()==arri.size()) - return DataArrayInt::Aggregate(arri); + return DataArrayIdType::Aggregate(arri); if(arr2.size()==arrc.size()) return DataArrayChar::Aggregate(arrc); throw INTERP_KERNEL::Exception("DataArray::Aggregate : all input arrays must have the same type !"); @@ -565,7 +565,7 @@ void DataArray::setInfoOnComponent(std::size_t i, const std::string& info) _info_on_compo[i]=info; else { - std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (int) _info_on_compo.size(); + std::ostringstream oss; oss << "DataArray::setInfoOnComponent : Specified component id is out of range (" << i << ") compared with nb of actual components (" << (mcIdType) _info_on_compo.size(); throw INTERP_KERNEL::Exception(oss.str().c_str()); } } @@ -647,7 +647,7 @@ void DataArray::checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfComp /*! * Simply this method checks that \b value is in [0,\b ref). */ -void DataArray::CheckValueInRange(int ref, int value, const std::string& msg) +void DataArray::CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg) { if(value<0 || value>=ref) { @@ -660,7 +660,7 @@ void DataArray::CheckValueInRange(int ref, int value, const std::string& msg) * This method checks that [\b start, \b end) is compliant with ref length \b value. * typically start in [0,\b value) and end in [0,\b value). If value==start and start==end, it is supported. */ -void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::string& msg) +void DataArray::CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg) { if(start<0 || start>=value) { @@ -677,7 +677,7 @@ void DataArray::CheckValueInRangeEx(int value, int start, int end, const std::st } } -void DataArray::CheckClosingParInRange(int ref, int value, const std::string& msg) +void DataArray::CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg) { if(value<0 || value>ref) { @@ -831,7 +831,7 @@ bool DataArrayDouble::isMonotonic(bool increasing, double eps) const } } -void DataArrayDouble::writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const +void DataArrayDouble::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; checkAllocated(); @@ -997,7 +997,7 @@ bool DataArrayDouble::isEqualWithoutConsideringStr(const DataArrayDouble& other, * \param [out] tupleIds - the tuple ids containing the same number of tuples than \a other has. * \sa DataArrayDouble::findCommonTuples */ -bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt *&tupleIds) const +bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : input array is NULL !"); @@ -1005,12 +1005,12 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, if(getNumberOfComponents()!=other->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayDouble::areIncludedInMe : the number of components does not match !"); MCAuto a=DataArrayDouble::Aggregate(this,other); - DataArrayInt *c=0,*ci=0; + DataArrayIdType *c=0,*ci=0; a->findCommonTuples(prec,getNumberOfTuples(),c,ci); - MCAuto cSafe(c),ciSafe(ci); - int newNbOfTuples=-1; - MCAuto ids=DataArrayInt::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); - MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); + MCAuto cSafe(c),ciSafe(ci); + mcIdType newNbOfTuples=-1; + MCAuto ids=DataArrayIdType::ConvertIndexArrayToO2N(a->getNumberOfTuples(),c->begin(),ci->begin(),ci->end(),newNbOfTuples); + MCAuto ret1=ids->selectByTupleIdSafeSlice(getNumberOfTuples(),a->getNumberOfTuples(),1); tupleIds=ret1.retn(); return newNbOfTuples==getNumberOfTuples(); } @@ -1048,7 +1048,7 @@ bool DataArrayDouble::areIncludedInMe(const DataArrayDouble *other, double prec, * \endif * \sa DataArrayInt::ConvertIndexArrayToO2N(), DataArrayDouble::areIncludedInMe */ -void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayInt *&comm, DataArrayInt *&commIndex) const +void DataArrayDouble::findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const { checkAllocated(); std::size_t nbOfCompo=getNumberOfComponents(); @@ -1057,7 +1057,7 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI mcIdType nbOfTuples(getNumberOfTuples()); // - MCAuto c(DataArrayInt::New()),cI(DataArrayInt::New()); c->alloc(0,1); cI->pushBackSilent(0); + MCAuto c(DataArrayIdType::New()),cI(DataArrayIdType::New()); c->alloc(0,1); cI->pushBackSilent(0); switch(nbOfCompo) { case 4: @@ -1089,13 +1089,13 @@ void DataArrayDouble::findCommonTuples(double prec, int limitTupleId, DataArrayI * \return the minimal distance between the two set of points \a this and \a other. * \sa DataArrayDouble::findClosestTupleId */ -double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const +double DataArrayDouble::minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const { - MCAuto part1=findClosestTupleId(other); + MCAuto part1=findClosestTupleId(other); std::size_t nbOfCompo=getNumberOfComponents(); mcIdType otherNbTuples=other->getNumberOfTuples(); const double *thisPt(begin()),*otherPt(other->begin()); - const int *part1Pt(part1->begin()); + const mcIdType *part1Pt(part1->begin()); double ret=std::numeric_limits::max(); for(mcIdType i=0;igetNumberOfTuples() tuples and one components. * \sa DataArrayDouble::minimalDistanceTo */ -DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const +DataArrayIdType *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) const { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::findClosestTupleId : other instance is NULL !"); @@ -1130,7 +1130,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) } mcIdType nbOfTuples(other->getNumberOfTuples()); mcIdType thisNbOfTuples(getNumberOfTuples()); - MCAuto ret=DataArrayInt::New(); ret->alloc(nbOfTuples,1); + MCAuto ret=DataArrayIdType::New(); ret->alloc(nbOfTuples,1); double bounds[6]; getMinMaxPerComponent(bounds); switch(nbOfCompo) @@ -1140,7 +1140,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])),zDelta(fabs(bounds[5]-bounds[4])); double delta=std::max(xDelta,yDelta); delta=std::max(delta,zDelta); double characSize=pow((delta*delta*delta)/((double)thisNbOfTuples),1./3.); - BBTreePts<3,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<3,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<3>(myTree,3.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } @@ -1149,14 +1149,14 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) double xDelta(fabs(bounds[1]-bounds[0])),yDelta(fabs(bounds[3]-bounds[2])); double delta=std::max(xDelta,yDelta); double characSize=sqrt(delta/(double)thisNbOfTuples); - BBTreePts<2,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<2,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<2>(myTree,2.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } case 1: { double characSize=fabs(bounds[1]-bounds[0])/thisNbOfTuples; - BBTreePts<1,int> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); + BBTreePts<1,mcIdType> myTree(begin(),0,0,getNumberOfTuples(),characSize*1e-12); FindClosestTupleIdAlg<1>(myTree,1.*characSize*characSize,other->begin(),nbOfTuples,begin(),thisNbOfTuples,ret->getPointer()); break; } @@ -1178,7 +1178,7 @@ DataArrayInt *DataArrayDouble::findClosestTupleId(const DataArrayDouble *other) * \throw If \a this and \a otherBBoxFrmt have not the same number of components. * \throw If \a this and \a otherBBoxFrmt number of components is not even (BBox format). */ -DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const +DataArrayIdType *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const { if(!otherBBoxFrmt) throw INTERP_KERNEL::Exception("DataArrayDouble::computeNbOfInteractionsWith : input array is NULL !"); @@ -1196,28 +1196,28 @@ DataArrayInt *DataArrayDouble::computeNbOfInteractionsWith(const DataArrayDouble std::ostringstream oss; oss << "DataArrayDouble::computeNbOfInteractionsWith : Number of components (" << nbOfComp << ") is not even ! It should be to be compatible with bbox format !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - MCAuto ret(DataArrayInt::New()); ret->alloc(nbOfTuples,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(nbOfTuples,1); const double *thisBBPtr(begin()); - int *retPtr(ret->getPointer()); + mcIdType *retPtr(ret->getPointer()); switch(nbOfComp/2) { case 3: { - BBTree<3,int> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<3,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<2,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); + BBTree<1,mcIdType> bbt(otherBBoxFrmt->begin(),0,0,otherBBoxFrmt->getNumberOfTuples(),eps); for(mcIdType i=0;i c(c0),cI(cI0); - int newNbOfTuples=-1; - MCAuto o2n=DataArrayInt::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); + MCAuto c(c0),cI(cI0); + mcIdType newNbOfTuples=-1; + MCAuto o2n=DataArrayIdType::ConvertIndexArrayToO2N(getNumberOfTuples(),c0->begin(),cI0->begin(),cI0->end(),newNbOfTuples); return renumberAndReduce(o2n->getConstPointer(),newNbOfTuples); } @@ -1397,7 +1397,7 @@ DataArrayDouble *DataArrayDouble::computeBBoxPerTuple(double epsilon) const * * \sa MEDCouplingPointSet::getNodeIdsNearPoints, DataArrayDouble::getDifferentValues */ -void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt *& c, DataArrayInt *& cI) const +void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const { if(!other) throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : input pointer other is null !"); @@ -1409,24 +1409,24 @@ void DataArrayDouble::computeTupleIdsNearTuples(const DataArrayDouble *other, do throw INTERP_KERNEL::Exception("DataArrayDouble::computeTupleIdsNearTuples : number of components should be equal between this and other !"); mcIdType nbOfTuplesOther=other->getNumberOfTuples(); mcIdType nbOfTuples=getNumberOfTuples(); - MCAuto cArr(DataArrayInt::New()),cIArr(DataArrayInt::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); + MCAuto cArr(DataArrayIdType::New()),cIArr(DataArrayIdType::New()); cArr->alloc(0,1); cIArr->pushBackSilent(0); switch(nbOfCompo) { case 3: { - BBTreePts<3,int> myTree(begin(),0,0,nbOfTuples,eps); + BBTreePts<3,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<3>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 2: { - BBTreePts<2,int> myTree(begin(),0,0,nbOfTuples,eps); + BBTreePts<2,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<2>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } case 1: { - BBTreePts<1,int> myTree(begin(),0,0,nbOfTuples,eps); + BBTreePts<1,mcIdType> myTree(begin(),0,0,nbOfTuples,eps); FindTupleIdsNearTuplesAlg<1>(myTree,other->getConstPointer(),nbOfTuplesOther,eps,cArr,cIArr); break; } @@ -1468,9 +1468,9 @@ void DataArrayDouble::recenterForMaxPrecision(double eps) * \throw If \a this->getNumberOfComponents() != 1 * \throw If \a this->getNumberOfTuples() < 1 */ -double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const +double DataArrayDouble::getMaxValue2(DataArrayIdType*& tupleIds) const { - int tmp; + mcIdType tmp; tupleIds=0; double ret=getMaxValue(tmp); tupleIds=findIdsInRange(ret,ret); @@ -1486,9 +1486,9 @@ double DataArrayDouble::getMaxValue2(DataArrayInt*& tupleIds) const * \throw If \a this->getNumberOfComponents() != 1 * \throw If \a this->getNumberOfTuples() < 1 */ -double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const +double DataArrayDouble::getMinValue2(DataArrayIdType*& tupleIds) const { - int tmp; + mcIdType tmp; tupleIds=0; double ret=getMinValue(tmp); tupleIds=findIdsInRange(ret,ret); @@ -1504,9 +1504,9 @@ double DataArrayDouble::getMinValue2(DataArrayInt*& tupleIds) const * \throw If \a this is not allocated * */ -int DataArrayDouble::count(double value, double eps) const +mcIdType DataArrayDouble::count(double value, double eps) const { - int ret=0; + mcIdType ret=0; checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::count : must be applied on DataArrayDouble with only one component, you can call 'rearrange' method before !"); @@ -1655,7 +1655,7 @@ void DataArrayDouble::accumulate(double *res) const * \return the min distance. * \sa MEDCouplingUMesh::distanceToPoint */ -double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const +double DataArrayDouble::distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const { checkAllocated(); mcIdType nbTuple(getNumberOfTuples()); @@ -1719,7 +1719,7 @@ double DataArrayDouble::accumulate(std::size_t compId) const * \throw If there is an id in [ \a bgOfIndex, \a endOfIndex ) not in [0, \c this->getNumberOfTuples). * \throw If std::distance(bgOfIndex,endOfIndex)==0. */ -DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const +DataArrayDouble *DataArrayDouble::accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const { if(!bgOfIndex || !endOfIndex) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : input pointer NULL !"); @@ -1731,7 +1731,7 @@ DataArrayDouble *DataArrayDouble::accumulatePerChunck(const int *bgOfIndex, cons throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : invalid size of input index array !"); sz--; MCAuto ret=DataArrayDouble::New(); ret->alloc(sz,nbCompo); - const int *w=bgOfIndex; + const mcIdType *w=bgOfIndex; if(*w<0 || *w>=nbOfTuples) throw INTERP_KERNEL::Exception("DataArrayDouble::accumulatePerChunck : The first element of the input index not in [0,nbOfTuples) !"); const double *srcPt=begin()+(*w)*nbCompo; @@ -2156,7 +2156,7 @@ DataArrayDouble *DataArrayDouble::eigenVectors() const { double tmp[3]; INTERP_KERNEL::computeEigenValues6(src,tmp); - for(int j=0;j<3;j++,dest+=3) + for(mcIdType j=0;j<3;j++,dest+=3) INTERP_KERNEL::computeEigenVectorForEigenValue6(src,tmp[j],1e-12,dest); } return ret; @@ -2352,21 +2352,21 @@ DataArrayDouble *DataArrayDouble::maxPerTuple() const * \throw If \a this is not allocated. * \sa DataArrayDouble::maxPerTuple */ -DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayInt* &compoIdOfMaxPerTuple) const +DataArrayDouble *DataArrayDouble::maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const { checkAllocated(); std::size_t nbOfComp(getNumberOfComponents()); MCAuto ret0=DataArrayDouble::New(); - MCAuto ret1=DataArrayInt::New(); + MCAuto ret1=DataArrayIdType::New(); mcIdType nbOfTuple=getNumberOfTuples(); ret0->alloc(nbOfTuple,1); ret1->alloc(nbOfTuple,1); const double *src=getConstPointer(); - double *dest=ret0->getPointer(); int *dest1=ret1->getPointer(); + double *dest=ret0->getPointer(); mcIdType *dest1=ret1->getPointer(); for(mcIdType i=0;i vars; expr.getTrueSetOfVars(vars); - if((int)vars.size()>1) + if((mcIdType)vars.size()>1) { std::ostringstream oss; oss << "DataArrayDouble::applyFunc : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); @@ -2786,7 +2786,7 @@ void DataArrayDouble::applyFuncOnThis(const std::string& func, bool isSafe) expr.parse(); std::set vars; expr.getTrueSetOfVars(vars); - if((int)vars.size()>1) + if((mcIdType)vars.size()>1) { std::ostringstream oss; oss << "DataArrayDouble::applyFuncOnThis : this method works only with at most one var func expression ! If you need to map comps on variables please use applyFuncCompo or applyFuncNamedCompo instead ! Vars in expr are : "; std::copy(vars.begin(),vars.end(),std::ostream_iterator(oss," ")); @@ -3025,13 +3025,13 @@ DataArrayDoubleIterator *DataArrayDouble::iterator() * \ref py_mcdataarraydouble_getidsinrange "Here is a Python example". * \endif */ -DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const +DataArrayIdType *DataArrayDouble::findIdsInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsInRange : this must have exactly one component !"); const double *cptr(begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); mcIdType nbOfTuples(getNumberOfTuples()); for(mcIdType i=0;i=vmin && *cptr<=vmax) @@ -3051,13 +3051,13 @@ DataArrayInt *DataArrayDouble::findIdsInRange(double vmin, double vmax) const * * \sa DataArrayDouble::findIdsInRange */ -DataArrayInt *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const +DataArrayIdType *DataArrayDouble::findIdsNotInRange(double vmin, double vmax) const { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayDouble::findIdsNotInRange : this must have exactly one component !"); const double *cptr(begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); mcIdType nbOfTuples(getNumberOfTuples()); for(mcIdType i=0;ivmax) @@ -3112,7 +3112,7 @@ DataArrayDouble *DataArrayDouble::Aggregate(const std::vector::const_iterator it=a.begin(); std::size_t nbOfComp((*it)->getNumberOfComponents()); mcIdType nbt=(*it++)->getNumberOfTuples(); - for(int i=1;it!=a.end();it++,i++) + for(mcIdType i=1;it!=a.end();it++,i++) { if((*it)->getNumberOfComponents()!=nbOfComp) throw INTERP_KERNEL::Exception("DataArrayDouble::Aggregate : Nb of components mismatch for array aggregation !"); @@ -3397,7 +3397,7 @@ std::vector DataArrayDouble::toVectorOfBool(double eps) const * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. * Server side. */ -void DataArrayDouble::getTinySerializationIntInformation(std::vector& tinyInfo) const +void DataArrayDouble::getTinySerializationIntInformation(std::vector& tinyInfo) const { tinyInfo.resize(2); if(isAllocated()) @@ -3437,10 +3437,10 @@ void DataArrayDouble::getTinySerializationStrInformation(std::vector& tinyInfoI) +bool DataArrayDouble::resizeForUnserialization(const std::vector& tinyInfoI) { - int nbOfTuple=tinyInfoI[0]; - int nbOfComp=tinyInfoI[1]; + mcIdType nbOfTuple=tinyInfoI[0]; + mcIdType nbOfComp=tinyInfoI[1]; if(nbOfTuple!=-1 || nbOfComp!=-1) { alloc(nbOfTuple,nbOfComp); @@ -3452,7 +3452,7 @@ bool DataArrayDouble::resizeForUnserialization(const std::vector& tinyInfoI /*! * Useless method for end user. Only for MPI/Corba/File serialsation for multi arrays class. */ -void DataArrayDouble::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) +void DataArrayDouble::finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS) { setName(tinyInfoS[0]); if(isAllocated()) @@ -3467,7 +3467,7 @@ void DataArrayDouble::finishUnserialization(const std::vector& tinyInfoI, c * Low static method that operates 3D rotation of 'nbNodes' 3D nodes whose coordinates are arranged in \a coordsIn * around an axe ( \a center, \a vect) and with angle \a angle. */ -void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut) { if(!center || !vect) throw INTERP_KERNEL::Exception("DataArrayDouble::Rotate3DAlg : null vector in input !"); @@ -3494,7 +3494,7 @@ void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, doub std::transform(matrix,matrix+9,matrixTmp,matrix,std::plus()); //rotation matrix computed. double tmp[3]; - for(int i=0; i()); coordsOut[i*3]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+matrix[2]*tmp[2]+center[0]; @@ -3503,7 +3503,7 @@ void DataArrayDouble::Rotate3DAlg(const double *center, const double *vect, doub } } -void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut) { double matrix[9],matrix2[9],matrix3[9]; double vect[3],crossVect[3]; @@ -3518,17 +3518,17 @@ void DataArrayDouble::Symmetry3DPlane(const double point[3], const double normal matrix2[0]=vect[0]/nv; matrix2[1]=vect[1]/nv; matrix2[2]=vect[2]/nv; matrix2[3]=crossVect[0]/nc; matrix2[4]=crossVect[1]/nc; matrix2[5]=crossVect[2]/nc; matrix2[6]=normalVector[0]/ni; matrix2[7]=normalVector[1]/ni; matrix2[8]=normalVector[2]/ni; - for(int i=0;i<3;i++) - for(int j=0;j<3;j++) + for(mcIdType i=0;i<3;i++) + for(mcIdType j=0;j<3;j++) { double val(0.); - for(int k=0;k<3;k++) + for(mcIdType k=0;k<3;k++) val+=matrix[3*i+k]*matrix2[3*k+j]; matrix3[3*i+j]=val; } //rotation matrix computed. double tmp[3]; - for(int i=0; i()); coordsOut[i*3]=matrix3[0]*tmp[0]+matrix3[1]*tmp[1]+matrix3[2]*tmp[2]+point[0]; @@ -3568,14 +3568,14 @@ void DataArrayDouble::ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const * Low static method that operates 3D rotation of \a nbNodes 3D nodes whose coordinates are arranged in \a coords * around the center point \a center and with angle \a angle. */ -void DataArrayDouble::Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut) +void DataArrayDouble::Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut) { double cosa=cos(angle); double sina=sin(angle); double matrix[4]; matrix[0]=cosa; matrix[1]=-sina; matrix[2]=sina; matrix[3]=cosa; double tmp[2]; - for(int i=0; i()); coordsOut[i*2]=matrix[0]*tmp[0]+matrix[1]*tmp[1]+center[0]; @@ -3627,9 +3627,9 @@ DataArrayInt32 *DataArrayInt32::deepCopy() const return new DataArrayInt32(*this); } -DataArrayIntIterator *DataArrayInt::iterator() +DataArrayInt32Iterator *DataArrayInt32::iterator() { - return new DataArrayIntIterator(this); + return new DataArrayInt32Iterator(this); } diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index b945e15a0..2f19607b1 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -82,10 +82,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT T operator[](std::size_t id) const { return _pointer.getConstPointer()[id]; } MEDCOUPLING_EXPORT T& operator[](std::size_t id) { return _pointer.getPointer()[id]; } MEDCOUPLING_EXPORT bool isEqual(const MemArray& other, T prec, std::string& reason) const; - MEDCOUPLING_EXPORT void repr(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT bool reprHeader(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprZip(int sl, std::ostream& stream) const; - MEDCOUPLING_EXPORT void reprNotTooLong(int sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void repr(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT bool reprHeader(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprZip(mcIdType sl, std::ostream& stream) const; + MEDCOUPLING_EXPORT void reprNotTooLong(mcIdType sl, std::ostream& stream) const; MEDCOUPLING_EXPORT void fillWithValue(const T& val); MEDCOUPLING_EXPORT T *fromNoInterlace(std::size_t nbOfComp) const; MEDCOUPLING_EXPORT T *toNoInterlace(std::size_t nbOfComp) const; @@ -134,7 +134,6 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(T value, T begin, T end, T step); }; - class DataArrayInt32; class DataArrayByte; class DataArray : public RefCountObject, public TimeLabel @@ -163,7 +162,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT std::string getUnitOnComponent(std::size_t i) const; MEDCOUPLING_EXPORT void setInfoOnComponent(std::size_t i, const std::string& info); MEDCOUPLING_EXPORT std::size_t getNumberOfComponents() const { return _info_on_compo.size(); } - MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesBase3(const DataArray *aBase, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); MEDCOUPLING_EXPORT virtual void *getVoidStarPointer() = 0; MEDCOUPLING_EXPORT virtual DataArray *deepCopy() const = 0; MEDCOUPLING_EXPORT virtual DataArray *buildNewEmptyInstance() const = 0; @@ -175,19 +174,19 @@ namespace MEDCoupling MEDCOUPLING_EXPORT virtual std::size_t getNbOfElemAllocated() const = 0; MEDCOUPLING_EXPORT virtual void alloc(std::size_t nbOfTuple, std::size_t nbOfCompo=1) = 0; MEDCOUPLING_EXPORT virtual void reAlloc(std::size_t newNbOfTuple) = 0; - MEDCOUPLING_EXPORT virtual void renumberInPlace(const int *old2New) = 0; - MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const int *new2Old) = 0; - MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec) = 0; - MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector >& ranges) const = 0; + MEDCOUPLING_EXPORT virtual void renumberInPlace(const mcIdType *old2New) = 0; + MEDCOUPLING_EXPORT virtual void renumberInPlaceR(const mcIdType *new2Old) = 0; + MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) = 0; + MEDCOUPLING_EXPORT virtual void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleRanges(const std::vector >& ranges) const = 0; MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; MEDCOUPLING_EXPORT virtual DataArray *keepSelectedComponents(const std::vector& compoIds) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const int *new2OldBg, const int *new2OldEnd) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const = 0; - MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(int bg, int end2, int step) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const = 0; + MEDCOUPLING_EXPORT virtual DataArray *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const = 0; MEDCOUPLING_EXPORT virtual void rearrange(std::size_t newNbOfCompo) = 0; - MEDCOUPLING_EXPORT virtual void circularPermutation(int nbOfShift=1) = 0; - MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(int nbOfShift=1) = 0; + MEDCOUPLING_EXPORT virtual void circularPermutation(mcIdType nbOfShift=1) = 0; + MEDCOUPLING_EXPORT virtual void circularPermutationPerTuple(mcIdType nbOfShift=1) = 0; MEDCOUPLING_EXPORT virtual void reversePerTuple() = 0; MEDCOUPLING_EXPORT void checkNbOfTuples(mcIdType nbOfTuples, const std::string& msg) const; MEDCOUPLING_EXPORT void checkNbOfComps(std::size_t nbOfCompo, const std::string& msg) const; @@ -195,9 +194,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void checkNbOfTuplesAndComp(mcIdType nbOfTuples, std::size_t nbOfCompo, const std::string& msg) const; MEDCOUPLING_EXPORT void checkNbOfElems(std::size_t nbOfElems, const std::string& msg) const; MEDCOUPLING_EXPORT static void GetSlice(mcIdType start, mcIdType stop, mcIdType step, mcIdType sliceId, mcIdType nbOfSlices, mcIdType& startSlice, mcIdType& stopSlice); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); - MEDCOUPLING_EXPORT static int GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); - MEDCOUPLING_EXPORT static int GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBES(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetNumberOfItemGivenBESRelative(mcIdType begin, mcIdType end, mcIdType step, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType GetPosOfItemGivenBESRelativeNoThrow(mcIdType value, mcIdType begin, mcIdType end, mcIdType step); MEDCOUPLING_EXPORT static std::string GetVarNameFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string GetUnitFromInfo(const std::string& info); MEDCOUPLING_EXPORT static std::string BuildInfoFromVarAndUnit(const std::string& var, const std::string& unit); @@ -214,10 +213,10 @@ namespace MEDCoupling DataArray() { } ~DataArray() { } protected: - MEDCOUPLING_EXPORT static void CheckValueInRange(int ref, int value, const std::string& msg); - MEDCOUPLING_EXPORT static void CheckValueInRangeEx(int value, int start, int end, const std::string& msg); - MEDCOUPLING_EXPORT static void CheckClosingParInRange(int ref, int value, const std::string& msg); - MEDCOUPLING_EXPORT static int EffectiveCircPerm(int nbOfShift, int nbOfTuples); + MEDCOUPLING_EXPORT static void CheckValueInRange(mcIdType ref, mcIdType value, const std::string& msg); + MEDCOUPLING_EXPORT static void CheckValueInRangeEx(mcIdType value, mcIdType start, mcIdType end, const std::string& msg); + MEDCOUPLING_EXPORT static void CheckClosingParInRange(mcIdType ref, mcIdType value, const std::string& msg); + MEDCOUPLING_EXPORT static mcIdType EffectiveCircPerm(mcIdType nbOfShift, mcIdType nbOfTuples); protected: std::string _name; std::vector _info_on_compo; @@ -226,8 +225,6 @@ namespace MEDCoupling namespace MEDCoupling { - class DataArrayInt32; - template class DataArrayTemplate : public DataArray { @@ -275,40 +272,40 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void reverse(); MEDCOUPLING_EXPORT void fillWithValue(T val); MEDCOUPLING_EXPORT void reAlloc(std::size_t newNbOfTuple); - MEDCOUPLING_EXPORT void renumberInPlace(const int *old2New); - MEDCOUPLING_EXPORT void renumberInPlaceR(const int *new2Old); + MEDCOUPLING_EXPORT void renumberInPlace(const mcIdType *old2New); + MEDCOUPLING_EXPORT void renumberInPlaceR(const mcIdType *new2Old); MEDCOUPLING_EXPORT void sort(bool asc=true); - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumber(const int *old2New) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberR(const int *new2Old) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberAndReduce(const int *old2New, int newNbOfTuple) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumber(const mcIdType *old2New) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberR(const mcIdType *new2Old) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const; MEDCOUPLING_EXPORT typename Traits::ArrayType *changeNbOfComponents(std::size_t newNbOfComp, T dftValue) const; - MEDCOUPLING_EXPORT typename Traits::ArrayType *subArray(int tupleIdBg, int tupleIdEnd=-1) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd=-1) const; MEDCOUPLING_EXPORT MCAuto::ArrayTypeCh> selectPartDef(const PartDefinition* pd) const; - MEDCOUPLING_EXPORT void circularPermutation(int nbOfShift=1); - MEDCOUPLING_EXPORT void circularPermutationPerTuple(int nbOfShift=1); + MEDCOUPLING_EXPORT void circularPermutation(mcIdType nbOfShift=1); + MEDCOUPLING_EXPORT void circularPermutationPerTuple(mcIdType nbOfShift=1); MEDCOUPLING_EXPORT void reversePerTuple(); - MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp); - MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp); - MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp); - MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare=true); - MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp); - MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayInt32 *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt32 *tuplesSelec); - MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step); - MEDCOUPLING_EXPORT T getMaxValue(int& tupleId) const; + MEDCOUPLING_EXPORT void setPartOfValues1(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + MEDCOUPLING_EXPORT void setPartOfValues2(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp); + MEDCOUPLING_EXPORT void setPartOfValues3(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp); + MEDCOUPLING_EXPORT void setPartOfValues4(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare=true); + MEDCOUPLING_EXPORT void setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp); + MEDCOUPLING_EXPORT void setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayIdType *tuplesSelec); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec); + MEDCOUPLING_EXPORT void setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step); + MEDCOUPLING_EXPORT T getMaxValue(mcIdType& tupleId) const; MEDCOUPLING_EXPORT T getMaxValueInArray() const; MEDCOUPLING_EXPORT T getMaxAbsValue(std::size_t& tupleId) const; MEDCOUPLING_EXPORT T getMaxAbsValueInArray() const; - MEDCOUPLING_EXPORT T getMinValue(int& tupleId) const; + MEDCOUPLING_EXPORT T getMinValue(mcIdType& tupleId) const; MEDCOUPLING_EXPORT T getMinValueInArray() const; - MEDCOUPLING_EXPORT void getTuple(int tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } + MEDCOUPLING_EXPORT void getTuple(mcIdType tupleId, T *res) const { std::copy(_mem.getConstPointerLoc(tupleId*_info_on_compo.size()),_mem.getConstPointerLoc((tupleId+1)*_info_on_compo.size()),res); } template void insertAtTheEnd(InputIterator first, InputIterator last); MEDCOUPLING_EXPORT static void SetArrayIn(typename Traits::ArrayType *newArray, typename Traits::ArrayType* &arrayToSet); - MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, int sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); } + MEDCOUPLING_EXPORT void writeOnPlace(std::size_t id, T element0, const T *others, mcIdType sizeOfOthers) { _mem.writeOnPlace(id,element0,others,sizeOfOthers); } MEDCOUPLING_EXPORT void fillWithZero(); public: MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } @@ -316,11 +313,11 @@ namespace MEDCoupling protected: typename Traits::ArrayType *mySelectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; typename Traits::ArrayType *mySelectByTupleId(const DataArrayIdType& di) const; - typename Traits::ArrayType *mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const; + typename Traits::ArrayType *mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const; typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; typename Traits::ArrayType *myKeepSelectedComponents(const std::vector& compoIds) const; - typename Traits::ArrayType *mySelectByTupleIdSafeSlice(int bg, int end2, int step) const; - typename Traits::ArrayType *mySelectByTupleRanges(const std::vector >& ranges) const; + typename Traits::ArrayType *mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const; + typename Traits::ArrayType *mySelectByTupleRanges(const std::vector >& ranges) const; protected: MemArray _mem; }; @@ -330,7 +327,7 @@ namespace MEDCoupling { public: MEDCOUPLING_EXPORT MCAuto convertToDblArr() const; - MEDCOUPLING_EXPORT MCAuto convertToIntArr() const; + MEDCOUPLING_EXPORT MCAuto convertToIntArr() const; MEDCOUPLING_EXPORT MCAuto convertToFloatArr() const; MEDCOUPLING_EXPORT void applyLin(T a, T b, std::size_t compoId); MEDCOUPLING_EXPORT void applyLin(T a, T b); @@ -345,15 +342,15 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static typename Traits::ArrayType *Multiply(const typename Traits::ArrayType *a1, const typename Traits::ArrayType *a2); MEDCOUPLING_EXPORT static typename Traits::ArrayType *Meld(const typename Traits::ArrayType *a1, const typename Traits::ArrayType *a2); MEDCOUPLING_EXPORT static typename Traits::ArrayType *Meld(const std::vector::ArrayType *>& arr); - MEDCOUPLING_EXPORT MCAuto findIdsGreaterOrEqualTo(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsGreaterThan(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsLowerOrEqualTo(T val) const; - MEDCOUPLING_EXPORT MCAuto findIdsLowerThan(T val) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsStrictlyNegative() const; + MEDCOUPLING_EXPORT MCAuto findIdsGreaterOrEqualTo(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsGreaterThan(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsLowerOrEqualTo(T val) const; + MEDCOUPLING_EXPORT MCAuto findIdsLowerThan(T val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsStrictlyNegative() const; MEDCOUPLING_EXPORT typename Traits::ArrayType *fromNoInterlace() const; MEDCOUPLING_EXPORT typename Traits::ArrayType *toNoInterlace() const; MEDCOUPLING_EXPORT void meldWith(const typename Traits::ArrayType *other); - MEDCOUPLING_EXPORT typename Traits::ArrayType *duplicateEachTupleNTimes(int nbTimes) const; + MEDCOUPLING_EXPORT typename Traits::ArrayType *duplicateEachTupleNTimes(mcIdType nbTimes) const; MEDCOUPLING_EXPORT void aggregate(const typename Traits::ArrayType *other); MEDCOUPLING_EXPORT void abs(); MEDCOUPLING_EXPORT typename Traits::ArrayType *computeAbs() const; @@ -374,7 +371,7 @@ namespace MEDCoupling protected: static typename Traits::ArrayType *PerformCopyOrIncrRef(bool dCpy, const typename Traits::ArrayType& self); template - MCAuto findIdsAdv(const OP& op) const; + MCAuto findIdsAdv(const OP& op) const; private: template void somethingEqual(const typename Traits::ArrayType *other); @@ -398,12 +395,12 @@ namespace MEDCoupling public:// abstract method overload MEDCOUPLING_EXPORT DataArrayFloat *deepCopy() const; MEDCOUPLING_EXPORT DataArrayFloat *buildNewEmptyInstance() const { return DataArrayFloat::New(); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayFloat *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayFloat *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; @@ -431,7 +428,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *buildNewEmptyInstance() const { return DataArrayDouble::New(); } MEDCOUPLING_EXPORT void checkMonotonic(bool increasing, double eps) const; MEDCOUPLING_EXPORT bool isMonotonic(bool increasing, double eps) const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; @@ -440,28 +437,28 @@ namespace MEDCoupling MEDCOUPLING_EXPORT bool isEqualWithoutConsideringStr(const DataArrayDouble& other, double prec) const; MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplateFP::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayDouble *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplateFP::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayInt32 *&tupleIds) const; - MEDCOUPLING_EXPORT void findCommonTuples(double prec, int limitTupleId, DataArrayInt32 *&comm, DataArrayInt32 *&commIndex) const; - MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, int& thisTupleId, int& otherTupleId) const; - MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, int limitTupleId=-1) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findClosestTupleId(const DataArrayDouble *other) const; - MEDCOUPLING_EXPORT DataArrayInt32 *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplateFP::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayDouble *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplateFP::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT bool areIncludedInMe(const DataArrayDouble *other, double prec, DataArrayIdType *&tupleIds) const; + MEDCOUPLING_EXPORT void findCommonTuples(double prec, mcIdType limitTupleId, DataArrayIdType *&comm, DataArrayIdType *&commIndex) const; + MEDCOUPLING_EXPORT double minimalDistanceTo(const DataArrayDouble *other, mcIdType& thisTupleId, mcIdType& otherTupleId) const; + MEDCOUPLING_EXPORT DataArrayDouble *getDifferentValues(double prec, mcIdType limitTupleId=-1) const; + MEDCOUPLING_EXPORT DataArrayIdType *findClosestTupleId(const DataArrayDouble *other) const; + MEDCOUPLING_EXPORT DataArrayIdType *computeNbOfInteractionsWith(const DataArrayDouble *otherBBoxFrmt, double eps) const; MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds); MEDCOUPLING_EXPORT void setSelectedComponents(const DataArrayDouble *a, const std::vector& compoIds); MEDCOUPLING_EXPORT DataArrayDoubleIterator *iterator(); MEDCOUPLING_EXPORT void checkNoNullValues() const; MEDCOUPLING_EXPORT void getMinMaxPerComponent(double *bounds) const; MEDCOUPLING_EXPORT DataArrayDouble *computeBBoxPerTuple(double epsilon=0.0) const; - MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayInt32 *& c, DataArrayInt32 *& cI) const; + MEDCOUPLING_EXPORT void computeTupleIdsNearTuples(const DataArrayDouble *other, double eps, DataArrayIdType *& c, DataArrayIdType *& cI) const; MEDCOUPLING_EXPORT void recenterForMaxPrecision(double eps); - MEDCOUPLING_EXPORT double getMaxValue2(DataArrayInt32*& tupleIds) const; - MEDCOUPLING_EXPORT double getMinValue2(DataArrayInt32*& tupleIds) const; - MEDCOUPLING_EXPORT int count(double value, double eps) const; + MEDCOUPLING_EXPORT double getMaxValue2(DataArrayIdType*& tupleIds) const; + MEDCOUPLING_EXPORT double getMinValue2(DataArrayIdType*& tupleIds) const; + MEDCOUPLING_EXPORT mcIdType count(double value, double eps) const; MEDCOUPLING_EXPORT double getAverageValue() const; MEDCOUPLING_EXPORT double norm2() const; MEDCOUPLING_EXPORT double normMax() const; @@ -469,9 +466,9 @@ namespace MEDCoupling MEDCOUPLING_EXPORT double normMin() const; MEDCOUPLING_EXPORT void accumulate(double *res) const; MEDCOUPLING_EXPORT double accumulate(std::size_t compId) const; - MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const int *bgOfIndex, const int *endOfIndex) const; + MEDCOUPLING_EXPORT DataArrayDouble *accumulatePerChunck(const mcIdType *bgOfIndex, const mcIdType *endOfIndex) const; MEDCOUPLING_EXPORT MCAuto cumSum() const; - MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, int& tupleId) const; + MEDCOUPLING_EXPORT double distanceToTuple(const double *tupleBg, const double *tupleEnd, mcIdType& tupleId) const; MEDCOUPLING_EXPORT DataArrayDouble *fromPolarToCart() const; MEDCOUPLING_EXPORT DataArrayDouble *fromCylToCart() const; MEDCOUPLING_EXPORT DataArrayDouble *fromSpherToCart() const; @@ -489,7 +486,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT DataArrayDouble *deviator() const; MEDCOUPLING_EXPORT DataArrayDouble *magnitude() const; MEDCOUPLING_EXPORT DataArrayDouble *maxPerTuple() const; - MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayInt32* &compoIdOfMaxPerTuple) const; + MEDCOUPLING_EXPORT DataArrayDouble *maxPerTupleWithCompoId(DataArrayIdType* &compoIdOfMaxPerTuple) const; MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrix() const; MEDCOUPLING_EXPORT DataArrayDouble *buildEuclidianDistanceDenseMatrixWith(const DataArrayDouble *other) const; MEDCOUPLING_EXPORT void asArcOfCircle(double center[2], double& radius, double& ang) const; @@ -506,8 +503,8 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void applyFuncFast32(const std::string& func); MEDCOUPLING_EXPORT void applyFuncFast64(const std::string& func); MEDCOUPLING_EXPORT MCAuto symmetry3DPlane(const double point[3], const double normalVector[3]) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsInRange(double vmin, double vmax) const; - MEDCOUPLING_EXPORT DataArrayInt32 *findIdsNotInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(double vmin, double vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotInRange(double vmin, double vmax) const; MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const DataArrayDouble *a1, const DataArrayDouble *a2); MEDCOUPLING_EXPORT static DataArrayDouble *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayDouble *Dot(const DataArrayDouble *a1, const DataArrayDouble *a2); @@ -517,24 +514,24 @@ namespace MEDCoupling MEDCOUPLING_EXPORT static DataArrayDouble *Pow(const DataArrayDouble *a1, const DataArrayDouble *a2); MEDCOUPLING_EXPORT void powEqual(const DataArrayDouble *other); MEDCOUPLING_EXPORT std::vector toVectorOfBool(double eps) const; - MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, int nbNodes, const double *coordsIn, double *coordsOut); - MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, int nbNodes, const double *coordsIn, double *coordsOut); - MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], int nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Rotate2DAlg(const double *center, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Rotate3DAlg(const double *center, const double *vect, double angle, mcIdType nbNodes, const double *coordsIn, double *coordsOut); + MEDCOUPLING_EXPORT static void Symmetry3DPlane(const double point[3], const double normalVector[3], mcIdType nbNodes, const double *coordsIn, double *coordsOut); MEDCOUPLING_EXPORT static void GiveBaseForPlane(const double normalVector[3], double baseOfPlane[9]); MEDCOUPLING_EXPORT static void ComputeIntegralOfSeg2IntoTri3(const double seg2[4], const double tri3[6], double coeffs[3], double& length); public: - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); public: - template - void findCommonTuplesAlg(const double *bbox, int nbNodes, int limitNodeId, double prec, DataArrayInt32 *c, DataArrayInt32 *cI) const; - template - static void FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, int nbOfTuples, const double *thisPt, int thisNbOfTuples, int *res); - template - static void FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, int nbOfTuples, double eps, - DataArrayInt32 *c, DataArrayInt32 *cI); + template + void findCommonTuplesAlg(const double *bbox, mcIdType nbNodes, mcIdType limitNodeId, double prec, DataArrayIdType *c, DataArrayIdType *cI) const; + template + static void FindClosestTupleIdAlg(const BBTreePts& myTree, double dist, const double *pos, mcIdType nbOfTuples, const double *thisPt, mcIdType thisNbOfTuples, mcIdType *res); + template + static void FindTupleIdsNearTuplesAlg(const BBTreePts& myTree, const double *pos, mcIdType nbOfTuples, double eps, + DataArrayIdType *c, DataArrayIdType *cI); private: ~DataArrayDouble() { } DataArrayDouble() { } @@ -567,7 +564,7 @@ namespace MEDCoupling MEDCOUPLING_EXPORT void reprCppStream(const std::string& varName, std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; - MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; + MEDCOUPLING_EXPORT void writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const; MEDCOUPLING_EXPORT void transformWithIndArr(const T *indArrBg, const T *indArrEnd); MEDCOUPLING_EXPORT void transformWithIndArr(const MapKeyVal& m); MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(T val) const; @@ -680,10 +677,10 @@ namespace MEDCoupling DataArrayType *arr, DataArrayIdType *arrIndx, mcIdType offsetForRemoval=0); MEDCOUPLING_EXPORT static DataArrayType *Range(T begin, T end, T step); public: - MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); + MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); protected: template void switchOnTupleAlg(T val, std::vector& vec, ALG algo) const; @@ -711,11 +708,11 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } - MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayInt32 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayInt32 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } public: MEDCOUPLING_EXPORT DataArrayInt32Iterator *iterator(); private: @@ -732,11 +729,11 @@ namespace MEDCoupling public: MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return this->mySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayInt64 *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } - MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayInt64 *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } public: MEDCOUPLING_EXPORT DataArrayInt64Iterator *iterator(); private: @@ -750,13 +747,13 @@ namespace MEDCoupling template template - MCAuto DataArrayTemplateClassic::findIdsAdv(const OP& op) const + MCAuto DataArrayTemplateClassic::findIdsAdv(const OP& op) const { this->checkAllocated(); if(this->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayInt::findIdsAdv : this must have exactly one component !"); const T *cptr(this->begin()); - MCAuto ret(DataArrayInt::New()); ret->alloc(0,1); + MCAuto ret(DataArrayIdType::New()); ret->alloc(0,1); mcIdType nbOfTuples=this->getNumberOfTuples(); for(mcIdType i=0;imySelectByTupleId(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayChar *selectByTupleId(const DataArrayIdType& di) const { return this->mySelectByTupleId(di); } - MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } + MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { return DataArrayTemplate::mySelectByTupleIdSafe(new2OldBg,new2OldEnd); } MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } MEDCOUPLING_EXPORT DataArrayChar *keepSelectedComponents(const std::vector& compoIds) const { return DataArrayTemplate::myKeepSelectedComponents(compoIds); } - MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(int bg, int end2, int step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } + MEDCOUPLING_EXPORT DataArrayChar *selectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { return DataArrayTemplate::mySelectByTupleIdSafeSlice(bg,end2,step); } MEDCOUPLING_EXPORT bool isUniform(char val) const; MEDCOUPLING_EXPORT void meldWith(const DataArrayChar *other); - MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } - MEDCOUPLING_EXPORT DataArrayInt *findIdsEqual(char val) const; - MEDCOUPLING_EXPORT DataArrayInt *findIdsNotEqual(char val) 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; + MEDCOUPLING_EXPORT DataArray *selectByTupleRanges(const std::vector >& ranges) const { return DataArrayTemplate::mySelectByTupleRanges(ranges); } + MEDCOUPLING_EXPORT DataArrayIdType *findIdsEqual(char val) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsNotEqual(char val) const; + MEDCOUPLING_EXPORT mcIdType findIdSequence(const std::vector& vals) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqualTuple(const std::vector& tupl) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(char value) const; + MEDCOUPLING_EXPORT mcIdType findIdFirstEqual(const std::vector& vals) const; MEDCOUPLING_EXPORT bool presenceOfTuple(const std::vector& tupl) const; MEDCOUPLING_EXPORT bool presenceOfValue(char value) const; MEDCOUPLING_EXPORT bool presenceOfValue(const std::vector& vals) const; - MEDCOUPLING_EXPORT DataArrayInt *findIdsInRange(char vmin, char vmax) const; + MEDCOUPLING_EXPORT DataArrayIdType *findIdsInRange(char vmin, char vmax) const; MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const DataArrayChar *a1, const DataArrayChar *a2); MEDCOUPLING_EXPORT static DataArrayChar *Aggregate(const std::vector& arr); MEDCOUPLING_EXPORT static DataArrayChar *Meld(const DataArrayChar *a1, const DataArrayChar *a2); @@ -801,10 +798,10 @@ namespace MEDCoupling MEDCOUPLING_EXPORT MemArray& accessToMemArray() { return _mem; } MEDCOUPLING_EXPORT const MemArray& accessToMemArray() const { return _mem; } public: - //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; + //MEDCOUPLING_EXPORT void getTinySerializationIntInformation(std::vector& tinyInfo) const; //MEDCOUPLING_EXPORT void getTinySerializationStrInformation(std::vector& tinyInfo) const; - //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); - //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); + //MEDCOUPLING_EXPORT bool resizeForUnserialization(const std::vector& tinyInfoI); + //MEDCOUPLING_EXPORT void finishUnserialization(const std::vector& tinyInfoI, const std::vector& tinyInfoS); protected: DataArrayChar() { } }; diff --git a/src/MEDCoupling/MEDCouplingMemArray.txx b/src/MEDCoupling/MEDCouplingMemArray.txx index 74101b12d..421498694 100755 --- a/src/MEDCoupling/MEDCouplingMemArray.txx +++ b/src/MEDCoupling/MEDCouplingMemArray.txx @@ -162,7 +162,7 @@ namespace MEDCoupling * \return True if a not null pointer is present, False if not. */ template - bool MemArray::reprHeader(int sl, std::ostream& stream) const + bool MemArray::reprHeader(mcIdType sl, std::ostream& stream) const { stream << "Number of tuples : "; if(!_pointer.isNull()) @@ -186,7 +186,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::repr(int sl, std::ostream& stream) const + void MemArray::repr(mcIdType sl, std::ostream& stream) const { if(reprHeader(sl,stream)) { @@ -211,7 +211,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::reprZip(int sl, std::ostream& stream) const + void MemArray::reprZip(mcIdType sl, std::ostream& stream) const { stream << "Number of tuples : "; if(!_pointer.isNull()) @@ -251,7 +251,7 @@ namespace MEDCoupling * \param [in] sl is typically the number of components */ template - void MemArray::reprNotTooLong(int sl, std::ostream& stream) const + void MemArray::reprNotTooLong(mcIdType sl, std::ostream& stream) const { if(reprHeader(sl,stream)) { @@ -1028,16 +1028,16 @@ namespace MEDCoupling * giving a new position for i-th old value. */ template - void DataArrayTemplate::renumberInPlace(const int *old2New) + void DataArrayTemplate::renumberInPlace(const mcIdType *old2New) { checkAllocated(); mcIdType nbTuples(getNumberOfTuples()); std::size_t nbOfCompo(getNumberOfComponents()); T *tmp(new T[nbTuples*nbOfCompo]); const T *iptr(begin()); - for(int i=0;i=0 && v - void DataArrayTemplate::renumberInPlaceR(const int *new2Old) + void DataArrayTemplate::renumberInPlaceR(const mcIdType *new2Old) { checkAllocated(); mcIdType nbTuples(getNumberOfTuples()); @@ -1072,7 +1072,7 @@ namespace MEDCoupling const T *iptr(begin()); for(mcIdType i=0;i=0 && v - typename Traits::ArrayType *DataArrayTemplate::renumber(const int *old2New) const + typename Traits::ArrayType *DataArrayTemplate::renumber(const mcIdType *old2New) const { checkAllocated(); mcIdType nbTuples(getNumberOfTuples()); @@ -1147,7 +1147,7 @@ namespace MEDCoupling * is to delete using decrRef() as it is no more needed. */ template - typename Traits::ArrayType *DataArrayTemplate::renumberR(const int *new2Old) const + typename Traits::ArrayType *DataArrayTemplate::renumberR(const mcIdType *new2Old) const { checkAllocated(); mcIdType nbTuples(getNumberOfTuples()); @@ -1178,7 +1178,7 @@ namespace MEDCoupling * is to delete using decrRef() as it is no more needed. */ template - typename Traits::ArrayType *DataArrayTemplate::renumberAndReduce(const int *old2New, int newNbOfTuple) const + typename Traits::ArrayType *DataArrayTemplate::renumberAndReduce(const mcIdType *old2New, mcIdType newNbOfTuple) const { checkAllocated(); mcIdType nbTuples(getNumberOfTuples()); @@ -1190,7 +1190,7 @@ namespace MEDCoupling T *optr=ret->getPointer(); for(mcIdType i=0;i=0) std::copy(iptr+i*nbOfCompo,iptr+(i+1)*nbOfCompo,optr+w*nbOfCompo); } @@ -1226,7 +1226,7 @@ namespace MEDCoupling T *pt(ret->getPointer()); const T *srcPt(getConstPointer()); std::size_t i(0); - for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++) + for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++) std::copy(srcPt+(*w)*nbComp,srcPt+((*w)+1)*nbComp,pt+i*nbComp); ret->copyStringInfoFrom(*this); return ret.retn(); @@ -1247,7 +1247,7 @@ namespace MEDCoupling const SlicePartDefinition *spd(dynamic_cast(pd)); if(spd) { - int a,b,c; + mcIdType a,b,c; spd->getSlice(a,b,c); if(a==0 && b==getNumberOfTuples() && c==1) { @@ -1265,7 +1265,7 @@ namespace MEDCoupling const DataArrayPartDefinition *dpd(dynamic_cast(pd)); if(dpd) { - MCAuto arr(dpd->toDAI()); + MCAuto arr(dpd->toDAI()); MCAuto ret2(selectByTupleIdSafe(arr->begin(),arr->end())); return DynamicCastSafe::ArrayTypeCh>(ret2); @@ -1293,19 +1293,19 @@ namespace MEDCoupling * \throw If \a new2OldEnd - \a new2OldBg > \a this->getNumberOfTuples(). */ template - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafe(const int *new2OldBg, const int *new2OldEnd) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafe(const mcIdType *new2OldBg, const mcIdType *new2OldEnd) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); std::size_t nbComp(getNumberOfComponents()); mcIdType oldNbOfTuples(getNumberOfTuples()); - ret->alloc((int)std::distance(new2OldBg,new2OldEnd),nbComp); + ret->alloc((mcIdType)std::distance(new2OldBg,new2OldEnd),nbComp); ret->copyStringInfoFrom(*this); T *pt(ret->getPointer()); const T *srcPt(getConstPointer()); - int i(0); - for(const int *w=new2OldBg;w!=new2OldEnd;w++,i++) + mcIdType i(0); + for(const mcIdType *w=new2OldBg;w!=new2OldEnd;w++,i++) if(*w>=0 && *w::ArrayTypeName << "::rearrange : nbOfElems%newNbOfCompo!=0 !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); } - if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits::max()) + if(nbOfElems/newNbOfCompo>(std::size_t)std::numeric_limits::max()) { std::ostringstream oss; oss << Traits::ArrayTypeName << "::rearrange : the rearrangement leads to too high number of tuples (> 2147483647) !"; throw INTERP_KERNEL::Exception(oss.str().c_str()); @@ -1476,7 +1476,7 @@ namespace MEDCoupling * \sa DataArrayDouble::selectByTupleIdSafeSlice */ template - typename Traits::ArrayType *DataArrayTemplate::subArray(int tupleIdBg, int tupleIdEnd) const + typename Traits::ArrayType *DataArrayTemplate::subArray(mcIdType tupleIdBg, mcIdType tupleIdEnd) const { checkAllocated(); mcIdType nbt=getNumberOfTuples(); @@ -1526,18 +1526,18 @@ namespace MEDCoupling * \sa DataArrayDouble::subArray. */ template - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafeSlice(int bg, int end2, int step) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleIdSafeSlice(mcIdType bg, mcIdType end2, mcIdType step) const { checkAllocated(); MCAuto ret0(buildNewEmptyInstance()); MCAuto< typename Traits::ArrayType > ret(DynamicCastSafe::ArrayType>(ret0)); std::size_t nbComp(getNumberOfComponents()); std::ostringstream oss; oss << Traits::ArrayTypeName << "::selectByTupleIdSafeSlice : "; - int newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str())); + mcIdType newNbOfTuples(GetNumberOfItemGivenBESRelative(bg,end2,step,oss.str())); ret->alloc(newNbOfTuples,nbComp); T *pt(ret->getPointer()); const T *srcPt(getConstPointer()+bg*nbComp); - for(int i=0;icopyStringInfoFrom(*this); return ret.retn(); @@ -1580,7 +1580,7 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValues1(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues1(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!a) { @@ -1590,8 +1590,8 @@ namespace MEDCoupling const char msg[]="DataArrayTemplate::setPartOfValues1"; checkAllocated(); a->checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); std::size_t nbComp(getNumberOfComponents()); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); @@ -1611,16 +1611,16 @@ namespace MEDCoupling T *pt(getPointer()+bgTuples*nbComp+bgComp); if(assignTech) { - for(int i=0;i - void DataArrayTemplate::setPartOfValuesSimple1(T a, int bgTuples, int endTuples, int stepTuples, int bgComp, int endComp, int stepComp) + void DataArrayTemplate::setPartOfValuesSimple1(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple1"; checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); - int newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfComp(DataArray::GetNumberOfItemGivenBES(bgComp,endComp,stepComp,msg)); std::size_t nbComp(getNumberOfComponents()); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); @@ -1706,7 +1706,7 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValues2(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues2(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare) { if(!a) throw INTERP_KERNEL::Exception("DataArrayDouble::setPartOfValues2 : input DataArrayDouble is NULL !"); @@ -1715,7 +1715,7 @@ namespace MEDCoupling a->checkAllocated(); std::size_t nbComp(getNumberOfComponents()); mcIdType nbOfTuples(getNumberOfTuples()); - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); mcIdType newNbOfTuples(ToIdType(std::distance(bgTuples,endTuples))); std::size_t newNbOfComp(std::distance(bgComp,endComp)); @@ -1734,10 +1734,10 @@ namespace MEDCoupling const T *srcPt(a->getConstPointer()); if(assignTech) { - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) { DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); - for(const int *z=bgComp;z!=endComp;z++,srcPt++) + for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt++) { pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt; } @@ -1745,11 +1745,11 @@ namespace MEDCoupling } else { - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) { const T *srcPt2=srcPt; DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); - for(const int *z=bgComp;z!=endComp;z++,srcPt2++) + for(const mcIdType *z=bgComp;z!=endComp;z++,srcPt2++) { pt[(std::size_t)(*w)*nbComp+(*z)]=*srcPt2; } @@ -1780,16 +1780,16 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValuesSimple2(T a, const int *bgTuples, const int *endTuples, const int *bgComp, const int *endComp) + void DataArrayTemplate::setPartOfValuesSimple2(T a, const mcIdType *bgTuples, const mcIdType *endTuples, const mcIdType *bgComp, const mcIdType *endComp) { checkAllocated(); std::size_t nbComp=getNumberOfComponents(); mcIdType nbOfTuples=getNumberOfTuples(); - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); T *pt(getPointer()); - for(const int *w=bgTuples;w!=endTuples;w++) - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *z=bgComp;z!=endComp;z++) { DataArray::CheckValueInRange(nbOfTuples,*w,"invalid tuple id"); pt[(std::size_t)(*w)*nbComp+(*z)]=a; @@ -1843,7 +1843,7 @@ namespace MEDCoupling * \endif */ template - void DataArrayTemplate::setPartOfValues3(const typename Traits::ArrayType *a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues3(const typename Traits::ArrayType *a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp, bool strictCompoCompare) { if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues3 : input DataArrayDouble is NULL !"); @@ -1870,7 +1870,7 @@ namespace MEDCoupling const T *srcPt(a->getConstPointer()); if(assignTech) { - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) for(std::size_t j=0;j - void DataArrayTemplate::setPartOfValuesSimple3(T a, const int *bgTuples, const int *endTuples, int bgComp, int endComp, int stepComp) + void DataArrayTemplate::setPartOfValuesSimple3(T a, const mcIdType *bgTuples, const mcIdType *endTuples, mcIdType bgComp, mcIdType endComp, mcIdType stepComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple3"; checkAllocated(); @@ -1927,7 +1927,7 @@ namespace MEDCoupling mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(ToIdType(nbComp),bgComp,endComp,"invalid component value"); T *pt(getPointer()+bgComp); - for(const int *w=bgTuples;w!=endTuples;w++) + for(const mcIdType *w=bgTuples;w!=endTuples;w++) for(std::size_t j=0;j - void DataArrayTemplate::setPartOfValues4(const typename Traits::ArrayType *a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp, bool strictCompoCompare) + void DataArrayTemplate::setPartOfValues4(const typename Traits::ArrayType *a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp, bool strictCompoCompare) {if(!a) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValues4 : input DataArrayTemplate is NULL !"); const char msg[]="DataArrayTemplate::setPartOfValues4"; checkAllocated(); a->checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); std::size_t newNbOfComp(std::distance(bgComp,endComp)); std::size_t nbComp(getNumberOfComponents()); - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); @@ -1998,35 +1998,35 @@ namespace MEDCoupling T *pt(getPointer()+bgTuples*nbComp); if(assignTech) { - for(int i=0;i - void DataArrayTemplate::setPartOfValuesSimple4(T a, int bgTuples, int endTuples, int stepTuples, const int *bgComp, const int *endComp) + void DataArrayTemplate::setPartOfValuesSimple4(T a, mcIdType bgTuples, mcIdType endTuples, mcIdType stepTuples, const mcIdType *bgComp, const mcIdType *endComp) { const char msg[]="DataArrayTemplate::setPartOfValuesSimple4"; checkAllocated(); - int newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); + mcIdType newNbOfTuples(DataArray::GetNumberOfItemGivenBES(bgTuples,endTuples,stepTuples,msg)); std::size_t nbComp(getNumberOfComponents()); - for(const int *z=bgComp;z!=endComp;z++) + for(const mcIdType *z=bgComp;z!=endComp;z++) DataArray::CheckValueInRange(ToIdType(nbComp),*z,"invalid component id"); mcIdType nbOfTuples(getNumberOfTuples()); DataArray::CheckValueInRangeEx(nbOfTuples,bgTuples,endTuples,"invalid tuple value"); T *pt=getPointer()+bgTuples*nbComp; - for(int i=0;i - void DataArrayTemplate::setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayInt *tuplesSelec) + void DataArrayTemplate::setPartOfValuesAdv(const typename Traits::ArrayType *a, const DataArrayIdType *tuplesSelec) { if(!a || !tuplesSelec) throw INTERP_KERNEL::Exception("DataArrayTemplate::setPartOfValuesAdv : input DataArrayTemplate is NULL !"); @@ -2068,7 +2068,7 @@ namespace MEDCoupling mcIdType aNt(a->getNumberOfTuples()); T *valsToSet(getPointer()); const T *valsSrc(a->getConstPointer()); - for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2) + for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple+=2) { if(tuple[1]>=0 && tuple[1] - void DataArrayTemplate::setContigPartOfSelectedValues(int tupleIdStart, const DataArray *aBase, const DataArrayInt *tuplesSelec) + void DataArrayTemplate::setContigPartOfSelectedValues(mcIdType tupleIdStart, const DataArray *aBase, const DataArrayIdType *tuplesSelec) { if(!aBase || !tuplesSelec) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : input DataArray is NULL !"); @@ -2136,7 +2136,7 @@ namespace MEDCoupling if(tupleIdStart+nbOfTupleToWrite>thisNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValues : invalid number range of values to write !"); const T *valsSrc=a->getConstPointer(); - for(const int *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp) + for(const mcIdType *tuple=tuplesSelec->begin();tuple!=tuplesSelec->end();tuple++,valsToSet+=nbOfComp) { if(*tuple>=0 && *tuple - void DataArrayTemplate::setContigPartOfSelectedValuesSlice(int tupleIdStart, const DataArray *aBase, int bg, int end2, int step) + void DataArrayTemplate::setContigPartOfSelectedValuesSlice(mcIdType tupleIdStart, const DataArray *aBase, mcIdType bg, mcIdType end2, mcIdType step) { if(!aBase) { @@ -2191,7 +2191,7 @@ namespace MEDCoupling a->checkAllocated(); std::size_t nbOfComp(getNumberOfComponents()); const char msg[]="DataArrayDouble::setContigPartOfSelectedValuesSlice"; - int nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg)); + mcIdType nbOfTupleToWrite(DataArray::GetNumberOfItemGivenBES(bg,end2,step,msg)); if(nbOfComp!=a->getNumberOfComponents()) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : This and a do not have the same number of components !"); mcIdType thisNt(getNumberOfTuples()); @@ -2202,7 +2202,7 @@ namespace MEDCoupling if(end2>aNt) throw INTERP_KERNEL::Exception("DataArrayTemplate::setContigPartOfSelectedValuesSlice : invalid range of values to read !"); const T *valsSrc(a->getConstPointer()+bg*nbOfComp); - for(int i=0;i - typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const + typename Traits::ArrayType *DataArrayTemplate::mySelectByTupleRanges(const std::vector >& ranges) const { checkAllocated(); std::size_t nbOfComp(getNumberOfComponents()); @@ -2234,9 +2234,9 @@ namespace MEDCoupling ret->copyStringInfoFrom(*this); return ret.retn(); } - int ref(ranges.front().first),nbOfTuples(0); + mcIdType ref(ranges.front().first),nbOfTuples(0); bool isIncreasing(true); - for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) + for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) { if((*it).first<=(*it).second) { @@ -2269,7 +2269,7 @@ namespace MEDCoupling ret->copyStringInfoFrom(*this); const T *src(getConstPointer()); T *work(ret->getPointer()); - for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) + for(std::vector >::const_iterator it=ranges.begin();it!=ranges.end();it++) work=std::copy(src+(*it).first*nbOfComp,src+(*it).second*nbOfComp,work); return ret.retn(); } @@ -2321,7 +2321,7 @@ namespace MEDCoupling * \sa getMaxAbsValue, getMinValue */ template - T DataArrayTemplate::getMaxValue(int& tupleId) const + T DataArrayTemplate::getMaxValue(mcIdType& tupleId) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -2331,7 +2331,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayDouble::getMaxValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); const T *loc(std::max_element(vals,vals+nbOfTuples)); - tupleId=(int)std::distance(vals,loc); + tupleId=(mcIdType)std::distance(vals,loc); return *loc; } @@ -2402,7 +2402,7 @@ namespace MEDCoupling * \throw If \a this->getNumberOfTuples() < 1 */ template - T DataArrayTemplate::getMinValue(int& tupleId) const + T DataArrayTemplate::getMinValue(mcIdType& tupleId) const { checkAllocated(); if(getNumberOfComponents()!=1) @@ -2412,7 +2412,7 @@ namespace MEDCoupling throw INTERP_KERNEL::Exception("DataArrayDouble::getMinValue : array exists but number of tuples must be > 0 !"); const T *vals(getConstPointer()); const T *loc(std::min_element(vals,vals+nbOfTuples)); - tupleId=(int)std::distance(vals,loc); + tupleId=(mcIdType)std::distance(vals,loc); return *loc; } @@ -2431,12 +2431,12 @@ namespace MEDCoupling } template - void DataArrayTemplate::circularPermutation(int nbOfShift) + void DataArrayTemplate::circularPermutation(mcIdType nbOfShift) { checkAllocated(); std::size_t nbOfCompo(getNumberOfComponents()); mcIdType nbTuples(getNumberOfTuples()); - int effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,nbTuples)); if(effNbSh==0) return ; T *work(getPointer()); @@ -2457,12 +2457,12 @@ namespace MEDCoupling } template - void DataArrayTemplate::circularPermutationPerTuple(int nbOfShift) + void DataArrayTemplate::circularPermutationPerTuple(mcIdType nbOfShift) { checkAllocated(); std::size_t nbOfCompo(getNumberOfComponents()); mcIdType nbTuples(getNumberOfTuples()); - int effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo))); + mcIdType effNbSh(EffectiveCircPerm(nbOfShift,ToIdType(nbOfCompo))); if(effNbSh==0) return ; T *work(getPointer()); @@ -2583,9 +2583,9 @@ namespace MEDCoupling * \return DataArrayInt * - the new instance of DataArrayInt. */ template - MCAuto DataArrayTemplateClassic::convertToIntArr() const + MCAuto DataArrayTemplateClassic::convertToIntArr() const { - return convertToOtherTypeOfArr(); + return convertToOtherTypeOfArr(); } /*! @@ -3128,36 +3128,36 @@ struct NotInRange * \sa DataArrayInt::findIdsInRange */ template - DataArrayInt *DataArrayTemplateClassic::findIdsStrictlyNegative() const + DataArrayIdType *DataArrayTemplateClassic::findIdsStrictlyNegative() const { LowerThan lt((T)0); - MCAuto ret(findIdsAdv(lt)); + MCAuto ret(findIdsAdv(lt)); return ret.retn(); } template - MCAuto DataArrayTemplateClassic::findIdsGreaterOrEqualTo(T val) const + MCAuto DataArrayTemplateClassic::findIdsGreaterOrEqualTo(T val) const { GreatEqual ge(val); return findIdsAdv(ge); } template - MCAuto DataArrayTemplateClassic::findIdsGreaterThan(T val) const + MCAuto DataArrayTemplateClassic::findIdsGreaterThan(T val) const { GreaterThan gt(val); return findIdsAdv(gt); } template - MCAuto DataArrayTemplateClassic::findIdsLowerOrEqualTo(T val) const + MCAuto DataArrayTemplateClassic::findIdsLowerOrEqualTo(T val) const { LowerEqual le(val); return findIdsAdv(le); } template - MCAuto DataArrayTemplateClassic::findIdsLowerThan(T val) const + MCAuto DataArrayTemplateClassic::findIdsLowerThan(T val) const { LowerThan lt(val); return findIdsAdv(lt); @@ -3220,7 +3220,7 @@ struct NotInRange std::vector pts(a.size()); nbc[0]=(*it)->getNumberOfComponents(); pts[0]=(*it++)->getConstPointer(); - for(int i=1;it!=a.end();it++,i++) + for(mcIdType i=1;it!=a.end();it++,i++) { if(nbOfTuples!=(*it)->getNumberOfTuples()) throw INTERP_KERNEL::Exception("DataArrayDouble::Meld : mismatch of number of tuples !"); @@ -3333,7 +3333,7 @@ struct NotInRange * \throw if \a this is not allocated or if \a this has not number of components set to one or if \a nbTimes is lower than 1. */ template - typename Traits::ArrayType *DataArrayTemplateClassic::duplicateEachTupleNTimes(int nbTimes) const + typename Traits::ArrayType *DataArrayTemplateClassic::duplicateEachTupleNTimes(mcIdType nbTimes) const { this->checkAllocated(); if(this->getNumberOfComponents()!=1) @@ -3347,7 +3347,7 @@ struct NotInRange for(mcIdType i=0;icopyStringInfoFrom(*this); @@ -3927,7 +3927,7 @@ struct NotInRange /*! * Returns an integer value characterizing \a this array, which is useful for a quick * comparison of many instances of DataArrayInt. - * \return int - the hash value. + * \return mcIdType - the hash value. * \throw If \a this is not allocated. */ template @@ -3955,7 +3955,7 @@ struct NotInRange stream << Traits::ArrayTypeName << " *" << varName << "=" << Traits::ArrayTypeName << "::New();" << std::endl; if(nbTuples*nbComp>=1) { - stream << "const int " << varName << "Data[" << nbTuples*nbComp << "]={"; + stream << "const mcIdType " << varName << "Data[" << nbTuples*nbComp << "]={"; std::copy(data,data+nbTuples*nbComp-1,std::ostream_iterator(stream,",")); stream << data[nbTuples*nbComp-1] << "};" << std::endl; stream << varName << "->useArray(" << varName << "Data,false,CPP_DEALLOC," << nbTuples << "," << nbComp << ");" << std::endl; @@ -4026,7 +4026,7 @@ struct NotInRange } template - void DataArrayDiscrete::writeVTK(std::ostream& ofs, int indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const + void DataArrayDiscrete::writeVTK(std::ostream& ofs, mcIdType indent, const std::string& type, const std::string& nameInFile, DataArrayByte *byteArr) const { static const char SPACE[4]={' ',' ',' ',' '}; this->checkAllocated(); @@ -4773,7 +4773,7 @@ struct NotInRange * This method checks that \a this is uniform. If not and exception will be thrown. * In case of uniformity the corresponding value is returned. * - * \return int - the unique value contained in this + * \return mcIdType - the unique value contained in this * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1 * \throw If \a this is not uniform. @@ -5080,7 +5080,7 @@ struct NotInRange * one-dimensional array. * \param [in] oldValue - the value to replace. * \param [in] newValue - the value to assign. - * \return int - number of replacements performed. + * \return mcIdType - number of replacements performed. * \throw If \a this is not allocated. * \throw If \a this->getNumberOfComponents() != 1. */ @@ -6689,7 +6689,7 @@ struct NotInRange * permutation map is computed. * \param [in] end - pointer specifying the end of the array \a start, so that * the last value of \a start is \a end[ -1 ]. - * \return int * - the result permutation array that the caller is to delete as it is no + * \return mcIdType * - the result permutation array that the caller is to delete as it is no * more needed. * \throw If there are equal values in the input array. */ @@ -6929,7 +6929,7 @@ struct NotInRange /*! * This method allows to put a vector of vector of integer into a more compact data structure (skyline). - * This method is not available into python because no available optimized data structure available to map std::vector< std::vector >. + * This method is not available into python because no available optimized data structure available to map std::vector< std::vector >. * * \param [in] v the input data structure to be translate into skyline format. * \param [out] data the first element of the skyline format. The user is expected to deal with newly allocated array. diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.cxx b/src/MEDCoupling/MEDCouplingPartDefinition.cxx index ce270590a..80538490e 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.cxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.cxx @@ -25,17 +25,17 @@ using namespace MEDCoupling; -PartDefinition *PartDefinition::New(int start, int stop, int step) +PartDefinition *PartDefinition::New(mcIdType start, mcIdType stop, mcIdType step) { return SlicePartDefinition::New(start,stop,step); } -PartDefinition *PartDefinition::New(DataArrayInt *listOfIds) +PartDefinition *PartDefinition::New(DataArrayIdType *listOfIds) { return DataArrayPartDefinition::New(listOfIds); } -PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) +PartDefinition *PartDefinition::Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) { if(tinyInt.empty()) { @@ -57,7 +57,7 @@ PartDefinition::~PartDefinition() { } -DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayInt *listOfIds) +DataArrayPartDefinition *DataArrayPartDefinition::New(DataArrayIdType *listOfIds) { return new DataArrayPartDefinition(listOfIds); } @@ -75,7 +75,7 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& what="DataArrayPartDefinition::isEqual : other is not DataArrayPartDefinition !"; return false; } - const DataArrayInt *arr0(_arr),*arr1(otherC->_arr); + const DataArrayIdType *arr0(_arr),*arr1(otherC->_arr); if(!arr0 && !arr1) return true; if((arr0 && !arr1) || (!arr0 && arr1)) @@ -95,13 +95,13 @@ bool DataArrayPartDefinition::isEqual(const PartDefinition *other, std::string& DataArrayPartDefinition *DataArrayPartDefinition::deepCopy() const { - const DataArrayInt *arr(_arr); + const DataArrayIdType *arr(_arr); if(!arr) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::deepCopy : array is null !"); - return DataArrayPartDefinition::New(const_cast(arr)); + return DataArrayPartDefinition::New(const_cast(arr)); } -int DataArrayPartDefinition::getNumberOfElems() const +mcIdType DataArrayPartDefinition::getNumberOfElems() const { checkInternalArrayOK(); return _arr->getNumberOfTuples(); @@ -124,7 +124,7 @@ PartDefinition *DataArrayPartDefinition::operator+(const PartDefinition& other) std::string DataArrayPartDefinition::getRepr() const { std::ostringstream oss; oss << "DataArray Part : "; - const DataArrayInt *arr(_arr); + const DataArrayIdType *arr(_arr); if(arr) arr->reprQuickOverview(oss); else @@ -145,19 +145,19 @@ PartDefinition *DataArrayPartDefinition::composeWith(const PartDefinition *other const SlicePartDefinition *spd(dynamic_cast(other)); if(spd) {//special case for optim - int a(0),b(0),c(0); + mcIdType a(0),b(0),c(0); spd->getSlice(a,b,c); if(c==1) { - MCAuto arr(DataArrayInt::New()); + MCAuto arr(DataArrayIdType::New()); arr->alloc(_arr->getNumberOfTuples(),1); - std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); + std::transform(_arr->begin(),_arr->end(),arr->getPointer(),std::bind2nd(std::plus(),a)); return DataArrayPartDefinition::New(arr); } } // - MCAuto arr1(other->toDAI()); - MCAuto arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); + MCAuto arr1(other->toDAI()); + MCAuto arr2(arr1->selectByTupleIdSafe(_arr->begin(),_arr->end())); return DataArrayPartDefinition::New(arr2); } @@ -174,7 +174,7 @@ void DataArrayPartDefinition::checkConsistencyLight() const PartDefinition *DataArrayPartDefinition::tryToSimplify() const { checkConsistencyLight(); - int a(0),b(0),c(0); + mcIdType a(0),b(0),c(0); if(_arr->isRange(a,b,c)) { return SlicePartDefinition::New(a,b,c); @@ -187,21 +187,21 @@ PartDefinition *DataArrayPartDefinition::tryToSimplify() const } } -void DataArrayPartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void DataArrayPartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { bigArraysI.push_back(_arr); } -DataArrayInt *DataArrayPartDefinition::toDAI() const +DataArrayIdType *DataArrayPartDefinition::toDAI() const { checkInternalArrayOK(); - const DataArrayInt *arr(_arr); - DataArrayInt *arr2(const_cast(arr)); + const DataArrayIdType *arr(_arr); + DataArrayIdType *arr2(const_cast(arr)); arr2->incrRef(); return arr2; } -DataArrayPartDefinition::DataArrayPartDefinition(DataArrayInt *listOfIds) +DataArrayPartDefinition::DataArrayPartDefinition(DataArrayIdType *listOfIds) { CheckInternalArrayOK(listOfIds); _arr=listOfIds; @@ -213,7 +213,7 @@ void DataArrayPartDefinition::checkInternalArrayOK() const CheckInternalArrayOK(_arr); } -void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds) +void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayIdType *listOfIds) { if(!listOfIds || !listOfIds->isAllocated() || listOfIds->getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("DataArrayPartDefinition::CheckInternalArrayOK : Input list must be not null allocated and with one components !"); @@ -221,7 +221,7 @@ void DataArrayPartDefinition::CheckInternalArrayOK(const DataArrayInt *listOfIds void DataArrayPartDefinition::updateTime() const { - if((const DataArrayInt *)_arr) + if((const DataArrayIdType *)_arr) updateTimeWith(*_arr); } @@ -232,22 +232,22 @@ std::size_t DataArrayPartDefinition::getHeapMemorySizeWithoutChildren() const std::vector DataArrayPartDefinition::getDirectChildrenWithNull() const { - std::vector ret(1,(const DataArrayInt *)_arr); + std::vector ret(1,(const DataArrayIdType *)_arr); return ret; } DataArrayPartDefinition *DataArrayPartDefinition::add1(const DataArrayPartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } DataArrayPartDefinition *DataArrayPartDefinition::add2(const SlicePartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -256,7 +256,7 @@ DataArrayPartDefinition::~DataArrayPartDefinition() { } -SlicePartDefinition *SlicePartDefinition::New(int start, int stop, int step) +SlicePartDefinition *SlicePartDefinition::New(mcIdType start, mcIdType stop, mcIdType step) { return new SlicePartDefinition(start,stop,step); } @@ -288,12 +288,12 @@ SlicePartDefinition *SlicePartDefinition::deepCopy() const return SlicePartDefinition::New(_start,_stop,_step); } -DataArrayInt *SlicePartDefinition::toDAI() const +DataArrayIdType *SlicePartDefinition::toDAI() const { - return DataArrayInt::Range(_start,_stop,_step); + return DataArrayIdType::Range(_start,_stop,_step); } -int SlicePartDefinition::getNumberOfElems() const +mcIdType SlicePartDefinition::getNumberOfElems() const { return DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getNumberOfElems"); } @@ -322,8 +322,8 @@ PartDefinition *SlicePartDefinition::composeWith(const PartDefinition *other) co throw INTERP_KERNEL::Exception("SlicePartDefinition::composeWith : input PartDef must be not NULL !"); checkConsistencyLight(); other->checkConsistencyLight(); - MCAuto arr(other->toDAI()); - MCAuto arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step)); + MCAuto arr(other->toDAI()); + MCAuto arr1(arr->selectByTupleIdSafeSlice(_start,_stop,_step)); return DataArrayPartDefinition::New(arr1); } @@ -346,7 +346,7 @@ PartDefinition *SlicePartDefinition::tryToSimplify() const return ret; } -void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const +void SlicePartDefinition::serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const { tinyInt.push_back(_start); tinyInt.push_back(_stop); @@ -360,20 +360,20 @@ std::string SlicePartDefinition::getRepr() const return oss.str(); } -int SlicePartDefinition::getEffectiveStop() const +mcIdType SlicePartDefinition::getEffectiveStop() const { - int nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); + mcIdType nbElems(DataArray::GetNumberOfItemGivenBES(_start,_stop,_step,"SlicePartDefinition::getEffectiveStop")); return _start+nbElems*_step; } -void SlicePartDefinition::getSlice(int& start, int& stop, int& step) const +void SlicePartDefinition::getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const { start=_start; stop=_stop; step=_step; } -SlicePartDefinition::SlicePartDefinition(int start, int stop, int step):_start(start),_stop(stop),_step(step) +SlicePartDefinition::SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step):_start(start),_stop(stop),_step(step) { } @@ -396,8 +396,8 @@ std::vector SlicePartDefinition::getDirectChildrenWithN DataArrayPartDefinition *SlicePartDefinition::add1(const DataArrayPartDefinition *other) const { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } @@ -410,8 +410,8 @@ PartDefinition *SlicePartDefinition::add2(const SlicePartDefinition *other) cons } else { - MCAuto a1(toDAI()),a2(other->toDAI()); - MCAuto a3(DataArrayInt::Aggregate(a1,a2,0)); + MCAuto a1(toDAI()),a2(other->toDAI()); + MCAuto a3(DataArrayIdType::Aggregate(a1,a2,0)); a3->sort(); return DataArrayPartDefinition::New(a3); } diff --git a/src/MEDCoupling/MEDCouplingPartDefinition.hxx b/src/MEDCoupling/MEDCouplingPartDefinition.hxx index c675c8146..bb32ef9fa 100644 --- a/src/MEDCoupling/MEDCouplingPartDefinition.hxx +++ b/src/MEDCoupling/MEDCouplingPartDefinition.hxx @@ -30,19 +30,19 @@ namespace MEDCoupling class PartDefinition : public RefCountObject, public TimeLabel { public: - MEDCOUPLING_EXPORT static PartDefinition *New(int start, int stop, int step); - MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayInt *listOfIds); - MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); + MEDCOUPLING_EXPORT static PartDefinition *New(mcIdType start, mcIdType stop, mcIdType step); + MEDCOUPLING_EXPORT static PartDefinition *New(DataArrayIdType *listOfIds); + MEDCOUPLING_EXPORT static PartDefinition *Unserialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI); MEDCOUPLING_EXPORT virtual bool isEqual(const PartDefinition *other, std::string& what) const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *deepCopy() const = 0; - MEDCOUPLING_EXPORT virtual DataArrayInt *toDAI() const = 0; - MEDCOUPLING_EXPORT virtual int getNumberOfElems() const = 0; + MEDCOUPLING_EXPORT virtual DataArrayIdType *toDAI() const = 0; + MEDCOUPLING_EXPORT virtual mcIdType getNumberOfElems() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *operator+(const PartDefinition& other) const = 0; MEDCOUPLING_EXPORT virtual std::string getRepr() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *composeWith(const PartDefinition *other) const = 0; MEDCOUPLING_EXPORT virtual void checkConsistencyLight() const = 0; MEDCOUPLING_EXPORT virtual PartDefinition *tryToSimplify() const = 0; - MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; + MEDCOUPLING_EXPORT virtual void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const = 0; protected: virtual ~PartDefinition(); }; @@ -52,21 +52,21 @@ namespace MEDCoupling class DataArrayPartDefinition : public PartDefinition { public: - MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayInt *listOfIds); + MEDCOUPLING_EXPORT static DataArrayPartDefinition *New(DataArrayIdType *listOfIds); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; MEDCOUPLING_EXPORT DataArrayPartDefinition *deepCopy() const; - MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; - MEDCOUPLING_EXPORT int getNumberOfElems() const; + MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const; MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; MEDCOUPLING_EXPORT std::string getRepr() const; MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; private: - DataArrayPartDefinition(DataArrayInt *listOfIds); + DataArrayPartDefinition(DataArrayIdType *listOfIds); void checkInternalArrayOK() const; - static void CheckInternalArrayOK(const DataArrayInt *listOfIds); + static void CheckInternalArrayOK(const DataArrayIdType *listOfIds); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; @@ -80,22 +80,22 @@ namespace MEDCoupling class SlicePartDefinition : public PartDefinition { public: - MEDCOUPLING_EXPORT static SlicePartDefinition *New(int start, int stop, int step); + MEDCOUPLING_EXPORT static SlicePartDefinition *New(mcIdType start, mcIdType stop, mcIdType step); MEDCOUPLING_EXPORT bool isEqual(const PartDefinition *other, std::string& what) const; MEDCOUPLING_EXPORT SlicePartDefinition *deepCopy() const; - MEDCOUPLING_EXPORT DataArrayInt *toDAI() const; - MEDCOUPLING_EXPORT int getNumberOfElems() const; + MEDCOUPLING_EXPORT DataArrayIdType *toDAI() const; + MEDCOUPLING_EXPORT mcIdType getNumberOfElems() const; MEDCOUPLING_EXPORT PartDefinition *operator+(const PartDefinition& other) const; MEDCOUPLING_EXPORT std::string getRepr() const; MEDCOUPLING_EXPORT PartDefinition *composeWith(const PartDefinition *other) const; MEDCOUPLING_EXPORT void checkConsistencyLight() const; MEDCOUPLING_EXPORT PartDefinition *tryToSimplify() const; - MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; + MEDCOUPLING_EXPORT void serialize(std::vector& tinyInt, std::vector< MCAuto >& bigArraysI) const; //specific method - MEDCOUPLING_EXPORT int getEffectiveStop() const; - MEDCOUPLING_EXPORT void getSlice(int& start, int& stop, int& step) const; + MEDCOUPLING_EXPORT mcIdType getEffectiveStop() const; + MEDCOUPLING_EXPORT void getSlice(mcIdType& start, mcIdType& stop, mcIdType& step) const; private: - SlicePartDefinition(int start, int stop, int step); + SlicePartDefinition(mcIdType start, mcIdType stop, mcIdType step); MEDCOUPLING_EXPORT void updateTime() const; MEDCOUPLING_EXPORT std::size_t getHeapMemorySizeWithoutChildren() const; MEDCOUPLING_EXPORT std::vector getDirectChildrenWithNull() const; -- 2.39.2