]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Bug when several ouput polygons in residual of m1 inter m2.
authorageay <ageay>
Fri, 14 Dec 2012 15:45:59 +0000 (15:45 +0000)
committerageay <ageay>
Fri, 14 Dec 2012 15:45:59 +0000 (15:45 +0000)
src/MEDCoupling/Test/MEDCouplingBasicsTest1.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest4.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest5.hxx

index 9a55bea575f206a4bffc91bbebd2cf45ac1999ea..f4990779ad603ddb62302a406ea4265e24f95aea 100644 (file)
@@ -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};
index ebfc5594e6578e4dadd92e33d27c241f12d01a3d..12109cc7065ec1557c70d27bc0c7f558d4c969fd 100644 (file)
@@ -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();
index dc3c602836c65ec37b8a9182fa2e628dd20fb71d..88792eb8bc2791dfd6fc97bb477e1b2717c7b1cd 100644 (file)
@@ -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();
+}
index 7a54fedb3f883d5645cac090b246dd7d8b6f086d..b7592e737455a6e286b6d6e21583f93b3e0799ab 100644 (file)
@@ -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();
   };
 }