From: ageay Date: Fri, 14 Dec 2012 15:45:59 +0000 (+0000) Subject: Bug when several ouput polygons in residual of m1 inter m2. X-Git-Tag: V6_main_FINAL~453 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=d8a2b3c26535878e8c541bb8080b6b151e46235f;p=tools%2Fmedcoupling.git Bug when several ouput polygons in residual of m1 inter m2. --- diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx index 9a55bea57..f4990779a 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx @@ -1364,7 +1364,7 @@ void MEDCouplingBasicsTest1::testMergeField1() std::string name=f3->getName(); CPPUNIT_ASSERT(name=="MeasureOfMesh_"); CPPUNIT_ASSERT(f3->getTypeOfField()==ON_CELLS); - CPPUNIT_ASSERT(f3->getTimeDiscretization()==NO_TIME); + CPPUNIT_ASSERT(f3->getTimeDiscretization()==ONE_TIME); CPPUNIT_ASSERT_EQUAL(1,f3->getNumberOfComponents()); CPPUNIT_ASSERT_EQUAL(7,f3->getNumberOfTuples()); double values[7]={0.25,0.125,0.125,0.25,0.25,0.5,0.5}; diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx index ebfc5594e..12109cc70 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx @@ -1650,9 +1650,9 @@ void MEDCouplingBasicsTest4::testNonRegressionCopyTinyStrings() MEDCouplingFieldDouble *f1=m->getMeasureField(true); f1->getArray()->setInfoOnComponent(0,"P [N/m^2]"); DataArrayDouble *bary=m->getBarycenterAndOwner(); - MEDCouplingFieldDouble *f2=f1->buildNewTimeReprFromThis(ONE_TIME,false); + MEDCouplingFieldDouble *f2=f1->buildNewTimeReprFromThis(NO_TIME,false); f2->setArray(bary); - CPPUNIT_ASSERT_THROW(f2->copyTinyAttrFrom(f1),INTERP_KERNEL::Exception); + CPPUNIT_ASSERT_THROW(f1->copyTinyAttrFrom(f2),INTERP_KERNEL::Exception); m->decrRef(); f1->decrRef(); bary->decrRef(); diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx index dc3c60283..88792eb8b 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx @@ -1712,3 +1712,64 @@ void MEDCouplingBasicsTest5::testDAICheckMonotonic1() CPPUNIT_ASSERT_THROW(d->checkMonotonic(false),INTERP_KERNEL::Exception); d->decrRef(); } + +void MEDCouplingBasicsTest5::testIntersect2DMeshesTmp6() +{ + // coordinates + DataArrayDouble *coords=DataArrayDouble::New(); + const double coordsData[16]={2.7554552980815448e-15,45,-45,5.5109105961630896e-15,-31.819805153394636,31.81980515339464,2.8779199779962799e-15,47,2.8166876380389124e-15,46,-47,5.7558399559925599e-15,-33.234018715767732,33.234018715767739,-46,5.6333752760778247e-15}; + coords->useArray(coordsData,false,CPP_DEALLOC,8,2); + // connectivity + DataArrayInt *conn=DataArrayInt::New(); + const int connData[9]={8,0,3,5,1,4,6,7,2}; + conn->useArray(connData,false,CPP_DEALLOC,9,1); + DataArrayInt *connI=DataArrayInt::New(); + const int connIData[2]={0,9}; + connI->useArray(connIData,false,CPP_DEALLOC,2,1); + MEDCouplingUMesh *m1=MEDCouplingUMesh::New("Fixe",2); + m1->setCoords(coords); + m1->setConnectivity(conn,connI,true); + coords->decrRef(); conn->decrRef(); connI->decrRef(); + // + coords=DataArrayDouble::New(); + const double coordsData2[26]={-7.3800475508445391,41.854329503018846,-3.7041190667754655,42.338274668899189,-3.7041190667754655,45.338274668899189,-7.3800475508445382,44.854329503018839,-5.5473631693521845,42.136406608386956,-3.7041190667754655,43.838274668899189,-5.5420833088100014,45.09630208595901,-7.3800475508445382,43.354329503018839,-3.7041190667754651,52.338274668899189,-7.3800475508445382,51.854329503018839,-3.7041190667754655,48.838274668899189,-5.5420833088100014,52.09630208595901,-7.3800475508445382,48.354329503018839}; + coords->useArray(coordsData2,false,CPP_DEALLOC,13,2); + // connectivity + conn=DataArrayInt::New(); + const int connData2[18]={8,0,1,2,3,4,5,6,7,8,3,2,8,9,6,10,11,12}; + conn->useArray(connData2,false,CPP_DEALLOC,18,1); + connI=DataArrayInt::New(); + const int connIData2[3]={0,9,18}; + connI->useArray(connIData2,false,CPP_DEALLOC,3,1); + // + MEDCouplingUMesh *m2=MEDCouplingUMesh::New("Mobile",2); + m2->setCoords(coords); + m2->setConnectivity(conn,connI,true); + coords->decrRef(); conn->decrRef(); connI->decrRef(); + // + DataArrayInt *d1=0,*d2=0; + MEDCouplingUMesh *m3=MEDCouplingUMesh::Intersect2DMeshes(m1,m2,1e-10,d1,d2); + CPPUNIT_ASSERT_EQUAL(4,m3->getNumberOfCells()); + CPPUNIT_ASSERT_EQUAL(4,d1->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(4,d2->getNumberOfTuples()); + CPPUNIT_ASSERT_EQUAL(43,m3->getNumberOfNodes()); + bool areMerged=false; + int newNbOfNodes=-1; + m3->mergeNodes(1e-12,areMerged,newNbOfNodes)->decrRef(); + CPPUNIT_ASSERT_EQUAL(35,m3->getNumberOfNodes()); + m3->zipCoords(); + CPPUNIT_ASSERT_EQUAL(23,m3->getNumberOfNodes()); + // + MEDCouplingFieldDouble *f=m3->getMeasureField(true); + const double *vals=f->getArray()->getConstPointer(); + const double valuesExpected[4]={1.6603638692585716,5.747555728471923,129.68907101754394,7.4162714498559694}; + for(int i=0;i<4;i++) + CPPUNIT_ASSERT_DOUBLES_EQUAL(valuesExpected[i],vals[i],1e-12); + f->decrRef(); + // + m1->decrRef(); + m2->decrRef(); + m3->decrRef(); + d1->decrRef(); + d2->decrRef(); +} diff --git a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx index 7a54fedb3..b7592e737 100644 --- a/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx +++ b/src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx @@ -70,6 +70,7 @@ namespace ParaMEDMEM CPPUNIT_TEST( testDAIBuildUnique1 ); CPPUNIT_TEST( testDAIPartitionByDifferentValues1 ); CPPUNIT_TEST( testDAICheckMonotonic1 ); + CPPUNIT_TEST( testIntersect2DMeshesTmp6 ); CPPUNIT_TEST_SUITE_END(); public: void testUMeshTessellate2D1(); @@ -106,6 +107,7 @@ namespace ParaMEDMEM void testDAIBuildUnique1(); void testDAIPartitionByDifferentValues1(); void testDAICheckMonotonic1(); + void testIntersect2DMeshesTmp6(); }; }