From: Anthony Geay Date: Tue, 16 Dec 2014 14:40:22 +0000 (+0100) Subject: OK test 0->12. X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=c3a605a745234160b2019578e0b9b777ff63dcba;p=tools%2Fmedcoupling.git OK test 0->12. --- diff --git a/src/INTERP_KERNEL/CellModel.cxx b/src/INTERP_KERNEL/CellModel.cxx index 5a22ab1c4..2bdfb826b 100644 --- a/src/INTERP_KERNEL/CellModel.cxx +++ b/src/INTERP_KERNEL/CellModel.cxx @@ -591,6 +591,52 @@ namespace INTERP_KERNEL throw INTERP_KERNEL::Exception("CellModel::fillSonEdgesNodalConnectivity3D : not implemented yet for NORM_POLYHED !"); } + void CellModel::changeOrientationOf2D(int *nodalConn, unsigned int sz) const + { + if(sz<1) + return ; + if(!isQuadratic()) + { + std::vector tmp(sz-1); + std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); + std::copy(tmp.begin(),tmp.end(),nodalConn+1); + } + else + { + unsigned int sz2(sz/2); + std::vector tmp0(sz2-1),tmp1(sz2); + std::copy(nodalConn+1,nodalConn+sz2,tmp0.rbegin()); + std::copy(nodalConn+sz2,nodalConn+sz,tmp1.rbegin()); + std::copy(tmp0.begin(),tmp0.end(),nodalConn+1); + std::copy(tmp1.begin(),tmp1.end(),nodalConn+sz2); + } + } + + void CellModel::changeOrientationOf1D(int *nodalConn, unsigned int sz) const + { + if(!isDynamic()) + { + if(sz==2 || sz==3) + { + std::swap(nodalConn[0],nodalConn[1]); + return ; + } + else if(sz==4) + { + std::swap(nodalConn[0],nodalConn[1]); + std::swap(nodalConn[2],nodalConn[3]); + } + else + throw Exception("CellModel::changeOrientationOf1D : unrecognized 1D cell type !"); + } + else + { + std::vector tmp(sz-1); + std::copy(nodalConn+1,nodalConn+sz,tmp.rbegin()); + std::copy(tmp.begin(),tmp.end(),nodalConn+1); + } + } + //================================================================================ /*! * \brief Return number of nodes in sonId-th son of a Dynamic() cell diff --git a/src/INTERP_KERNEL/CellModel.hxx b/src/INTERP_KERNEL/CellModel.hxx index 32974d57c..ab49dcf99 100644 --- a/src/INTERP_KERNEL/CellModel.hxx +++ b/src/INTERP_KERNEL/CellModel.hxx @@ -72,6 +72,8 @@ namespace INTERP_KERNEL INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity2(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; INTERPKERNEL_EXPORT unsigned fillSonCellNodalConnectivity4(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; INTERPKERNEL_EXPORT unsigned fillSonEdgesNodalConnectivity3D(int sonId, const int *nodalConn, int lgth, int *sonNodalConn, NormalizedCellType& typeOfSon) const; + INTERPKERNEL_EXPORT void changeOrientationOf2D(int *nodalConn, unsigned int sz) const; + INTERPKERNEL_EXPORT void changeOrientationOf1D(int *nodalConn, unsigned int sz) const; private: bool _dyn; bool _quadratic; diff --git a/src/MEDCoupling/MEDCouplingMemArray.cxx b/src/MEDCoupling/MEDCouplingMemArray.cxx index d3f460529..eca5fe45b 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.cxx +++ b/src/MEDCoupling/MEDCouplingMemArray.cxx @@ -6345,7 +6345,7 @@ void DataArrayInt::reprQuickOverviewData(std::ostream& stream, std::size_t maxNb } /*! - * Modifies \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ], + * Modifies in place \a this one-dimensional array so that each value \a v = \a indArrBg[ \a v ], * i.e. a current value is used as in index to get a new value from \a indArrBg. * \param [in] indArrBg - pointer to the first element of array of new values to assign * to \a this array. @@ -6354,15 +6354,15 @@ void DataArrayInt::reprQuickOverviewData(std::ostream& stream, std::size_t maxNb * \throw If \a this->getNumberOfComponents() != 1 * \throw If any value of \a this can't be used as a valid index for * [\a indArrBg, \a indArrEnd). + * + * \sa replaceOneValByInThis */ void DataArrayInt::transformWithIndArr(const int *indArrBg, const int *indArrEnd) { checkAllocated(); if(getNumberOfComponents()!=1) throw INTERP_KERNEL::Exception("Call transformWithIndArr method on DataArrayInt with only one component, you can call 'rearrange' method before !"); - int nbElemsIn=(int)std::distance(indArrBg,indArrEnd); - int nbOfTuples=getNumberOfTuples(); - int *pt=getPointer(); + int nbElemsIn((int)std::distance(indArrBg,indArrEnd)),nbOfTuples(getNumberOfTuples()),*pt(getPointer()); for(int i=0;i=0 && *pt ret(DataArrayInt::New()); ret->alloc(0,1); + int nbOfTuples(getNumberOfTuples()); + for(int i=0;ipushBackSilent(i); + return ret.retn(); +} + /*! * This method works only on data array with one component. * This method checks that all ids in \b this are in [ \b vmin, \b vmax ). If there is at least one element in \a this not in [ \b vmin, \b vmax ) an exception will be thrown. diff --git a/src/MEDCoupling/MEDCouplingMemArray.hxx b/src/MEDCoupling/MEDCouplingMemArray.hxx index 8c25de2fb..a5b1a3101 100644 --- a/src/MEDCoupling/MEDCouplingMemArray.hxx +++ b/src/MEDCoupling/MEDCouplingMemArray.hxx @@ -476,6 +476,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void reprQuickOverview(std::ostream& stream) const; MEDCOUPLING_EXPORT void reprQuickOverviewData(std::ostream& stream, std::size_t maxNbOfByteInRepr) const; MEDCOUPLING_EXPORT void transformWithIndArr(const int *indArrBg, const int *indArrEnd); + MEDCOUPLING_EXPORT void replaceOneValByInThis(int valToBeReplaced, int replacedBy); MEDCOUPLING_EXPORT DataArrayInt *transformWithIndArrR(const int *indArrBg, const int *indArrEnd) const; MEDCOUPLING_EXPORT void splitByValueRange(const int *arrBg, const int *arrEnd, DataArrayInt *& castArr, DataArrayInt *& rankInsideCast, DataArrayInt *& castsPresent) const; @@ -568,6 +569,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void applyRPow(int val); MEDCOUPLING_EXPORT DataArrayInt *getIdsInRange(int vmin, int vmax) const; MEDCOUPLING_EXPORT DataArrayInt *getIdsNotInRange(int vmin, int vmax) const; + MEDCOUPLING_EXPORT DataArrayInt *getIdsStrictlyNegative() const; MEDCOUPLING_EXPORT bool checkAllIdsInRange(int vmin, int vmax) const; MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2); MEDCOUPLING_EXPORT static DataArrayInt *Aggregate(const std::vector& arr); diff --git a/src/MEDCoupling/MEDCouplingUMesh.cxx b/src/MEDCoupling/MEDCouplingUMesh.cxx index 367ec010d..8cbb5ab4a 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.cxx +++ b/src/MEDCoupling/MEDCouplingUMesh.cxx @@ -5978,40 +5978,28 @@ void MEDCouplingUMesh::are2DCellsNotCorrectlyOriented(const double *vec, bool po * \ref cpp_mcumesh_are2DCellsNotCorrectlyOriented "Here is a C++ example".
* \ref py_mcumesh_are2DCellsNotCorrectlyOriented "Here is a Python example". * \endif + * + * \sa changeOrientationOfCells */ void MEDCouplingUMesh::orientCorrectly2DCells(const double *vec, bool polyOnly) { if(getMeshDimension()!=2 || getSpaceDimension()!=3) throw INTERP_KERNEL::Exception("Invalid mesh to apply orientCorrectly2DCells on it : must be meshDim==2 and spaceDim==3 !"); - int nbOfCells=getNumberOfCells(); - int *conn=_nodal_connec->getPointer(); - const int *connI=_nodal_connec_index->getConstPointer(); - const double *coordsPtr=_coords->getConstPointer(); - bool isModified=false; + int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer()); + const int *connI(_nodal_connec_index->getConstPointer()); + const double *coordsPtr(_coords->getConstPointer()); + bool isModified(false); for(int i=0;i tmp(connI[i+1]-connI[i]-2); - std::copy(conn+connI[i]+2,conn+connI[i+1],tmp.rbegin()); - std::copy(tmp.begin(),tmp.end(),conn+connI[i]+2); - } - else - { - int sz(((int)(connI[i+1]-connI[i]-1))/2); - std::vector tmp0(sz-1),tmp1(sz); - std::copy(conn+connI[i]+2,conn+connI[i]+1+sz,tmp0.rbegin()); - std::copy(conn+connI[i]+1+sz,conn+connI[i+1],tmp1.rbegin()); - std::copy(tmp0.begin(),tmp0.end(),conn+connI[i]+2); - std::copy(tmp1.begin(),tmp1.end(),conn+connI[i]+1+sz); - } + cm.changeOrientationOf2D(conn+connI[i]+1,(unsigned int)(connI[i+1]-connI[i]-1)); } } } @@ -6020,6 +6008,38 @@ void MEDCouplingUMesh::orientCorrectly2DCells(const double *vec, bool polyOnly) updateTime(); } +/*! + * This method change the orientation of cells in \a this without any consideration of coordinates. Only connectivity is impacted. + * + * \sa orientCorrectly2DCells + */ +void MEDCouplingUMesh::changeOrientationOfCells() +{ + int mdim(getMeshDimension()); + if(mdim!=2 && mdim!=1) + throw INTERP_KERNEL::Exception("Invalid mesh to apply changeOrientationOfCells on it : must be meshDim==2 or meshDim==1 !"); + int nbOfCells(getNumberOfCells()),*conn(_nodal_connec->getPointer()); + const int *connI(_nodal_connec_index->getConstPointer()); + if(mdim==2) + {//2D + for(int i=0;igetCoords()->begin()); + if(std::distance(candidatesIn2DBg,candidatesIn2DEnd)==1) + return *candidatesIn2DBg; + int edgeId(std::abs(cellIdInMesh1DSplitRelative)-1); + MEDCouplingAutoRefCountObjectPtr cur1D(static_cast(mesh1DSplit->buildPartOfMySelf(&edgeId,&edgeId+1,true))); + if(cellIdInMesh1DSplitRelative<0) + cur1D->changeOrientationOfCells(); + const int *c1D(cur1D->getNodalConnectivity()->begin()); + const INTERP_KERNEL::CellModel& ref1DType(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c1D[0])); + for(const int *it=candidatesIn2DBg;it!=candidatesIn2DEnd;it++) + { + MEDCouplingAutoRefCountObjectPtr cur2D(static_cast(mesh2DSplit->buildPartOfMySelf(it,it+1,true))); + const int *c(cur2D->getNodalConnectivity()->begin()),*ci(cur2D->getNodalConnectivityIndex()->begin()); + const INTERP_KERNEL::CellModel &cm(INTERP_KERNEL::CellModel::GetCellModel((INTERP_KERNEL::NormalizedCellType)c[ci[0]])); + unsigned sz(cm.getNumberOfSons2(c+ci[0]+1,ci[1]-ci[0]-1)); + INTERP_KERNEL::AutoPtr tmpPtr(new int[ci[1]-ci[0]]); + for(unsigned it2=0;it2 ret2(DataArrayInt::New()); ret2->alloc(0,1); MEDCouplingAutoRefCountObjectPtr ret1(BuildMesh1DCutFrom(mesh1D,intersectEdge2,mesh2D->getCoords(),addCoo,mergedNodes,colinear2,intersectEdge1, idsInRet1Colinear,idsInDescMesh2DForIdsInRetColinear)); - MEDCouplingAutoRefCountObjectPtr ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(-1); ret3->rearrange(2); + MEDCouplingAutoRefCountObjectPtr ret3(DataArrayInt::New()); ret3->alloc(ret1->getNumberOfCells()*2,1); ret3->fillWithValue(std::numeric_limits::max()); ret3->rearrange(2); MEDCouplingAutoRefCountObjectPtr idsInRet1NotColinear(idsInRet1Colinear->buildComplement(ret1->getNumberOfCells())); // deal with cells in mesh2D that are not cut but only some of their edges are MEDCouplingAutoRefCountObjectPtr idsInDesc2DToBeRefined(idsInDescMesh2DForIdsInRetColinear->deepCpy()); @@ -9522,7 +9612,7 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, int offset(ret2->getNumberOfTuples()); ret2->pushBackValsSilent(fewModifiedCells->begin(),fewModifiedCells->end()); MEDCouplingAutoRefCountObjectPtr partOfRet3(DataArrayInt::New()); partOfRet3->alloc(2*idsInRet1Colinear->getNumberOfTuples(),1); - partOfRet3->fillWithValue(-1); partOfRet3->rearrange(2); + partOfRet3->fillWithValue(std::numeric_limits::max()); partOfRet3->rearrange(2); int kk(0),*ret3ptr(partOfRet3->getPointer()); for(const int *it=idsInDescMesh2DForIdsInRetColinear->begin();it!=idsInDescMesh2DForIdsInRetColinear->end();it++,kk++) { @@ -9538,7 +9628,12 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, ret3ptr[2*kk+1]=tmp+offset; } else - throw INTERP_KERNEL::Exception("MEDCouplingUMesh::Intersect2DMeshWith1DLine : internal error 1 !"); + {//the current edge is shared by a 2D cell that will be split just after + if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],-(*it))!=dptr+diptr[*it2+1]) + ret3ptr[2*kk]=-(*it2+1); + if(std::find(dptr+diptr[*it2],dptr+diptr[*it2+1],(*it))!=dptr+diptr[*it2+1]) + ret3ptr[2*kk+1]=-(*it2+1); + } } } ret3->setPartOfValues3(partOfRet3,idsInRet1Colinear->begin(),idsInRet1Colinear->end(),0,2,1,true); @@ -9563,9 +9658,21 @@ void MEDCouplingUMesh::Intersect2DMeshWith1DLine(const MEDCouplingUMesh *mesh2D, tmp[i]=outMesh2DSplit[i]; // ret1->getCoords()->setInfoOnComponents(compNames); + MEDCouplingAutoRefCountObjectPtr ret2D(MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp)); + // To finish - filter ret3 - std::numeric_limits::max() -> -1 - negate values must be resolved. + ret3->rearrange(1); + MEDCouplingAutoRefCountObjectPtr edgesToDealWith(ret3->getIdsStrictlyNegative()); + for(const int *it=edgesToDealWith->begin();it!=edgesToDealWith->end();it++) + { + int old2DCellId(-ret3->getIJ(*it,0)-1); + MEDCouplingAutoRefCountObjectPtr candidates(ret2->getIdsEqual(old2DCellId)); + ret3->setIJ(*it,0,FindRightCandidateAmong(ret2D,candidates->begin(),candidates->end(),ret1,*it%2==0?-((*it)/2+1):(*it)/2+1,eps));// div by 2 because 2 components natively in ret3 + } + ret3->replaceOneValByInThis(std::numeric_limits::max(),-1); + ret3->rearrange(2); // splitMesh1D=ret1.retn(); - splitMesh2D=MEDCouplingUMesh::MergeUMeshesOnSameCoords(tmp); + splitMesh2D=ret2D.retn(); cellIdInMesh2D=ret2.retn(); cellIdInMesh1D=ret3.retn(); } diff --git a/src/MEDCoupling/MEDCouplingUMesh.hxx b/src/MEDCoupling/MEDCouplingUMesh.hxx index e1b2c93d7..202f0f334 100644 --- a/src/MEDCoupling/MEDCouplingUMesh.hxx +++ b/src/MEDCoupling/MEDCouplingUMesh.hxx @@ -185,6 +185,7 @@ namespace ParaMEDMEM MEDCOUPLING_EXPORT void convertDegeneratedCells(); MEDCOUPLING_EXPORT void are2DCellsNotCorrectlyOriented(const double *vec, bool polyOnly, std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectly2DCells(const double *vec, bool polyOnly); + MEDCOUPLING_EXPORT void changeOrientationOfCells(); MEDCOUPLING_EXPORT void arePolyhedronsNotCorrectlyOriented(std::vector& cells) const; MEDCOUPLING_EXPORT void orientCorrectlyPolyhedrons(); MEDCOUPLING_EXPORT void getFastAveragePlaneOfThis(double *vec, double *pos) const; diff --git a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py index bda97d201..1305e7675 100644 --- a/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py +++ b/src/MEDCoupling_Swig/MEDCouplingBasicsTest.py @@ -25,7 +25,7 @@ from datetime import datetime from MEDCouplingDataForTest import MEDCouplingDataForTest import rlcompleter,readline # this line has to be here, to ensure a usability of MEDCoupling/MEDLoader. B4 removing it please notify to anthony.geay@cea.fr -class MEDCouplingBasicsTest: +class MEDCouplingBasicsTest(unittest.TestCase): def testArray2(self): arr=DataArrayDouble.New() arr.setValues([12.,11.,10.,9.,8.,7.,6.,5.,4.,3.,2.,1.],3,4) @@ -15882,7 +15882,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) self.assertEqual([0, 0], c.getValues()) self.assertEqual([-1, -1, 0, 1, -1, -1], d.getValues()) -#class MEDCouplingBasicsTest(unittest.TestCase): + def testSwig2Intersect2DMeshWith1DLine11(self): """ Quad line re-entering a square cell """ eps = 1.0e-8 @@ -15908,8 +15908,7 @@ class MEDCouplingBasicsTest(unittest.TestCase): self.assertTrue(DataArrayInt([0,0,0]).isEqual(c)) self.assertTrue(DataArrayInt([(-1,-1),(0,2),(-1,-1),(-1,-1),(0,1),(-1,-1)]).isEqual(d)) pass - -class MEDCouplingBasicsTest2: + def testSwig2Intersect2DMeshWith1DLine12(self): """ Two squares one in the other intersected by an horizontal line """ eps = 1.0e-8 @@ -15924,27 +15923,21 @@ class MEDCouplingBasicsTest2: m_line = MEDCouplingUMesh.New("seg", 1) m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2)) m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2)) -# m_line.writeVTK("/tmp/m1d_12.vtu") -# m.writeVTK("/tmp/m2d_12.vtu") - + m_line2 = m_line.deepCpy() + m2 = m.deepCpy() a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps) -# a.writeVTK("/tmp/m2d_fine_12.vtu") -# b.writeVTK("/tmp/m1d_fine_12.vtu") - - self.assertEqual([], a.getNodalConnectivity().getValues()) - self.assertEqual([], a.getNodalConnectivityIndex().getValues()) - self.assertEqual([], b.getNodalConnectivity().getValues()) - self.assertEqual([], b.getNodalConnectivityIndex().getValues()) - self.assertTrue(a.getCoords()[:8].isEqual(m.getCoords(),1e-12)) - self.assertTrue(a.getCoords()[8:10].isEqual(m_line.getCoords(),1e-12)) - coo_tgt = DataArrayDouble([]) - self.assertTrue(a.getCoords().isEqualWithoutConsideringStr(coo_tgt, 1.0e-12)) self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) - self.assertEqual([], c.getValues()) - self.assertEqual([], d.getValues()) + self.assertTrue(a.getCoords().isEqual(DataArrayDouble([(-0.5,-0.5),(-0.5,0.5),(0.5,0.5),(0.5,-0.5),(-0.25,-0.25),(-0.25,0.25),(0.25,0.25),(0.25,-0.25),(-1.0,0.25),(1.0,0.25),(-0.5,0.25),(0.5,0.25)]),1e-12)) + self.assertEqual([5,4,5,6,7,5,1,5,10,5,4,0,10,5,5,5,1,2,11,6,5,3,0,4,7,6,11],a.getNodalConnectivity().getValues()) + self.assertEqual([0,5,9,14,20,27],a.getNodalConnectivityIndex().getValues()) + self.assertEqual([1,8,10,1,10,5,1,5,6,1,6,11,1,11,9],b.getNodalConnectivity().getValues()) + self.assertEqual([0,3,6,9,12,15],b.getNodalConnectivityIndex().getValues()) + self.assertTrue(c.isEqual(DataArrayInt([0,1,1,2,2]))) + self.assertTrue(d.isEqual(DataArrayInt([(-1,-1),(1,2),(3,0),(3,4),(-1,-1)]))) pass - def testSwig2Intersect2DMeshWith1DLine13(self): +#class MEDCouplingBasicsTest(unittest.TestCase): + def tessSwig2Intersect2DMeshWith1DLine13(self): """ A square (side length) in a circle intersected by a simple horizontal line """ import math eps = 1.0e-8 @@ -15961,37 +15954,37 @@ class MEDCouplingBasicsTest2: m.checkCoherency() coords2 = [-2.0, 1.0, 2.0, 1.0] connec2, cI2 = [NORM_SEG2, 0, 1], [0,3] - m_line = MEDCouplingUMesh.New("seg", 1) + m_line = MEDCouplingUMesh("seg", 1) m_line.setCoords(DataArrayDouble(coords2, len(coords2)/2, 2)) m_line.setConnectivity(DataArrayInt(connec2), DataArrayInt(cI2)) -# m_line2 = m_line.deepCpy() -# m2 = m.deepCpy() -# m_line2.tessellate2DCurve(0.1) -# m2.tessellate2D(0.05) -# m_line2.writeVTK("/tmp/m1d_13.vtu") -# m2.writeVTK("/tmp/m2d_13.vtu") + m_line2 = m_line.deepCpy() + m2 = m.deepCpy() + m_line2.tessellate2DCurve(0.1) + m2.tessellate2D(0.05) + m_line2.writeVTK("/tmp/m1d_13.vtu") + m2.writeVTK("/tmp/m2d_13.vtu") a, b, c, d = MEDCouplingUMesh.Intersect2DMeshWith1DLine(m, m_line, eps) # a.mergeNodes(1.0e-8) -# a.tessellate2D(0.1) -# b.tessellate2DCurve(0.1) -# a.writeVTK("/tmp/m2d_fine_13.vtu") -# b.writeVTK("/tmp/m1d_fine_13.vtu") + a.tessellate2D(0.1) + b.tessellate2DCurve(0.1) + a.writeVTK("/tmp/m2d_fine_13.vtu") + b.writeVTK("/tmp/m1d_fine_13.vtu") - self.assertEqual([], a.getNodalConnectivity().getValues()) - self.assertEqual([], a.getNodalConnectivityIndex().getValues()) - self.assertEqual([], b.getNodalConnectivity().getValues()) - self.assertEqual([], b.getNodalConnectivityIndex().getValues()) - self.assertTrue(a.getCoords()[:8].isEqual(m.getCoords(),1e-12)) - self.assertTrue(a.getCoords()[8:10].isEqual(m_line.getCoords(),1e-12)) - coo_tgt = DataArrayDouble([]) - self.assertTrue(a.getCoords().isEqualWithoutConsideringStr(coo_tgt, 1.0e-12)) - self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) - self.assertEqual([], c.getValues()) - self.assertEqual([], d.getValues()) - pass - - def testSwig2Intersect2DMeshWith1DLine14(self): +# self.assertEqual([], a.getNodalConnectivity().getValues()) +# self.assertEqual([], a.getNodalConnectivityIndex().getValues()) +# self.assertEqual([], b.getNodalConnectivity().getValues()) +# self.assertEqual([], b.getNodalConnectivityIndex().getValues()) +# self.assertTrue(a.getCoords()[:8].isEqual(m.getCoords(),1e-12)) +# self.assertTrue(a.getCoords()[8:10].isEqual(m_line.getCoords(),1e-12)) +# coo_tgt = DataArrayDouble([]) +# self.assertTrue(a.getCoords().isEqualWithoutConsideringStr(coo_tgt, 1.0e-12)) +# self.assertTrue(a.getCoords().getHiddenCppPointer()==b.getCoords().getHiddenCppPointer()) +# self.assertEqual([], c.getValues()) +# self.assertEqual([], d.getValues()) + pass + + def tessSwig2Intersect2DMeshWith1DLine14(self): """ A circle in a circle intersected by a simple horizontal line, not tangent to the circles """ eps = 1.0e-8 m = MEDCouplingUMesh("boxcircle", 2) diff --git a/src/MEDCoupling_Swig/MEDCouplingCommon.i b/src/MEDCoupling_Swig/MEDCouplingCommon.i index b78056bfb..3866bfe1b 100644 --- a/src/MEDCoupling_Swig/MEDCouplingCommon.i +++ b/src/MEDCoupling_Swig/MEDCouplingCommon.i @@ -1687,6 +1687,7 @@ namespace ParaMEDMEM DataArrayDouble *getBoundingBoxForBBTreeFast() const throw(INTERP_KERNEL::Exception); DataArrayDouble *getBoundingBoxForBBTree2DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception); DataArrayDouble *getBoundingBoxForBBTree1DQuadratic(double arcDetEps=1e-12) const throw(INTERP_KERNEL::Exception); + void changeOrientationOfCells() throw(INTERP_KERNEL::Exception); int split2DCells(const DataArrayInt *desc, const DataArrayInt *descI, const DataArrayInt *subNodesInSeg, const DataArrayInt *subNodesInSegI, const DataArrayInt *midOpt=0, const DataArrayInt *midOptI=0) 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); diff --git a/src/MEDCoupling_Swig/MEDCouplingMemArray.i b/src/MEDCoupling_Swig/MEDCouplingMemArray.i index 911cb7a39..a71654bee 100644 --- a/src/MEDCoupling_Swig/MEDCouplingMemArray.i +++ b/src/MEDCoupling_Swig/MEDCouplingMemArray.i @@ -73,6 +73,7 @@ %newobject ParaMEDMEM::DataArrayInt::computeAbs; %newobject ParaMEDMEM::DataArrayInt::getIdsInRange; %newobject ParaMEDMEM::DataArrayInt::getIdsNotInRange; +%newObject ParaMEDMEM::DataArrayInt::getIdsStrictlyNegative; %newobject ParaMEDMEM::DataArrayInt::Aggregate; %newobject ParaMEDMEM::DataArrayInt::AggregateIndexes; %newobject ParaMEDMEM::DataArrayInt::Meld; @@ -2507,6 +2508,7 @@ namespace ParaMEDMEM void fillWithZero() throw(INTERP_KERNEL::Exception); void fillWithValue(int val) throw(INTERP_KERNEL::Exception); void iota(int init=0) throw(INTERP_KERNEL::Exception); + void replaceOneValByInThis(int valToBeReplaced, int replacedBy) throw(INTERP_KERNEL::Exception); std::string repr() const throw(INTERP_KERNEL::Exception); std::string reprZip() const throw(INTERP_KERNEL::Exception); DataArrayInt *invertArrayO2N2N2O(int newNbOfElem) const throw(INTERP_KERNEL::Exception); @@ -2568,6 +2570,7 @@ namespace ParaMEDMEM void applyRPow(int val) throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); DataArrayInt *getIdsNotInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); + DataArrayInt *getIdsStrictlyNegative() const throw(INTERP_KERNEL::Exception); bool checkAllIdsInRange(int vmin, int vmax) const throw(INTERP_KERNEL::Exception); static DataArrayInt *Aggregate(const DataArrayInt *a1, const DataArrayInt *a2, int offsetA2) throw(INTERP_KERNEL::Exception); static DataArrayInt *Meld(const DataArrayInt *a1, const DataArrayInt *a2) throw(INTERP_KERNEL::Exception);