From dc5ca69c9e4f75b73d645b0f0d3b2f212e8b7432 Mon Sep 17 00:00:00 2001 From: ageay Date: Thu, 21 Jun 2012 12:04:45 +0000 Subject: [PATCH] Modification of API of MEDCouplingUMesh::findCellsIdsOnBoundary + implementation findCellIdsLyingOn + debugging findNodesToDuplicate --- src/MEDCoupling/MEDCouplingUMesh.cxx | 132 ++++++++++++------ src/MEDCoupling/MEDCouplingUMesh.hxx | 9 +- src/MEDCoupling_Swig/MEDCoupling.i | 21 ++- src/MEDCoupling_Swig/MEDCouplingBasicsTest.py | 4 +- 4 files changed, 109 insertions(+), 57 deletions(-) diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index a9f16c9fd..1f11a190e 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -589,7 +589,7 @@ void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArr MEDCouplingAutoRefCountObjectPtr revDescIndx=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr meshDM1=buildDescendingConnectivity(desc,descIndx,revDesc,revDescIndx); meshDM1=0; - computeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx); + ComputeNeighborsOfCellsAdv(desc,descIndx,revDesc,revDescIndx,neighbors,neighborsIndx); } /*! @@ -608,17 +608,17 @@ void MEDCouplingUMesh::computeNeighborsOfCells(DataArrayInt *&neighbors, DataArr * parameter allows to select the right part in this array. The number of tuples is equal to the last values in \b neighborsIndx. * \param [out] neighborsIndx is an array of size this->getNumberOfCells()+1 newly allocated and should be dealt by the caller. This arrays allow to use the first output parameter \b neighbors. */ -void MEDCouplingUMesh::computeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descIndx, const DataArrayInt *revDesc, const DataArrayInt *revDescIndx, - DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) const throw(INTERP_KERNEL::Exception) +void MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descIndx, const DataArrayInt *revDesc, const DataArrayInt *revDescIndx, + DataArrayInt *&neighbors, DataArrayInt *&neighborsIndx) throw(INTERP_KERNEL::Exception) { if(!desc || !descIndx || !revDesc || !revDescIndx) - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::computeNeighborsOfCellsAdv some input array is empty !"); + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::ComputeNeighborsOfCellsAdv some input array is empty !"); const int *descPtr=desc->getConstPointer(); const int *descIPtr=descIndx->getConstPointer(); const int *revDescPtr=revDesc->getConstPointer(); const int *revDescIPtr=revDescIndx->getConstPointer(); // - int nbCells=getNumberOfCells(); + int nbCells=descIndx->getNumberOfTuples()-1; MEDCouplingAutoRefCountObjectPtr out0=DataArrayInt::New(); MEDCouplingAutoRefCountObjectPtr out1=DataArrayInt::New(); out1->alloc(nbCells+1,1); int *out1Ptr=out1->getPointer(); @@ -1819,7 +1819,7 @@ MEDCouplingPointSet *MEDCouplingUMesh::buildBoundaryMesh(bool keepCoords) const * A cell is detected to be on boundary if it contains one or more than one face having only one father. * This method makes the assumption that 'this' is fully defined (coords,connectivity). If not an exception will be thrown. */ -DataArrayInt *MEDCouplingUMesh::findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception) +DataArrayInt *MEDCouplingUMesh::findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception) { checkFullyDefined(); DataArrayInt *desc=DataArrayInt::New(); @@ -1852,6 +1852,67 @@ DataArrayInt *MEDCouplingUMesh::findCellsIdsOnBoundary() const throw(INTERP_KERN return ret2; } +/*! + * This method find in \b this cells ids that lie on mesh \b otherDimM1OnSameCoords. + * \b this and \b otherDimM1OnSameCoords have to lie on the same coordinate array pointer. The coherency of that coords array with connectivity + * of \b this and \b otherDimM1OnSameCoords is not important here because this method works only on connectivity. + * this->getMeshDimension() - 1 must be equal to otherDimM1OnSameCoords.getMeshDimension() + * + * s0 is the cells ids set in \b this lying on at least one node in fetched nodes in \b otherDimM1OnSameCoords. + * This method method returns cells ids set s = s1 + s2 where : + * + * - s1 are cells ids in \b this whose dim-1 constituent equals a cell in \b otherDimM1OnSameCoords. + * - s2 are cells ids in \b s0 - \b s1 whose at least two neighbors are in s1. + * + * \throw if \b otherDimM1OnSameCoords is not part of constituent of \b this, or if coordinate pointer of \b this and \b otherDimM1OnSameCoords + * are not same, or if this->getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension() + * + * \param [out] cellIdsRk0 a newly allocated array containing cells ids in \b this containg s0 in above algorithm. + * \param [out] cellIdsRk1 a newly allocated array containing cells ids of s1+s2 \b into \b cellIdsRk0 subset. To get absolute ids of s1+s2 simply invoke + * cellIdsRk1->transformWithIndArr(cellIdsRk0->begin(),cellIdsRk0->end()); + */ +void MEDCouplingUMesh::findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const throw(INTERP_KERNEL::Exception) +{ + if(getCoords()!=otherDimM1OnSameCoords.getCoords()) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : coordinates pointer are not the same ! Use tryToShareSameCoords method !"); + checkConnectivityFullyDefined(); + otherDimM1OnSameCoords.checkConnectivityFullyDefined(); + if(getMeshDimension()-1!=otherDimM1OnSameCoords.getMeshDimension()) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : invalid mesh dimension of input mesh regarding meshdimesion of this !"); + MEDCouplingAutoRefCountObjectPtr fetchedNodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); + MEDCouplingAutoRefCountObjectPtr s0arr=getCellIdsLyingOnNodes(fetchedNodeIds1->begin(),fetchedNodeIds1->end(),false); + MEDCouplingAutoRefCountObjectPtr thisPart=static_cast(buildPartOfMySelf(s0arr->begin(),s0arr->end(),true)); + MEDCouplingAutoRefCountObjectPtr descThisPart=DataArrayInt::New(),descIThisPart=DataArrayInt::New(),revDescThisPart=DataArrayInt::New(),revDescIThisPart=DataArrayInt::New(); + MEDCouplingAutoRefCountObjectPtr thisPartConsti=thisPart->buildDescendingConnectivity(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart); + const int *revDescThisPartPtr=revDescThisPart->getConstPointer(),*revDescIThisPartPtr=revDescIThisPart->getConstPointer(); + DataArrayInt *idsOtherInConsti=0; + bool b=thisPartConsti->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsOtherInConsti); + MEDCouplingAutoRefCountObjectPtr idsOtherInConstiAuto(idsOtherInConsti); + if(!b) + throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findCellIdsLyingOn : the given mdim-1 mesh in other is not a constituent of this !"); + std::set s1; + for(const int *idOther=idsOtherInConsti->begin();idOther!=idsOtherInConsti->end();idOther++) + s1.insert(revDescThisPartPtr+revDescIThisPartPtr[*idOther],revDescThisPartPtr+revDescIThisPartPtr[*idOther+1]); + MEDCouplingAutoRefCountObjectPtr s1arr_renum1=DataArrayInt::New(); s1arr_renum1->alloc((int)s1.size(),1); std::copy(s1.begin(),s1.end(),s1arr_renum1->getPointer()); + MEDCouplingAutoRefCountObjectPtr s1Comparr_renum1=s1arr_renum1->buildComplement(s0arr->getNumberOfTuples()); + DataArrayInt *neighThisPart=0,*neighIThisPart=0; + ComputeNeighborsOfCellsAdv(descThisPart,descIThisPart,revDescThisPart,revDescIThisPart,neighThisPart,neighIThisPart); + MEDCouplingAutoRefCountObjectPtr neighThisPartAuto(neighThisPart),neighIThisPartAuto(neighIThisPart); + ExtractFromIndexedArrays(s1Comparr_renum1->begin(),s1Comparr_renum1->end(),neighThisPart,neighIThisPart,neighThisPart,neighIThisPart);// reuse of neighThisPart and neighIThisPart + neighThisPartAuto=neighThisPart; neighIThisPartAuto=neighIThisPart; + RemoveIdsFromIndexedArrays(s1Comparr_renum1->begin(),s1Comparr_renum1->end(),neighThisPart,neighIThisPart); + neighThisPartAuto=0; + MEDCouplingAutoRefCountObjectPtr s2_tmp=neighIThisPart->deltaShiftIndex(); + const int li[2]={0,1}; + MEDCouplingAutoRefCountObjectPtr s2_renum2=s2_tmp->getIdsNotEqualList(li,li+2); + s2_renum2->transformWithIndArr(s1Comparr_renum1->begin(),s1Comparr_renum1->end());//s2_renum2==s2_renum1 + MEDCouplingAutoRefCountObjectPtr s_renum1=DataArrayInt::Aggregate(s2_renum2,s1arr_renum1,0); + s_renum1->sort(); + // + s0arr->incrRef(); cellIdsRk0=s0arr; + s_renum1->incrRef(); cellIdsRk1=s_renum1; +} + /*! * This method computes the skin of \b this. That is to say the consituting meshdim-1 mesh is built and only the boundary subpart is * returned. This subpart of meshdim-1 mesh is built using meshdim-1 cells in it shared only one cell in \b this. @@ -1934,7 +1995,7 @@ void MEDCouplingUMesh::renumberNodes2(const int *newNodeNumbers, int newNbOfNode * * \warning This method modifies param \b otherDimM1OnSameCoords (for speed reasons). */ -void MEDCouplingUMesh::findNodesToDuplicate(MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, DataArrayInt *& cellIdsNeededToBeRenum) const throw(INTERP_KERNEL::Exception) +void MEDCouplingUMesh::findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, DataArrayInt *& cellIdsNeededToBeRenum) const throw(INTERP_KERNEL::Exception) { checkFullyDefined(); otherDimM1OnSameCoords.checkFullyDefined(); @@ -1942,56 +2003,35 @@ void MEDCouplingUMesh::findNodesToDuplicate(MEDCouplingUMesh& otherDimM1OnSameCo throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate : meshes do not share the same coords array !"); if(otherDimM1OnSameCoords.getMeshDimension()!=getMeshDimension()-1) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate : the mesh given in other parameter must have this->getMeshDimension()-1 !"); - MEDCouplingAutoRefCountObjectPtr nodeIds1=otherDimM1OnSameCoords.computeFetchedNodeIds(); + DataArrayInt *cellIdsRk0=0,*cellIdsRk1=0; + findCellIdsLyingOn(otherDimM1OnSameCoords,cellIdsRk0,cellIdsRk1); + MEDCouplingAutoRefCountObjectPtr cellIdsRk0Auto(cellIdsRk0),cellIdsRk1Auto(cellIdsRk1); + MEDCouplingAutoRefCountObjectPtr s0=cellIdsRk1->buildComplement(cellIdsRk0->getNumberOfTuples()); + s0->transformWithIndArr(cellIdsRk0Auto->begin(),cellIdsRk0Auto->end()); + MEDCouplingAutoRefCountObjectPtr m0Part=static_cast(buildPartOfMySelf(s0->begin(),s0->end(),true)); + MEDCouplingAutoRefCountObjectPtr s1=m0Part->computeFetchedNodeIds(); + MEDCouplingAutoRefCountObjectPtr s2=otherDimM1OnSameCoords.computeFetchedNodeIds(); + MEDCouplingAutoRefCountObjectPtr s3=s2->buildSubstraction(s1); + cellIdsRk1->transformWithIndArr(cellIdsRk0Auto->begin(),cellIdsRk0Auto->end()); // - MEDCouplingAutoRefCountObjectPtr cellIds0=getCellIdsLyingOnNodes(nodeIds1->begin(),nodeIds1->end(),false); - MEDCouplingAutoRefCountObjectPtr m0Part=static_cast(buildPartOfMySelf(cellIds0->begin(),cellIds0->end(),true)); - MEDCouplingAutoRefCountObjectPtr boundary0=m0Part->findBoundaryNodes(); - MEDCouplingAutoRefCountObjectPtr boundary1=otherDimM1OnSameCoords.findBoundaryNodes(); - MEDCouplingAutoRefCountObjectPtr diff=boundary1->buildSubstraction(boundary0); - MEDCouplingAutoRefCountObjectPtr nodeIdsToDuplicateTmp=nodeIds1->buildSubstraction(diff);//ready to go to nodeIdsToDuplicate - MEDCouplingAutoRefCountObjectPtr m00t=m0Part->zipCoordsTraducer(); - MEDCouplingAutoRefCountObjectPtr nodeIdsToDuplicate2=nodeIdsToDuplicateTmp->deepCpy(); - nodeIdsToDuplicate2->transformWithIndArr(m00t->begin(),m00t->end()); - MEDCouplingAutoRefCountObjectPtr revNod00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revNodI00=DataArrayInt::New(); - m0Part->getReverseNodalConnectivity(revNod00,revNodI00); - MEDCouplingAutoRefCountObjectPtr desc00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr descI00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDesc00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr revDescI00=DataArrayInt::New(); - MEDCouplingAutoRefCountObjectPtr m01=m0Part->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); - otherDimM1OnSameCoords.renumberNodesInConn(m00t->begin()); - otherDimM1OnSameCoords.setCoords(m0Part->getCoords()); + MEDCouplingAutoRefCountObjectPtr m0Part2=static_cast(buildPartOfMySelf(cellIdsRk1->begin(),cellIdsRk1->end(),true)); + MEDCouplingAutoRefCountObjectPtr desc00=DataArrayInt::New(),descI00=DataArrayInt::New(),revDesc00=DataArrayInt::New(),revDescI00=DataArrayInt::New(); + MEDCouplingAutoRefCountObjectPtr m01=m0Part2->buildDescendingConnectivity(desc00,descI00,revDesc00,revDescI00); DataArrayInt *idsTmp=0; - bool b=m01->areCellsIncludedIn(&otherDimM1OnSameCoords,0,idsTmp); + bool b=m01->areCellsIncludedIn(&otherDimM1OnSameCoords,2,idsTmp); MEDCouplingAutoRefCountObjectPtr ids(idsTmp); if(!b) throw INTERP_KERNEL::Exception("MEDCouplingUMesh::findNodesToDuplicate : the given mdim-1 mesh in other is not a constituent of this !"); MEDCouplingUMesh::RemoveIdsFromIndexedArrays(ids->begin(),ids->end(),desc00,descI00); DataArrayInt *tmp0=0,*tmp1=0; - m0Part->computeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00,tmp0,tmp1); + ComputeNeighborsOfCellsAdv(desc00,descI00,revDesc00,revDescI00,tmp0,tmp1); MEDCouplingAutoRefCountObjectPtr neigh00(tmp0); MEDCouplingAutoRefCountObjectPtr neighI00(tmp1); - std::set cellIdsImpacted0; - const int *revNod00Ptr=revNod00->getConstPointer(); - const int *revNodI00Ptr=revNodI00->getConstPointer(); - for(const int *elt=nodeIdsToDuplicate2->begin();elt!=nodeIdsToDuplicate2->end();elt++) - for(const int *elt2=revNod00Ptr+revNodI00Ptr[*elt];elt2!=revNod00Ptr+revNodI00Ptr[*elt+1];elt2++) - cellIdsImpacted0.insert(*elt2); - MEDCouplingAutoRefCountObjectPtr cellIdsImpacted0_arr=DataArrayInt::New(); cellIdsImpacted0_arr->alloc((int)cellIdsImpacted0.size(),1); - std::copy(cellIdsImpacted0.begin(),cellIdsImpacted0.end(),cellIdsImpacted0_arr->getPointer()); - MEDCouplingUMesh::ExtractFromIndexedArrays(cellIdsImpacted0_arr->begin(),cellIdsImpacted0_arr->end(),neigh00,neighI00,tmp0,tmp1); - MEDCouplingAutoRefCountObjectPtr cellIdsImpacted0_arr2=cellIdsImpacted0_arr->invertArrayN2O2O2N(cellIds0->getNumberOfTuples()); - MEDCouplingAutoRefCountObjectPtr neigh000(tmp0); - MEDCouplingAutoRefCountObjectPtr neighI000(tmp1); - neigh000->transformWithIndArr(cellIdsImpacted0_arr2->begin(),cellIdsImpacted0_arr2->end()); - MEDCouplingAutoRefCountObjectPtr cellsToModifyConn0_torenum=MEDCouplingUMesh::ComputeSpreadZoneGradually(neigh000,neighI000); - cellsToModifyConn0_torenum->transformWithIndArr(cellIdsImpacted0_arr->begin(),cellIdsImpacted0_arr->end()); - cellsToModifyConn0_torenum->transformWithIndArr(cellIds0->begin(),cellIds0->end()); + MEDCouplingAutoRefCountObjectPtr cellsToModifyConn0_torenum=MEDCouplingUMesh::ComputeSpreadZoneGradually(neigh00,neighI00); + cellsToModifyConn0_torenum->transformWithIndArr(cellIdsRk1->begin(),cellIdsRk1->end()); // cellIdsNeededToBeRenum=cellsToModifyConn0_torenum; cellsToModifyConn0_torenum->incrRef(); - nodeIdsToDuplicate=nodeIdsToDuplicateTmp; nodeIdsToDuplicateTmp->incrRef(); + nodeIdsToDuplicate=s3; s3->incrRef(); } /*! diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index a1c29e412..924fa49f1 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -112,8 +112,8 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT MEDCouplingUMesh *buildDescendingConnectivity2(DataArrayInt *desc, DataArrayInt *descIndx, DataArrayInt *revDesc, DataArrayInt *revDescIndx) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void computeNeighborsOfCells(DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const throw(INTERP_KERNEL::Exception); - MEDCOUPLING_EXPORT void computeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI, - DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT static void ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI, + DataArrayInt *&neighbors, DataArrayInt *&neighborsIdx) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayInt *mergeNodes(double precision, bool& areNodesMerged, int& newNbOfNodes); MEDCOUPLING_EXPORT DataArrayInt *mergeNodes2(double precision, bool& areNodesMerged, int& newNbOfNodes); MEDCOUPLING_EXPORT void tryToShareSameCoordsPermute(const MEDCouplingPointSet& other, double epsilon) throw(INTERP_KERNEL::Exception); @@ -125,11 +125,12 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT MEDCouplingUMesh *buildUnstructured() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT DataArrayInt *findBoundaryNodes() const; MEDCOUPLING_EXPORT MEDCouplingPointSet *buildBoundaryMesh(bool keepCoords) const; - MEDCOUPLING_EXPORT DataArrayInt *findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT void findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *&cellIdsRk0, DataArrayInt *&cellIdsRk1) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void renumberNodes(const int *newNodeNumbers, int newNbOfNodes); MEDCOUPLING_EXPORT void renumberNodes2(const int *newNodeNumbers, int newNbOfNodes); - MEDCOUPLING_EXPORT void findNodesToDuplicate(MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, DataArrayInt *& cellIdsNeededToBeRenum) const throw(INTERP_KERNEL::Exception); + MEDCOUPLING_EXPORT void findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords, DataArrayInt *& nodeIdsToDuplicate, DataArrayInt *& cellIdsNeededToBeRenum) const throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void duplicateNodes(const int *nodeIdsToDuplicateBg, const int *nodeIdsToDuplicateEnd) throw(INTERP_KERNEL::Exception); MEDCOUPLING_EXPORT void renumberNodesInConn(const int *newNodeNumbersO2N); MEDCOUPLING_EXPORT void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception); diff --git a/src/MEDCoupling_Swig/MEDCoupling.i b/src/MEDCoupling_Swig/MEDCoupling.i index eea855148..89dddec43 100644 --- a/src/MEDCoupling_Swig/MEDCoupling.i +++ b/src/MEDCoupling_Swig/MEDCoupling.i @@ -138,6 +138,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::DataArrayInt::getIdsEqualList; %newobject ParaMEDMEM::DataArrayInt::getIdsNotEqualList; %newobject ParaMEDMEM::DataArrayInt::negate; +%newobject ParaMEDMEM::DataArrayInt::getIdsInRange; %newobject ParaMEDMEM::DataArrayInt::Aggregate; %newobject ParaMEDMEM::DataArrayInt::Meld; %newobject ParaMEDMEM::DataArrayInt::Add; @@ -273,7 +274,7 @@ using namespace INTERP_KERNEL; %newobject ParaMEDMEM::MEDCouplingUMesh::buildPartOrthogonalField; %newobject ParaMEDMEM::MEDCouplingUMesh::keepCellIdsByType; %newobject ParaMEDMEM::MEDCouplingUMesh::Build0DMeshFromCoords; -%newobject ParaMEDMEM::MEDCouplingUMesh::findCellsIdsOnBoundary; +%newobject ParaMEDMEM::MEDCouplingUMesh::findCellIdsOnBoundary; %newobject ParaMEDMEM::MEDCouplingUMesh::computeSkin; %newobject ParaMEDMEM::MEDCouplingUMesh::getCellIdsLyingOnNodes; %newobject ParaMEDMEM::MEDCouplingUMesh::buildSetInstanceFromThis; @@ -1083,7 +1084,7 @@ namespace ParaMEDMEM //tools void shiftNodeNumbersInConn(int delta) throw(INTERP_KERNEL::Exception); std::vector getQuadraticStatus() const throw(INTERP_KERNEL::Exception); - DataArrayInt *findCellsIdsOnBoundary() const throw(INTERP_KERNEL::Exception); + DataArrayInt *findCellIdsOnBoundary() const throw(INTERP_KERNEL::Exception); MEDCouplingUMesh *computeSkin() const throw(INTERP_KERNEL::Exception); bool checkConsecutiveCellTypes() const throw(INTERP_KERNEL::Exception); DataArrayInt *rearrange2ConsecutiveCellTypes() throw(INTERP_KERNEL::Exception); @@ -1361,7 +1362,7 @@ namespace ParaMEDMEM return ret; } - PyObject *findNodesToDuplicate(MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception) + PyObject *findNodesToDuplicate(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception) { DataArrayInt *tmp0=0,*tmp1=0; self->findNodesToDuplicate(otherDimM1OnSameCoords,tmp0,tmp1); @@ -1371,6 +1372,16 @@ namespace ParaMEDMEM return ret; } + PyObject *findCellIdsLyingOn(const MEDCouplingUMesh& otherDimM1OnSameCoords) const throw(INTERP_KERNEL::Exception) + { + DataArrayInt *tmp0=0,*tmp1=0; + self->findCellIdsLyingOn(otherDimM1OnSameCoords,tmp0,tmp1); + PyObject *ret=PyTuple_New(2); + PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(tmp0),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(tmp1),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); + return ret; + } + void duplicateNodes(PyObject *li) throw(INTERP_KERNEL::Exception) { int sw; @@ -1760,10 +1771,10 @@ namespace ParaMEDMEM return ret; } - PyObject *computeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) const throw(INTERP_KERNEL::Exception) + static PyObject *ComputeNeighborsOfCellsAdv(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *revDesc, const DataArrayInt *revDescI) throw(INTERP_KERNEL::Exception) { DataArrayInt *neighbors=0,*neighborsIdx=0; - self->computeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx); + MEDCouplingUMesh::ComputeNeighborsOfCellsAdv(desc,descI,revDesc,revDescI,neighbors,neighborsIdx); PyObject *ret=PyTuple_New(2); PyTuple_SetItem(ret,0,SWIG_NewPointerObj(SWIG_as_voidptr(neighbors),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); PyTuple_SetItem(ret,1,SWIG_NewPointerObj(SWIG_as_voidptr(neighborsIdx),SWIGTYPE_p_ParaMEDMEM__DataArrayInt, SWIG_POINTER_OWN | 0 )); diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index b0e4bd756..a84663fff 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -6753,9 +6753,9 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertEqual(4,da.getIJ(1,0)); pass - def testUMeshFindCellsIdsOnBoundary1(self): + def testUMeshFindCellIdsOnBoundary1(self): m=MEDCouplingDataForTest.build3DSurfTargetMesh_1(); - da5=m.findCellsIdsOnBoundary(); + da5=m.findCellIdsOnBoundary(); self.assertEqual(5,da5.getNumberOfTuples()); self.assertTrue(da5.isIdentity()); pass -- 2.39.2