void MEDCouplingUMesh::checkCoherency() const throw(INTERP_KERNEL::Exception)
{
if(_mesh_dim<-1)
- throw INTERP_KERNEL::Exception("No mesh dimension specified !");
+ throw INTERP_KERNEL::Exception("No mesh dimension specified !");
+ if(_mesh_dim!=-1)
+ MEDCouplingPointSet::checkCoherency();
for(std::set<INTERP_KERNEL::NormalizedCellType>::const_iterator iter=_types.begin();iter!=_types.end();iter++)
{
if((int)INTERP_KERNEL::CellModel::GetCellModel(*iter).getDimension()!=_mesh_dim)
pt=std::find_if(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),std::bind2nd(std::greater<int>(),maxId));
if(pt!=da->getConstPointer()+da->getNbOfElems())
throw INTERP_KERNEL::Exception("checkDeepEquivalWith : some cells in other are not in this !");
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=DataArrayInt::New();
- cellCor2->alloc(otherC->getNumberOfCells(),1);
- std::copy(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),cellCor2->getPointer());
- bool nident=nodeCor2->isIdentity();
- bool cident=cellCor2->isIdentity();
- if(!nident) nodeCor=nodeCor2.retn(); else nodeCor=0;
- if(!cident) cellCor=cellCor2.retn(); else cellCor=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1);
+ nodeCor=nodeCor2->isIdentity()?0:nodeCor2.retn();
+ cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
}
/*!
{
throw INTERP_KERNEL::Exception("checkDeepEquivalOnSameNodesWith : some cells in other are not in this !");
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=DataArrayInt::New();
- cellCor2->alloc(otherC->getNumberOfCells(),1);
- std::copy(da->getConstPointer()+getNumberOfCells(),da->getConstPointer()+da->getNbOfElems(),cellCor2->getPointer());
- if(!cellCor2->isIdentity()) cellCor=cellCor2.retn(); else cellCor=0;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellCor2=da->selectByTupleId2(getNumberOfCells(),da->getNbOfElems(),1);
+ cellCor=cellCor2->isIdentity()?0:cellCor2.retn();
}
/*!
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> out1=DataArrayInt::New(); out1->alloc(nbCells+1,1);
int *out1Ptr=out1->getPointer();
*out1Ptr++=0;
- std::vector<int> out0v;
- out0v.reserve(desc->getNumberOfTuples());
+ out0->reserve(desc->getNumberOfTuples());
for(int i=0;i<nbCells;i++,descIPtr++,out1Ptr++)
{
for(const int *w1=descPtr+descIPtr[0];w1!=descPtr+descIPtr[1];w1++)
{
std::set<int> s(revDescPtr+revDescIPtr[*w1],revDescPtr+revDescIPtr[(*w1)+1]);
s.erase(i);
- out0v.insert(out0v.end(),s.begin(),s.end());
+ out0->insertAtTheEnd(s.begin(),s.end());
}
- *out1Ptr=out0v.size();
+ *out1Ptr=out0->getNumberOfTuples();
}
- out0->alloc((int)out0v.size(),1);
- std::copy(out0v.begin(),out0v.end(),out0->getPointer());
neighbors=out0.retn();
neighborsIndx=out1.retn();
}
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connINew=DataArrayInt::New();
connINew->alloc(nbOfCells+1,1);
int *connINewPtr=connINew->getPointer(); *connINewPtr++=0;
- std::vector<int> connNew;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connNew=DataArrayInt::New();
bool changed=false;
for(int i=0;i<nbOfCells;i++,connINewPtr++)
{
changed=true;
}
else
- connNew.insert(connNew.end(),conn+index[i],conn+index[i+1]);
- *connINewPtr=(int)connNew.size();
+ connNew->insertAtTheEnd(conn+index[i],conn+index[i+1]);
+ *connINewPtr=connNew->getNumberOfTuples();
}
if(changed)
- {
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> connNew2=DataArrayInt::New();
- connNew2->alloc((int)connNew.size(),1);
- std::copy(connNew.begin(),connNew.end(),connNew2->getPointer());
- setConnectivity(connNew2,connINew,false);
- }
+ setConnectivity(connNew,connINew,false);
}
/*!
DataArrayInt *MEDCouplingUMesh::computeFetchedNodeIds() const throw(INTERP_KERNEL::Exception)
{
checkConnectivityFullyDefined();
- std::set<int> retS;
int nbOfCells=getNumberOfCells();
const int *connIndex=_nodal_connec_index->getConstPointer();
const int *conn=_nodal_connec->getConstPointer();
+ const int *maxEltPt=std::max_element(_nodal_connec->begin(),_nodal_connec->end());
+ int maxElt=maxEltPt==_nodal_connec->end()?0:std::abs(*maxEltPt)+1;
+ std::vector<bool> retS(maxElt,false);
for(int i=0;i<nbOfCells;i++)
for(int j=connIndex[i]+1;j<connIndex[i+1];j++)
if(conn[j]>=0)
- retS.insert(conn[j]);
+ retS[conn[j]]=true;
+ int sz=0;
+ for(int i=0;i<maxElt;i++)
+ if(retS[i])
+ sz++;
DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)retS.size(),1);
- std::copy(retS.begin(),retS.end(),ret->getPointer());
+ ret->alloc(sz,1);
+ int *retPtr=ret->getPointer();
+ for(int i=0;i<maxElt;i++)
+ if(retS[i])
+ *retPtr++=i;
return ret;
}
if(dim!=1)
{
int sz1=2*(sz-1);
- int *tmp=new int[sz1];
- int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],tmp);
+ INTERP_KERNEL::AutoPtr<int> tmp=new int[sz1];
+ int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
- work=std::search(tmp,tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
- delete [] tmp;
+ work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
return work!=tmp+sz1?1:0;
}
else
if(dim!=1)
{
int sz1=2*(sz-1);
- int *tmp=new int[sz1];
- int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],tmp);
+ INTERP_KERNEL::AutoPtr<int> tmp=new int[sz1];
+ int *work=std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],(int *)tmp);
std::copy(conn+connI[cell1]+1,conn+connI[cell1+1],work);
- work=std::search(tmp,tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
+ work=std::search((int *)tmp,(int *)tmp+sz1,conn+connI[cell2]+1,conn+connI[cell2+1]);
if(work!=tmp+sz1)
- {
- delete [] tmp;
- return 1;
- }
+ return 1;
else
{
- std::reverse_iterator<int *> it1(tmp+sz1);
- std::reverse_iterator<int *> it2(tmp);
+ std::reverse_iterator<int *> it1((int *)tmp+sz1);
+ std::reverse_iterator<int *> it2((int *)tmp);
if(std::search(it1,it2,conn+connI[cell2]+1,conn+connI[cell2+1])!=it2)
- {
- delete [] tmp;
- return 2;
- }
+ return 2;
else
- {
- delete [] tmp;
- return 0;
- }
+ return 0;
}
return work!=tmp+sz1?1:0;
* If in 'candidates' pool -1 value is considered as an empty value.
* WARNING this method returns only ONE set of result !
*/
-bool MEDCouplingUMesh::areCellsEqualInPool(const std::vector<int>& candidates, int compType, std::vector<int>& result) const
+bool MEDCouplingUMesh::areCellsEqualInPool(const std::vector<int>& candidates, int compType, DataArrayInt *result) const
{
if(candidates.size()<1)
return false;
{
if(!ret)
{
- result.push_back(start);
+ result->pushBackSilent(start);
ret=true;
}
if(status==1)
- result.push_back(*iter);
+ result->pushBackSilent(*iter);
else
- result.push_back(status==2?(*iter+1):-(*iter+1));
+ result->pushBackSilent(status==2?(*iter+1):-(*iter+1));
}
}
return ret;
* \return the correspondance array old to new in a newly allocated array.
*
*/
-void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, std::vector<int>& commonCells, std::vector<int>& commonCellsI) const throw(INTERP_KERNEL::Exception)
+void MEDCouplingUMesh::findCommonCells(int compType, int startCellId, DataArrayInt *& commonCellsArr, DataArrayInt *& commonCellsIArr) const throw(INTERP_KERNEL::Exception)
{
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCells=DataArrayInt::New(),commonCellsI=DataArrayInt::New();
checkConnectivityFullyDefined();
int nbOfCells=getNumberOfCells();
- commonCells.clear();
- commonCellsI.resize(1); commonCellsI[0]=0;
+ commonCellsI->reserve(1); commonCellsI->pushBackSilent(0);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revNodal=DataArrayInt::New(),revNodalI=DataArrayInt::New();
getReverseNodalConnectivity(revNodal,revNodalI);
const int *revNodalPtr=revNodal->getConstPointer(),*revNodalIPtr=revNodalI->getConstPointer();
{
if(areCellsEqualInPool(v2,compType,commonCells))
{
- int pos=commonCellsI.back();
- commonCellsI.push_back((int)commonCells.size());
- for(std::vector<int>::const_iterator it=commonCells.begin()+pos;it!=commonCells.end();it++)
+ int pos=commonCellsI->back();
+ commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
+ for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
}
{
if(areCellsEqualInPool(v2,compType,commonCells))
{
- int pos=commonCellsI.back();
- commonCellsI.push_back((int)commonCells.size());
- for(std::vector<int>::const_iterator it=commonCells.begin()+pos;it!=commonCells.end();it++)
+ int pos=commonCellsI->back();
+ commonCellsI->pushBackSilent(commonCells->getNumberOfTuples());
+ for(const int *it=commonCells->begin()+pos;it!=commonCells->end();it++)
isFetched[*it]=true;
}
}
}
}
}
+ commonCellsArr=commonCells.retn();
+ commonCellsIArr=commonCellsI.retn();
}
/*!
*/
DataArrayInt *MEDCouplingUMesh::zipConnectivityTraducer(int compType, int startCellId) throw(INTERP_KERNEL::Exception)
{
- std::vector<int> commonCells,commonCellsI;
+ DataArrayInt *commonCells=0,*commonCellsI=0;
findCommonCells(compType,startCellId,commonCells,commonCellsI);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
int newNbOfCells=-1;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfCells(),&commonCells[0],&commonCellsI[0],
- &commonCellsI[0]+commonCellsI.size(),newNbOfCells);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::BuildOld2NewArrayFromSurjectiveFormat2(getNumberOfCells(),commonCells->begin(),commonCellsI->begin(),
+ commonCellsI->end(),newNbOfCells);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=ret->invertArrayO2N2N2O(newNbOfCells);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> self=static_cast<MEDCouplingUMesh *>(buildPartOfMySelf(ret2->begin(),ret2->end(),true));
setConnectivity(self->getNodalConnectivity(),self->getNodalConnectivityIndex(),true);
bool MEDCouplingUMesh::areCellsIncludedIn2(const MEDCouplingUMesh *other, DataArrayInt *& arr) const throw(INTERP_KERNEL::Exception)
{
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mesh=MergeUMeshesOnSameCoords(this,other);
- std::vector<int> commonCells,commonCellsI;
+ DataArrayInt *commonCells=0,*commonCellsI=0;
int thisNbCells=getNumberOfCells();
mesh->findCommonCells(7,thisNbCells,commonCells,commonCellsI);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> commonCellsTmp(commonCells),commonCellsITmp(commonCellsI);
+ const int *commonCellsPtr=commonCells->getConstPointer(),*commonCellsIPtr=commonCellsI->getConstPointer();
int otherNbCells=other->getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> arr2=DataArrayInt::New();
arr2->alloc(otherNbCells,1);
arr2->fillWithZero();
int *arr2Ptr=arr2->getPointer();
- int nbOfCommon=(int)commonCellsI.size()-1;
+ int nbOfCommon=commonCellsI->getNumberOfTuples()-1;
for(int i=0;i<nbOfCommon;i++)
{
- int start=commonCells[commonCellsI[i]];
+ int start=commonCellsPtr[commonCellsIPtr[i]];
if(start<thisNbCells)
{
- for(int j=commonCellsI[i]+1;j!=commonCellsI[i+1];j++)
+ for(int j=commonCellsIPtr[i]+1;j!=commonCellsIPtr[i+1];j++)
{
- int sig=commonCells[j]>0?1:-1;
- int val=std::abs(commonCells[j])-1;
+ int sig=commonCellsPtr[j]>0?1:-1;
+ int val=std::abs(commonCellsPtr[j])-1;
if(val>=thisNbCells)
arr2Ptr[val-thisNbCells]=sig*(start+1);
}
DataArrayInt *MEDCouplingUMesh::getCellIdsFullyIncludedInNodeIds(const int *partBg, const int *partEnd) const
{
- std::vector<int> cellIdsKept;
+ DataArrayInt *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(partBg,partEnd,true,cellIdsKept);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cellIdsKept.size(),1);
- std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer());
- return ret;
+ cellIdsKept->setName(getName());
+ return cellIdsKept;
}
/*!
* Parameter 'fullyIn' specifies if a cell that has part of its nodes in ids array is kept or not.
* If 'fullyIn' is true only cells whose ids are \b fully contained in ['begin','end') tab will be kept.
*
- * @param begin input start of array of node ids.
- * @param end input end of array of node ids.
- * @param fullyIn input that specifies if all node ids must be in ['begin','end') array to consider cell to be in.
- * @param cellIdsKept in/out array where all candidate cell ids are put at the end.
+ * \param [in] begin input start of array of node ids.
+ * \param [in] end input end of array of node ids.
+ * \param [in] fullyIn input that specifies if all node ids must be in ['begin','end') array to consider cell to be in.
+ * \param [in,out] cellIdsKeptArr array where all candidate cell ids are put at the end.
*/
-void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, std::vector<int>& cellIdsKept) const
+void MEDCouplingUMesh::fillCellIdsToKeepFromNodeIds(const int *begin, const int *end, bool fullyIn, DataArrayInt *&cellIdsKeptArr) const
{
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept=DataArrayInt::New();
checkConnectivityFullyDefined();
int tmp=-1;
int sz=getNodalConnectivity()->getMaxValue(tmp); sz=std::max(sz,0)+1;
nbOfHit++;
}
if((ref==nbOfHit && fullyIn) || (nbOfHit!=0 && !fullyIn))
- cellIdsKept.push_back(i);
+ cellIdsKept->pushBackSilent(i);
}
+ cellIdsKeptArr=cellIdsKept.retn();
}
/*!
*/
DataArrayInt *MEDCouplingUMesh::getCellIdsLyingOnNodes(const int *begin, const int *end, bool fullyIn) const
{
- std::vector<int> cellIdsKept;
+ DataArrayInt *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cellIdsKept.size(),1);
- std::copy(cellIdsKept.begin(),cellIdsKept.end(),ret->getPointer());
- ret->setName(getName());
- return ret;
+ cellIdsKept->setName(getName());
+ return cellIdsKept;
}
/*!
*/
MEDCouplingPointSet *MEDCouplingUMesh::buildPartOfMySelfNode(const int *begin, const int *end, bool fullyIn) const
{
- std::vector<int> cellIdsKept;
+ DataArrayInt *cellIdsKept=0;
fillCellIdsToKeepFromNodeIds(begin,end,fullyIn,cellIdsKept);
- return buildPartOfMySelf(&cellIdsKept[0],&cellIdsKept[0]+cellIdsKept.size(),true);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIdsKept2(cellIdsKept);
+ return buildPartOfMySelf(cellIdsKept->begin(),cellIdsKept->end(),true);
}
/*!
DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception)
{
checkFullyDefined();
- DataArrayInt *desc=DataArrayInt::New();
- DataArrayInt *descIndx=DataArrayInt::New();
- DataArrayInt *revDesc=DataArrayInt::New();
- DataArrayInt *revDescIndx=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> descIndx=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDesc=DataArrayInt::New();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx=DataArrayInt::New();
//
- MEDCouplingUMesh *meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx);
- meshDM1->decrRef();
- desc->decrRef();
- descIndx->decrRef();
+ buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx)->decrRef();
+ desc=(DataArrayInt*)0; descIndx=(DataArrayInt*)0;
//
- DataArrayInt *tmp=revDescIndx->deltaShiftIndex();
- DataArrayInt *faceIds=tmp->getIdsEqual(1);
- tmp->decrRef();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> tmp=revDescIndx->deltaShiftIndex();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> faceIds=tmp->getIdsEqual(1); tmp=(DataArrayInt*)0;
int nbOfFaces=faceIds->getNumberOfTuples();
const int *faces=faceIds->getConstPointer();
- std::set<int> ret;
- for(const int *w=faces;w!=faces+nbOfFaces;w++)
- ret.insert(revDesc->getIJ(revDescIndx->getIJ(*w,0),0));
- faceIds->decrRef();
- //
- revDescIndx->decrRef();
- revDesc->decrRef();
+ const int *revDescPtr=revDesc->getConstPointer();
+ const int *revDescIndxPtr=revDescIndx->getConstPointer();
+ int nbOfCells=getNumberOfCells();
+ std::vector<bool> ret1(nbOfCells,false);
+ int sz=0;
+ for(const int *pt=faceIds->begin();pt!=faceIds->end();pt++)
+ if(!ret1[revDescPtr[revDescIndxPtr[*pt]]])
+ { ret1[revDescPtr[revDescIndxPtr[*pt]]]=true; sz++; }
//
DataArrayInt *ret2=DataArrayInt::New();
- ret2->alloc((int)ret.size(),1);
- std::copy(ret.begin(),ret.end(),ret2->getPointer());
+ ret2->alloc(sz,1);
+ int *ret2Ptr=ret2->getPointer();
+ sz=0;
+ for(std::vector<bool>::const_iterator it=ret1.begin();it!=ret1.end();it++,sz++)
+ if(*it)
+ *ret2Ptr++=sz;
ret2->setName("BoundaryCells");
return ret2;
}
* The coordinates array is not considered here.
*
* \param [in] type the geometric type
- * \return the
+ * \return cell ids in this having geometric type \a type.
*/
DataArrayInt *MEDCouplingUMesh::giveCellsWithType(INTERP_KERNEL::NormalizedCellType type) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> v;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New();
+ ret->alloc(0,1);
checkConnectivityFullyDefined();
int nbCells=getNumberOfCells();
int mdim=getMeshDimension();
for(int i=0;i<nbCells;i++)
{
if((INTERP_KERNEL::NormalizedCellType)pt[ptI[i]]==type)
- v.push_back(i);
+ ret->pushBackSilent(i);
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret=DataArrayInt::New(); ret->alloc((int)v.size(),1);
- std::copy(v.begin(),v.end(),ret->getPointer());
return ret.retn();
}
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane considering bounding boxes !");
std::vector<int> nodes;
- std::vector<int> cellIds2D,cellIds1D;
+ DataArrayInt *cellIds1D=0;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1=DataArrayInt::New(),desc2=DataArrayInt::New();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx1=DataArrayInt::New(),revDescIndx2=DataArrayInt::New();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc2=subMesh->buildDescendingConnectivity(desc2,descIndx2,revDesc2,revDescIndx2);//meshDim==2 spaceDim==3
revDesc2=0; revDescIndx2=0;
- mDesc2->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds2D);
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc1=mDesc2->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
revDesc1=0; revDescIndx1=0;
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds1DTmp(cellIds1D);
//
std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(std::vector<int>::const_iterator it=cellIds1D.begin();it!=cellIds1D.end();it++)
+ for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
std::vector< std::pair<int,int> > cut3DSurf(mDesc2->getNumberOfCells());
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,mDesc2->getNodalConnectivity()->getConstPointer(),mDesc2->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- std::vector<int> conn,connI,cellIds2;
- connI.push_back(0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New());
+ connI->pushBackSilent(0);
subMesh->assemblyForSplitFrom3DSurf(cut3DSurf,desc2->getConstPointer(),descIndx2->getConstPointer(),conn,connI,cellIds2);
- if(cellIds2.empty())
+ if(cellIds2->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3D : No 3D cells in this intercepts the specified plane !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3D",2);
ret->setCoords(mDesc1->getCoords());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
- c->alloc((int)conn.size(),1); std::copy(conn.begin(),conn.end(),c->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
- cI->alloc((int)connI.size(),1); std::copy(connI.begin(),connI.end(),cI->getPointer());
- ret->setConnectivity(c,cI,true);
- cellIds=candidates->selectByTupleId(&cellIds2[0],&cellIds2[0]+cellIds2.size());
+ ret->setConnectivity(conn,connI,true);
+ cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end());
return ret.retn();
}
if(candidates->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3D surf cells in this intercepts the specified plane considering bounding boxes !");
std::vector<int> nodes;
- std::vector<int> cellIds1D;
+ DataArrayInt *cellIds1D=0;
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> subMesh=static_cast<MEDCouplingUMesh*>(buildPartOfMySelf(candidates->begin(),candidates->end(),false));
subMesh->findNodesOnPlane(origin,vec,eps,nodes);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> desc1=DataArrayInt::New();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> revDescIndx1=DataArrayInt::New();
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mDesc1=subMesh->buildDescendingConnectivity(desc1,descIndx1,revDesc1,revDescIndx1);//meshDim==1 spaceDim==3
mDesc1->fillCellIdsToKeepFromNodeIds(&nodes[0],&nodes[0]+nodes.size(),true,cellIds1D);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cellIds1DTmp(cellIds1D);
//
std::vector<int> cut3DCurve(mDesc1->getNumberOfCells(),-2);
- for(std::vector<int>::const_iterator it=cellIds1D.begin();it!=cellIds1D.end();it++)
+ for(const int *it=cellIds1D->begin();it!=cellIds1D->end();it++)
cut3DCurve[*it]=-1;
mDesc1->split3DCurveWithPlane(origin,vec,eps,cut3DCurve);
int ncellsSub=subMesh->getNumberOfCells();
AssemblyForSplitFrom3DCurve(cut3DCurve,nodes,subMesh->getNodalConnectivity()->getConstPointer(),subMesh->getNodalConnectivityIndex()->getConstPointer(),
mDesc1->getNodalConnectivity()->getConstPointer(),mDesc1->getNodalConnectivityIndex()->getConstPointer(),
desc1->getConstPointer(),descIndx1->getConstPointer(),cut3DSurf);
- std::vector<int> conn,connI,cellIds2; connI.push_back(0);
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> conn(DataArrayInt::New()),connI(DataArrayInt::New()),cellIds2(DataArrayInt::New()); connI->pushBackSilent(0);
const int *nodal=subMesh->getNodalConnectivity()->getConstPointer();
const int *nodalI=subMesh->getNodalConnectivityIndex()->getConstPointer();
for(int i=0;i<ncellsSub;i++)
{
if(cut3DSurf[i].first!=-2)
{
- conn.push_back((int)INTERP_KERNEL::NORM_SEG2); conn.push_back(cut3DSurf[i].first); conn.push_back(cut3DSurf[i].second);
- connI.push_back((int)conn.size());
- cellIds2.push_back(i);
+ conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(cut3DSurf[i].first); conn->pushBackSilent(cut3DSurf[i].second);
+ connI->pushBackSilent(conn->getNumberOfTuples());
+ cellIds2->pushBackSilent(i);
}
else
{
int nbOfEdges=nodalI[cellId3DSurf+1]-offset;
for(int j=0;j<nbOfEdges;j++)
{
- conn.push_back((int)INTERP_KERNEL::NORM_SEG2); conn.push_back(nodal[offset+j]); conn.push_back(nodal[offset+(j+1)%nbOfEdges]);
- connI.push_back((int)conn.size());
- cellIds2.push_back(cellId3DSurf);
+ conn->pushBackSilent((int)INTERP_KERNEL::NORM_SEG2); conn->pushBackSilent(nodal[offset+j]); conn->pushBackSilent(nodal[offset+(j+1)%nbOfEdges]);
+ connI->pushBackSilent(conn->getNumberOfTuples());
+ cellIds2->pushBackSilent(cellId3DSurf);
}
}
}
}
- if(cellIds2.empty())
+ if(cellIds2->empty())
throw INTERP_KERNEL::Exception("MEDCouplingUMesh::buildSlice3DSurf : No 3DSurf cells in this intercepts the specified plane !");
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> ret=MEDCouplingUMesh::New("Slice3DSurf",1);
ret->setCoords(mDesc1->getCoords());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> c=DataArrayInt::New();
- c->alloc((int)conn.size(),1); std::copy(conn.begin(),conn.end(),c->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cI=DataArrayInt::New();
- cI->alloc((int)connI.size(),1); std::copy(connI.begin(),connI.end(),cI->getPointer());
- ret->setConnectivity(c,cI,true);
- cellIds=candidates->selectByTupleId(&cellIds2[0],&cellIds2[0]+cellIds2.size());
+ ret->setConnectivity(conn,connI,true);
+ cellIds=candidates->selectByTupleId(cellIds2->begin(),cellIds2->end());
return ret.retn();
}
int nbOfCells=getNumberOfCells();
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalConnecIndexOut=DataArrayInt::New();
nodalConnecIndexOut->alloc(nbOfCells+1,1);
- std::vector<int> nodalConnecOut;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalConnecOut(DataArrayInt::New());
int *workIndexOut=nodalConnecIndexOut->getPointer();
*workIndexOut=0;
const int *nodalConnecIn=_nodal_connec->getConstPointer();
const int *nodalConnecIndexIn=_nodal_connec_index->getConstPointer();
std::set<INTERP_KERNEL::NormalizedCellType> types;
- std::vector<int> isChanged;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> isChanged(DataArrayInt::New());
for(int i=0;i<nbOfCells;i++,workIndexOut++)
{
- std::size_t pos=nodalConnecOut.size();
+ int pos=nodalConnecOut->getNumberOfTuples();
if(BuildConvexEnvelopOf2DCellJarvis(coords,nodalConnecIn+nodalConnecIndexIn[i],nodalConnecIn+nodalConnecIndexIn[i+1],nodalConnecOut))
- isChanged.push_back(i);
- types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut[pos]);
- workIndexOut[1]=(int)nodalConnecOut.size();
+ isChanged->pushBackSilent(i);
+ types.insert((INTERP_KERNEL::NormalizedCellType)nodalConnecOut->getIJ(pos,0));
+ workIndexOut[1]=nodalConnecOut->getNumberOfTuples();
}
- if(isChanged.empty())
+ if(isChanged->empty())
return 0;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> nodalConnecOut2=DataArrayInt::New();
- nodalConnecOut2->alloc((int)nodalConnecOut.size(),1);
- std::copy(nodalConnecOut.begin(),nodalConnecOut.end(),nodalConnecOut2->getPointer());
- setConnectivity(nodalConnecOut2,nodalConnecIndexOut,false);
+ setConnectivity(nodalConnecOut,nodalConnecIndexOut,false);
_types=types;
- DataArrayInt *ret=DataArrayInt::New(); ret->alloc((int)isChanged.size(),1);
- std::copy(isChanged.begin(),isChanged.end(),ret->getPointer());
- return ret;
+ return isChanged.retn();
}
/*!
* If some extruded cells does not fulfill the MED norm for extruded cells (first face of 3D cell should be oriented to the exterior of the 3D cell).
* Some viewers are very careful of that (SMESH), but ParaVis ignore that.
*/
-void MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells(std::vector<int>& cells) throw(INTERP_KERNEL::Exception)
+DataArrayInt *MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
{
const char msg[]="check3DCellsWellOriented detection works only for 3D cells !";
if(getMeshDimension()!=3)
const int *connI=_nodal_connec_index->getConstPointer();
const double *coo=getCoords()->getConstPointer();
double vec0[3],vec1[3];
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> cells(DataArrayInt::New());
for(int i=0;i<nbOfCells;i++)
{
const INTERP_KERNEL::CellModel& cm=INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)conn[connI[i]]);
double dot=vec0[0]*vec1[0]+vec0[1]*vec1[1]+vec0[2]*vec1[2];
if(dot<0)
{
- cells.push_back(i);
+ cells->pushBackSilent(i);
std::copy(conn+connI[i]+1,conn+connI[i+1],(int *)tmp);
for(int j=1;j<nbOfNodes;j++)
{
}
}
}
+ return cells.retn();
}
/*!
const int *connI=_nodal_connec_index->getConstPointer();
const double *coords=_coords->getConstPointer();
std::vector<double> addCoo;
- std::vector<int> newConn;
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI=DataArrayInt::New();
+ std::vector<int> newConn;//no direct DataArrayInt because interface with Geometric2D
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> newConnI(DataArrayInt::New());
newConnI->alloc(nbCells+1,1);
int *newConnIPtr=newConnI->getPointer();
*newConnIPtr=0;
std::vector<const MEDCouplingUMesh *> m1ssmSingle;
std::vector< MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> > m1ssmSingleAuto;
int fake=0,rk=0;
- std::vector<int> ret1Data;
- std::vector<int> ret2Data;
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1(DataArrayInt::New()),ret2(DataArrayInt::New());
for(std::vector<const MEDCouplingUMesh *>::const_iterator it=ms2.begin();it!=ms2.end();it++,rk++)
{
if(meshDim!=(*it)->getMeshDimension())
MEDCouplingUMesh *singleCell=static_cast<MEDCouplingUMesh *>((*it2)->buildPartOfMySelf(&fake,&fake+1,true));
m1ssmSingleAuto.push_back(singleCell);
m1ssmSingle.push_back(singleCell);
- ret1Data.push_back((*it2)->getNumberOfCells()); ret2Data.push_back(rk);
+ ret1->pushBackSilent((*it2)->getNumberOfCells()); ret2->pushBackSilent(rk);
}
}
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret1=DataArrayInt::New(); ret1->alloc((int)m1ssmSingle.size(),1); std::copy(ret1Data.begin(),ret1Data.end(),ret1->getPointer());
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret2=DataArrayInt::New(); ret2->alloc((int)m1ssmSingle.size(),1); std::copy(ret2Data.begin(),ret2Data.end(),ret2->getPointer());
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> m1ssmSingle2=MEDCouplingUMesh::MergeUMeshesOnSameCoords(m1ssmSingle);
MEDCouplingAutoRefCountObjectPtr<DataArrayInt> renum=m1ssmSingle2->sortCellsInMEDFileFrmt();
std::vector<const MEDCouplingUMesh *> m1ssmfinal(m1ssm.size());
DataArrayInt *MEDCouplingUMesh::keepCellIdsByType(INTERP_KERNEL::NormalizedCellType type, const int *begin, const int *end) const throw(INTERP_KERNEL::Exception)
{
checkFullyDefined();
- std::vector<int> r;
const int *conn=_nodal_connec->getConstPointer();
const int *connIndex=_nodal_connec_index->getConstPointer();
+ MEDCouplingAutoRefCountObjectPtr<DataArrayInt> ret(DataArrayInt::New()); ret->alloc(0,1);
for(const int *w=begin;w!=end;w++)
if((INTERP_KERNEL::NormalizedCellType)conn[connIndex[*w]]==type)
- r.push_back(*w);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)r.size(),1);
- std::copy(r.begin(),r.end(),ret->getPointer());
- return ret;
+ ret->pushBackSilent(*w);
+ return ret.retn();
}
/*!
* \param [in] coords the coordinates with nb of components exactly equal to 3
* \param [in] begin begin of the nodal connectivity (geometric type included) of a single polyhedron cell
* \param [in] end end of nodal connectivity of a single polyhedron cell (excluded)
- * \param [out] the result is put at the end of the vector without any alteration of the data.
+ * \param [out] res the result is put at the end of the vector without any alteration of the data.
*/
-void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, const int *begin, const int *end, std::vector<int>& res) throw(INTERP_KERNEL::Exception)
+void MEDCouplingUMesh::SimplifyPolyhedronCell(double eps, const DataArrayDouble *coords, const int *begin, const int *end, DataArrayInt *res) throw(INTERP_KERNEL::Exception)
{
int nbFaces=std::count(begin+1,end,-1)+1;
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> v=DataArrayDouble::New(); v->alloc(nbFaces,3);
const int *comm1Ptr=comm1->getConstPointer();
const int *commI1Ptr=commI1->getConstPointer();
int nbOfGrps1=commI1Auto->getNumberOfTuples()-1;
- res.push_back((int)INTERP_KERNEL::NORM_POLYHED);
+ res->pushBackSilent((int)INTERP_KERNEL::NORM_POLYHED);
//
MEDCouplingAutoRefCountObjectPtr<MEDCouplingUMesh> mm=MEDCouplingUMesh::New("",3);
mm->setCoords(const_cast<DataArrayDouble *>(coords)); mm->allocateCells(1); mm->insertNextCell(INTERP_KERNEL::NORM_POLYHED,(int)std::distance(begin+1,end),begin+1);
{
if(commI2Ptr[j+1]-commI2Ptr[j]<=1)
{
- res.insert(res.end(),begin,end);
- res.push_back(-1);
+ res->insertAtTheEnd(begin,end);
+ res->pushBackSilent(-1);
}
else
{
{
int l=0;
for(const int *work=conn4+connI4[k]+1;work!=conn4+connI4[k+1];work++,l++)
- res.push_back(idsNodePtr[*work]);
- res.push_back(-1);
+ res->pushBackSilent(idsNodePtr[*work]);
+ res->pushBackSilent(-1);
}
}
}
}
- res.pop_back();
+ res->popBackSilent();
}
/*!
std::vector< std::vector<int> > intersectEdge2;
BuildIntersectEdges(m1Desc,m2Desc,addCoo,subDiv2,intersectEdge2);
subDiv2.clear(); dd5=0; dd6=0;
- std::vector<int> cr,crI;
- std::vector<int> cNb1,cNb2;
+ std::vector<int> cr,crI; //no DataArrayInt because interface with Geometric2D
+ std::vector<int> cNb1,cNb2; //no DataArrayInt because interface with Geometric2D
BuildIntersecting2DCellsFromEdges(eps,m1,desc1->getConstPointer(),descIndx1->getConstPointer(),intersectEdge1,colinear2,m2,desc2->getConstPointer(),descIndx2->getConstPointer(),intersectEdge2,addCoo,
/* outputs -> */addCoordsQuadratic,cr,crI,cNb1,cNb2);
//
*/
void MEDCouplingUMesh::assemblyForSplitFrom3DSurf(const std::vector< std::pair<int,int> >& cut3DSurf,
const int *desc, const int *descIndx,
- std::vector<int>& nodalRes, std::vector<int>& nodalResIndx, std::vector<int>& cellIds) const throw(INTERP_KERNEL::Exception)
+ DataArrayInt *nodalRes, DataArrayInt *nodalResIndx, DataArrayInt *cellIds) const throw(INTERP_KERNEL::Exception)
{
checkFullyDefined();
if(getMeshDimension()!=3 || getSpaceDimension()!=3)
conn.push_back(end);
if(conn.size()>3)
{
- nodalRes.insert(nodalRes.end(),conn.begin(),conn.end());
- nodalResIndx.push_back((int)nodalRes.size());
- cellIds.push_back(i);
+ nodalRes->insertAtTheEnd(conn.begin(),conn.end());
+ nodalResIndx->pushBackSilent(nodalRes->getNumberOfTuples());
+ cellIds->pushBackSilent(i);
}
}
}
*
* @return false if the input connectivity represents already the convex hull, true if the input cell needs to be reordered.
*/
-bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, std::vector<int>& nodalConnecOut) throw(INTERP_KERNEL::Exception)
+bool MEDCouplingUMesh::BuildConvexEnvelopOf2DCellJarvis(const double *coords, const int *nodalConnBg, const int *nodalConnEnd, DataArrayInt *nodalConnecOut) throw(INTERP_KERNEL::Exception)
{
std::size_t sz=std::distance(nodalConnBg,nodalConnEnd);
if(sz>=4)
std::copy(nodalConnBg+1,nodalConnEnd,it);
if(std::search(tmp3.begin(),tmp3.end(),tmpOut.begin(),tmpOut.end())!=tmp3.end())
{
- nodalConnecOut.insert(nodalConnecOut.end(),nodalConnBg,nodalConnEnd);
+ nodalConnecOut->insertAtTheEnd(nodalConnBg,nodalConnEnd);
return false;
}
if(std::search(tmp3.rbegin(),tmp3.rend(),tmpOut.begin(),tmpOut.end())!=tmp3.rend())
{
- nodalConnecOut.insert(nodalConnecOut.end(),nodalConnBg,nodalConnEnd);
+ nodalConnecOut->insertAtTheEnd(nodalConnBg,nodalConnEnd);
return false;
}
else
{
- nodalConnecOut.push_back((int)INTERP_KERNEL::NORM_POLYGON);
- nodalConnecOut.insert(nodalConnecOut.end(),tmpOut.begin(),tmpOut.end());
+ nodalConnecOut->pushBackSilent((int)INTERP_KERNEL::NORM_POLYGON);
+ nodalConnecOut->insertAtTheEnd(tmpOut.begin(),tmpOut.end());
return true;
}
}
*arrIPtr++=0;
int previousArrI=0;
const int *arrPtr=arr->getConstPointer();
- std::vector<int> arrOut;
+ std::vector<int> arrOut;//no utility to switch to DataArrayInt because copy always needed
for(int i=0;i<nbOfGrps;i++,arrIPtr++)
{
if(*arrIPtr-previousArrI>offsetForRemoval)
%newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField;
%newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType;
%newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords;
+%newobject ParaMEDMEM::MEDCouplingUMesh::findAndCorrectBadOriented3DExtrudedCells;
%newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary;
%newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin;
%newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes;
std::copy(nodes.begin(),nodes.end(),ret->getPointer());
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
+
PyObject *getNodeIdsNearPoint(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
{
double val;
int spaceDim=self->getSpaceDimension();
const char msg[]="Python wrap of MEDCouplingPointSet::getNodeIdsNearPoint : ";
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,1,spaceDim,true);
- std::vector<int> tmp=self->getNodeIdsNearPoint(pos,eps);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)tmp.size(),1);
- std::copy(tmp.begin(),tmp.end(),ret->getPointer());
+ DataArrayInt *ret=self->getNodeIdsNearPoint(pos,eps);
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
PyObject *getNodeIdsNearPoints(PyObject *pt, int nbOfNodes, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
//
double val;
DataArrayDouble *a;
const double *pos=convertObjToPossibleCpp5_Safe(pt,sw,val,a,aa,bb,msg,nbOfNodes,spaceDim,true);
self->getNodeIdsNearPoints(pos,nbOfNodes,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *getNodeIdsNearPoints(PyObject *pt, double eps) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
int spaceDim=self->getSpaceDimension();
void *da=0;
int res1=SWIG_ConvertPtr(pt,&da,SWIGTYPE_p_ParaMEDMEM__DataArrayDouble, 0 | 0 );
self->getNodeIdsNearPoints(da2->getConstPointer(),size,eps,c,cI);
}
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
MEDCouplingFieldDouble *getSkewField() const throw(INTERP_KERNEL::Exception);
DataArrayInt *convexEnvelop2D() throw(INTERP_KERNEL::Exception);
std::string cppRepr() const throw(INTERP_KERNEL::Exception);
+ DataArrayInt *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *Build0DMeshFromCoords(DataArrayDouble *da) throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *MergeUMeshes(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
static MEDCouplingUMesh *MergeUMeshesOnSameCoords(const MEDCouplingUMesh *mesh1, const MEDCouplingUMesh *mesh2) throw(INTERP_KERNEL::Exception);
PyObject *findCommonCells(int compType, int startCellId=0) const throw(INTERP_KERNEL::Exception)
{
- std::vector<int> v0,v1;
+ DataArrayInt *v0=0,*v1=0;
self->findCommonCells(compType,startCellId,v0,v1);
- DataArrayInt *v0a=DataArrayInt::New(),*v1a=DataArrayInt::New();
- v0a->alloc((int)v0.size(),1); std::copy(v0.begin(),v0.end(),v0a->getPointer());
- v1a->alloc((int)v1.size(),1); std::copy(v1.begin(),v1.end(),v1a->getPointer());
PyObject *res = PyList_New(2);
- PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0a),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1a),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,0,SWIG_NewPointerObj(SWIG_as_voidptr(v0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyList_SetItem(res,1,SWIG_NewPointerObj(SWIG_as_voidptr(v1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return res;
}
return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
}
- PyObject *findAndCorrectBadOriented3DExtrudedCells() throw(INTERP_KERNEL::Exception)
- {
- std::vector<int> cells;
- self->findAndCorrectBadOriented3DExtrudedCells(cells);
- DataArrayInt *ret=DataArrayInt::New();
- ret->alloc((int)cells.size(),1);
- std::copy(cells.begin(),cells.end(),ret->getPointer());
- return SWIG_NewPointerObj(SWIG_as_voidptr(ret),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 );
- }
-
PyObject *getFastAveragePlaneOfThis() const throw(INTERP_KERNEL::Exception)
{
double vec[3];
const char msg[]="Python wrap of DataArrayDouble::computeTupleIdsNearTuples : ";
const double *pos=convertObjToPossibleCpp5_Safe2(pt,sw,val,a,aa,bb,msg,nbComp,true,nbTuples);
MEDCouplingAutoRefCountObjectPtr<DataArrayDouble> inpu=DataArrayDouble::New(); inpu->useArray(pos,false,CPP_DEALLOC,nbTuples,nbComp);
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
self->computeTupleIdsNearTuples(inpu,eps,c,cI);
- DataArrayInt *ret0=DataArrayInt::New(),*ret1=DataArrayInt::New();
- ret0->alloc((int)c.size(),1); std::copy(c.begin(),c.end(),ret0->getPointer());
- ret1->alloc((int)cI.size(),1); std::copy(cI.begin(),cI.end(),ret1->getPointer());
PyObject *ret=PyTuple_New(2);
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(ret0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(ret1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
PyObject *computeTupleIdsNearTuples(const DataArrayDouble *other, double eps)
{
- std::vector<int> c,cI;
+ DataArrayInt *c=0,*cI=0;
//
self->computeTupleIdsNearTuples(other,eps,c,cI);
PyObject *ret=PyTuple_New(2);
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d0=DataArrayInt::New();
- MEDCouplingAutoRefCountObjectPtr<DataArrayInt> d1=DataArrayInt::New();
- d0->alloc(c.size(),1);
- d1->alloc(cI.size(),1);
- std::copy(c.begin(),c.end(),d0->getPointer());
- std::copy(cI.begin(),cI.end(),d1->getPointer());
- PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(d0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(d1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
- d0->incrRef();
- d1->incrRef();
+ PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(c),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
+ PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(cI),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 ));
return ret;
}
};