]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
Intersection 2D1D EndWorkDidier
authorbph <bph>
Fri, 26 Aug 2011 14:08:35 +0000 (14:08 +0000)
committerbph <bph>
Fri, 26 Aug 2011 14:08:35 +0000 (14:08 +0000)
src/MEDCoupling/Test/MEDCouplingBasicsTest.hxx
src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx

index 769e88ccb9ed1e67a898a44d55fd1ca3c94039b5..1d08d9cf17b306fa9aa779145f1a3dcdba8689c3 100644 (file)
@@ -275,31 +275,44 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( test3DInterpP1P0Bary_1 );
     CPPUNIT_TEST( test3DTo1DInterpP0P0PL_1 );
 
+    CPPUNIT_TEST( test2D1DBasicInterpP0P0 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_1 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_2 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_3 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_4 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_5 );
+    CPPUNIT_TEST( test2D1DSegQuadInterpP0P0_6 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_1 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_2 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_3 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_4 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_5 );
+    CPPUNIT_TEST( test2D1DSegTriInterpP0P0_6 );
     CPPUNIT_TEST( test3D2DBasicInterpP0P0 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_1 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_2 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_3 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_4 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_5 );
-    CPPUNIT_TEST( test3D2QuadHexaInterpP0P0_6 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_1 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_2 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_3 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_4 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_5 );
-    CPPUNIT_TEST( test3D2TriHexaInterpP0P0_6 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_1 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_2 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_3 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_4 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_5 );
-    CPPUNIT_TEST( test3D2QuadTetraInterpP0P0_6 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_1 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_2 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_3 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_4 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_5 );
-    CPPUNIT_TEST( test3D2TriTetraInterpP0P0_6 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_1 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_2 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_3 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_4 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_5 );
+    CPPUNIT_TEST( test3D2DQuadHexaInterpP0P0_6 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_1 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_2 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_3 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_4 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_5 );
+    CPPUNIT_TEST( test3D2DTriHexaInterpP0P0_6 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_1 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_2 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_3 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_4 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_5 );
+    CPPUNIT_TEST( test3D2DQuadTetraInterpP0P0_6 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_1 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_2 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_3 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_4 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_5 );
+    CPPUNIT_TEST( test3D2DTriTetraInterpP0P0_6 );
 
     CPPUNIT_TEST( test1DInterp_1 );
     CPPUNIT_TEST( test2DCurveInterpP0P0_1 );
@@ -307,7 +320,9 @@ namespace ParaMEDMEM
     CPPUNIT_TEST( test2DCurveInterpP0P1_1 );
     CPPUNIT_TEST( test2DCurveInterpP1P0_1 );
     CPPUNIT_TEST( test2DCurveInterpP1P1_1 );
+
     CPPUNIT_TEST_SUITE_END();
+
   public:
     //MEDCouplingBasicsTest1.cxx
     void testArray();
@@ -557,31 +572,44 @@ namespace ParaMEDMEM
     void test2DCurveInterpP1P0_1();
     void test2DCurveInterpP1P1_1();
 
+    void test2D1DBasicInterpP0P0();
+    void test2D1DSegQuadInterpP0P0_1();
+    void test2D1DSegQuadInterpP0P0_2();
+    void test2D1DSegQuadInterpP0P0_3();
+    void test2D1DSegQuadInterpP0P0_4();
+    void test2D1DSegQuadInterpP0P0_5();
+    void test2D1DSegQuadInterpP0P0_6();
+    void test2D1DSegTriInterpP0P0_1();
+    void test2D1DSegTriInterpP0P0_2();
+    void test2D1DSegTriInterpP0P0_3();
+    void test2D1DSegTriInterpP0P0_4();
+    void test2D1DSegTriInterpP0P0_5();
+    void test2D1DSegTriInterpP0P0_6();
     void test3D2DBasicInterpP0P0();
-    void test3D2QuadHexaInterpP0P0_1();
-    void test3D2QuadHexaInterpP0P0_2();
-    void test3D2QuadHexaInterpP0P0_3();
-    void test3D2QuadHexaInterpP0P0_4();
-    void test3D2QuadHexaInterpP0P0_5();
-    void test3D2QuadHexaInterpP0P0_6();
-    void test3D2TriHexaInterpP0P0_1();
-    void test3D2TriHexaInterpP0P0_2();
-    void test3D2TriHexaInterpP0P0_3();
-    void test3D2TriHexaInterpP0P0_4();
-    void test3D2TriHexaInterpP0P0_5();
-    void test3D2TriHexaInterpP0P0_6();
-    void test3D2QuadTetraInterpP0P0_1();
-    void test3D2QuadTetraInterpP0P0_2();
-    void test3D2QuadTetraInterpP0P0_3();
-    void test3D2QuadTetraInterpP0P0_4();
-    void test3D2QuadTetraInterpP0P0_5();
-    void test3D2QuadTetraInterpP0P0_6();
-    void test3D2TriTetraInterpP0P0_1();
-    void test3D2TriTetraInterpP0P0_2();
-    void test3D2TriTetraInterpP0P0_3();
-    void test3D2TriTetraInterpP0P0_4();
-    void test3D2TriTetraInterpP0P0_5();
-    void test3D2TriTetraInterpP0P0_6();
+    void test3D2DQuadHexaInterpP0P0_1();
+    void test3D2DQuadHexaInterpP0P0_2();
+    void test3D2DQuadHexaInterpP0P0_3();
+    void test3D2DQuadHexaInterpP0P0_4();
+    void test3D2DQuadHexaInterpP0P0_5();
+    void test3D2DQuadHexaInterpP0P0_6();
+    void test3D2DTriHexaInterpP0P0_1();
+    void test3D2DTriHexaInterpP0P0_2();
+    void test3D2DTriHexaInterpP0P0_3();
+    void test3D2DTriHexaInterpP0P0_4();
+    void test3D2DTriHexaInterpP0P0_5();
+    void test3D2DTriHexaInterpP0P0_6();
+    void test3D2DQuadTetraInterpP0P0_1();
+    void test3D2DQuadTetraInterpP0P0_2();
+    void test3D2DQuadTetraInterpP0P0_3();
+    void test3D2DQuadTetraInterpP0P0_4();
+    void test3D2DQuadTetraInterpP0P0_5();
+    void test3D2DQuadTetraInterpP0P0_6();
+    void test3D2DTriTetraInterpP0P0_1();
+    void test3D2DTriTetraInterpP0P0_2();
+    void test3D2DTriTetraInterpP0P0_3();
+    void test3D2DTriTetraInterpP0P0_4();
+    void test3D2DTriTetraInterpP0P0_5();
+    void test3D2DTriTetraInterpP0P0_6();
 
   public:
     static MEDCouplingUMesh *build3DSourceMesh_2();
@@ -623,6 +651,12 @@ namespace ParaMEDMEM
     static MEDCouplingUMesh *buildHexa8Mesh_1();
     static MEDCouplingUMesh *buildPointe_1(MEDCouplingUMesh *&m1);
 
+    static MEDCouplingUMesh *build2D1DSourceMesh();
+    static MEDCouplingUMesh *build2D1DTargetMesh();
+    static MEDCouplingUMesh *build2D1DSegSourceMesh(const double shiftX = 0.,
+                                                    const double inclinationX = 0.);
+    static MEDCouplingUMesh *build2D1DQuadTargetMesh(const double inclinaisonX = 0.);
+    static MEDCouplingUMesh *build2D1DTriTargetMesh(const double inclinaisonX = 0.);
     static MEDCouplingUMesh *build3D2DSourceMesh();
     static MEDCouplingUMesh *build3D2DTargetMesh();
     static MEDCouplingUMesh* build3D2DQuadSourceMesh(const double shiftX = 0.,
@@ -640,6 +674,11 @@ namespace ParaMEDMEM
   private:
     static int countNonZero(const std::vector< std::map<int,double> >& matrix);
 
+    static void test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
+                                           MEDCouplingUMesh *targetMesh,
+                                           const double correctSurf,
+                                           const int correctDuplicateFacesNbr,
+                                           const int correctTotalIntersectFacesNbr = -1);
     static void test3D2DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
                                            MEDCouplingUMesh *targetMesh,
                                            const double correctSurf,
index 0681cf474df7659537abfd35d0ba61fa87f18247..1810a94ae92ae5ae09ec2ad2f1b7940f859f8a12 100644 (file)
@@ -1174,6 +1174,174 @@ double MEDCouplingBasicsTest::sumAll(const std::vector< std::map<int,double> >&
   return ret;
 }
 
+MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DSourceMesh()
+{
+  double sourceCoords[18]={-17., 3.,  -17., 8.,   -5., 8.,
+                            -5., 3.,   -9., 0.,  -13., 3.,
+                            -9., 8.,   -7., 0.,   -7., 8.
+  };
+  int sourceConn[16]={0,1, 1,2, 2,3, 3,0, 3,4, 4,5, 4,6, 7,8};
+  MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
+  sourceMesh->setMeshDimension(1);
+  sourceMesh->allocateCells(8);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+2);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+4);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+6);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+8);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+10);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+12);
+  sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn+14);
+  sourceMesh->finishInsertingCells();
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(9,2);
+  std::copy(sourceCoords,sourceCoords+18,myCoords->getPointer());
+  sourceMesh->setCoords(myCoords);
+  myCoords->decrRef();
+  return sourceMesh;
+}
+
+MEDCouplingUMesh *MEDCouplingBasicsTest::build2D1DTargetMesh()
+{
+  double targetCoords[10]={-17., 0., -17.,6., -9.,6., -9.,0., -5., 3.};
+  int targetConn[7]={0,1,2,3, 2,3,4};
+  MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
+  targetMesh->setMeshDimension(2);
+  targetMesh->allocateCells(2);
+  targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
+  targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3 ,3,targetConn + 4);
+  targetMesh->finishInsertingCells();
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(5,2);
+  std::copy(targetCoords,targetCoords+10,myCoords->getPointer());
+  targetMesh->setCoords(myCoords);
+  myCoords->decrRef();
+  return targetMesh;
+}
+
+MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DSegSourceMesh(const double shiftX,
+                                                                const double inclinationX)
+{
+  MEDCouplingUMesh *sourceMesh=MEDCouplingUMesh::New();
+  sourceMesh->setMeshDimension(1);
+
+  const int nbY = 4;
+  const int nbYP1 = nbY + 1;
+  sourceMesh->allocateCells(nbY);
+
+  int sourceConn[2];
+  for (int iY = 0; iY < nbY; ++iY)
+    {
+      sourceConn[0] = iY    ;
+      sourceConn[1] = iY + 1;
+      sourceMesh->insertNextCell(INTERP_KERNEL::NORM_SEG2,2,sourceConn);
+    }
+  sourceMesh->finishInsertingCells();
+
+  std::vector<double> sourceCoords;
+  for (int iY = 0; iY < nbYP1; ++iY)
+    {
+      sourceCoords.push_back(iY * inclinationX + shiftX);
+      sourceCoords.push_back(iY * 4.);
+    }
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(nbYP1,2);
+  std::copy(sourceCoords.begin(),sourceCoords.end(),myCoords->getPointer());
+  sourceMesh->setCoords(myCoords);
+  myCoords->decrRef();
+
+  return sourceMesh;
+}
+
+MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DQuadTargetMesh(const double inclinationX)
+{
+  MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
+  targetMesh->setMeshDimension(2);
+
+  const int nbX = 5;
+  const int nbY = 4;
+  const int nbXP1 = nbX + 1;
+  const int nbYP1 = nbY + 1;
+  targetMesh->allocateCells(nbX * nbY);
+
+  int targetConn[4];
+  for (int iX = 0; iX < nbX; ++iX)
+    {
+      for (int iY = 0; iY < nbY; ++iY)
+        {
+          targetConn[0] = iY     +  iX      * nbYP1;
+          targetConn[1] = iY + 1 +  iX      * nbYP1;
+          targetConn[2] = iY + 1 + (iX + 1) * nbYP1;
+          targetConn[3] = iY     + (iX + 1) * nbYP1;
+          targetMesh->insertNextCell(INTERP_KERNEL::NORM_QUAD4,4,targetConn);
+        }
+    }
+  targetMesh->finishInsertingCells();
+
+  std::vector<double> targetCoords;
+  for (int iX = 0; iX < nbXP1; ++iX)
+    {
+      for (int iY = 0; iY < nbYP1; ++iY)
+        {
+          targetCoords.push_back(iX * 3. + iY * inclinationX);
+          targetCoords.push_back(iY * 4.);
+        }
+    }
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(nbXP1 * nbYP1, 2);
+  std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer());
+  targetMesh->setCoords(myCoords);
+  myCoords->decrRef();
+
+  return targetMesh;
+}
+
+MEDCouplingUMesh* MEDCouplingBasicsTest::build2D1DTriTargetMesh(const double inclinationX)
+{
+  MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
+  targetMesh->setMeshDimension(2);
+
+  const int nbX = 5;
+  const int nbY = 4;
+  const int nbXP1 = nbX + 1;
+  const int nbYP1 = nbY + 1;
+  targetMesh->allocateCells(nbX * nbY * 2);
+
+  int targetConn[3];
+  for (int iX = 0; iX < nbX; ++iX)
+    {
+      for (int iY = 0; iY < nbY; ++iY)
+        {
+          targetConn[0] = iY     +  iX      * nbYP1;
+          targetConn[1] = iY + 1 +  iX      * nbYP1;
+          targetConn[2] = iY + 1 + (iX + 1) * nbYP1;
+          targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
+          targetConn[0] = iY     +  iX      * nbYP1;
+          targetConn[1] = iY + 1 + (iX + 1) * nbYP1;
+          targetConn[2] = iY     + (iX + 1) * nbYP1;
+          targetMesh->insertNextCell(INTERP_KERNEL::NORM_TRI3,3,targetConn);
+        }
+    }
+  targetMesh->finishInsertingCells();
+
+  std::vector<double> targetCoords;
+  for (int iX = 0; iX < nbXP1; ++iX)
+    {
+      for (int iY = 0; iY < nbYP1; ++iY)
+        {
+          targetCoords.push_back(iX * 3. + iY * inclinationX);
+          targetCoords.push_back(iY * 4.);
+        }
+    }
+  DataArrayDouble *myCoords=DataArrayDouble::New();
+  myCoords->alloc(nbXP1 * nbYP1, 2);
+  std::copy(targetCoords.begin(),targetCoords.end(),myCoords->getPointer());
+  targetMesh->setCoords(myCoords);
+  myCoords->decrRef();
+
+  return targetMesh;
+}
+
 MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DSourceMesh()
 {
   double sourceCoords[63]={-12., 6., 10., -12.,10.,  6., -16.,10. , 10.,
@@ -1200,11 +1368,6 @@ MEDCouplingUMesh *MEDCouplingBasicsTest::build3D2DSourceMesh()
   std::copy(sourceCoords,sourceCoords+63,myCoords->getPointer());
   sourceMesh->setCoords(myCoords);
   myCoords->decrRef();
-
-  //dp sourceMesh->checkCoherency();
-  //dp MEDLoader::WriteUMesh("test3D2DBasicInterpP0P0.med",sourceMesh,true);
-  //dp sourceMesh->decrRef();
-
   return sourceMesh;
 }
 
index 3b3413b2535e8788b4805b517f9d649231d20760..cc72bd6b12e7d04622448c6fcd61a10ec74532e7 100644 (file)
@@ -24,6 +24,7 @@
 #include "Interpolation2D.txx"
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation3D.txx"
+#include "Interpolation2D1D.txx"
 #include "Interpolation3D2D.txx"
 #include "InterpolationCC.txx"
 #include "InterpolationCU.txx"
@@ -2268,6 +2269,203 @@ void MEDCouplingBasicsTest::test2DCurveInterpP1P1_1()
   targetMesh->decrRef();
 }
 
+void MEDCouplingBasicsTest::test2D1DBasicInterpP0P0()
+{
+  MEDCouplingUMesh *sourceMesh=build2D1DSourceMesh();
+  MEDCouplingUMesh *targetMesh=build2D1DTargetMesh();
+
+  MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
+  MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
+  INTERP_KERNEL::Interpolation2D1D myInterpolator;
+  myInterpolator.setPrecision(1e-12);
+  myInterpolator.setIntersectionType(INTERP_KERNEL::Geometric2D);
+  std::vector<std::map<int,double> > matrix;
+  myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0");
+
+  CPPUNIT_ASSERT_EQUAL(2,(int)matrix.size());
+
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[0][0],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][1],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][2],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(8., matrix[0][3],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][4],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(5., matrix[0][5],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[0][6],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[0][7],1e-12);
+
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][0],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][1],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][2],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(4., matrix[1][3],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(5., matrix[1][4],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(0., matrix[1][5],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(6., matrix[1][6],1e-12);
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(3., matrix[1][7],1e-12);
+
+  INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+  CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size());
+
+  INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType correctDuplicateFaces;
+  std::set<int> face6;
+  face6.insert(0);
+  face6.insert(1);
+  correctDuplicateFaces[6] = face6;
+
+  CPPUNIT_ASSERT(correctDuplicateFaces == duplicateFaces);
+
+  //clean up
+  sourceMesh->decrRef();
+  targetMesh->decrRef();
+}
+
+int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<int,double> >& matrix)
+{
+  int ret=0.;
+  for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
+    for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
+      if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
+  return ret;
+}
+
+void MEDCouplingBasicsTest::test2D1DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
+                                                       MEDCouplingUMesh *targetMesh,
+                                                       const double correctLength,
+                                                       const int correctDuplicateFacesNbr,
+                                                       const int correctTotalIntersectFacesNbr)
+{
+  MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
+  MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
+  INTERP_KERNEL::Interpolation2D1D myInterpolator;
+  myInterpolator.setPrecision(1e-12);
+  const double prec = 1.0e-5;
+  IntersectionMatrix matrix;
+  myInterpolator.setIntersectionType(INTERP_KERNEL::Geometric2D);
+  myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,matrix,"P0P0");
+
+  std::cout.precision(16);
+
+  const double length = sumAll(matrix);
+  LOG(1, "length =  " << surf <<"  correctLength = " << correctLength );
+  CPPUNIT_ASSERT_DOUBLES_EQUAL(correctLength, length, prec * std::max(correctLength, length));
+
+  INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+  int duplicateFacesNbr = duplicateFaces.size();
+  LOG(1, "duplicateFacesNbr =  " << duplicateFacesNbr <<"  correctDuplicateFacesNbr = " <<  correctDuplicateFacesNbr);
+  CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr);
+
+  if (correctTotalIntersectFacesNbr >= 0)
+    {
+      int totalIntersectFacesNbr = countNonZero(matrix);
+      LOG(1, "totalIntersectFacesNbr =  " << totalIntersectFacesNbr <<"  correctTotalIntersectFacesNbr = " << correctTotalIntersectFacesNbr );
+      CPPUNIT_ASSERT_EQUAL(correctTotalIntersectFacesNbr, totalIntersectFacesNbr);
+    }
+  //clean up
+  sourceMesh->decrRef();
+  targetMesh->decrRef();
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_1()
+{
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh();
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 16., 0, 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_2()
+{
+  const double shiftX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX);
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 16., 4, 2 * 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_3()
+{
+  const double shiftX = 1.5;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 0, 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_4()
+{
+  const double shiftX = 3.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 20., 4, 2 * 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_5()
+{
+  const double shiftX = 9.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX);
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 12., 0, 3);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegQuadInterpP0P0_6()
+{
+  const double shiftX = 9.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DQuadTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 10., 0, 2);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_1()
+{
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh();
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 16., 0, 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_2()
+{
+  const double shiftX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX);
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 16., 4, 2 * 4);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_3()
+{
+  const double shiftX = 1.5;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 0, 8);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_4()
+{
+  const double shiftX = 3.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 2. * 20., 4, 8);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_5()
+{
+  const double shiftX = 9.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX);
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh(inclinationX);
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 12., 0, 6);
+}
+
+void MEDCouplingBasicsTest::test2D1DSegTriInterpP0P0_6()
+{
+  const double shiftX = 9.;
+  const double inclinationX = 3.;
+  MEDCouplingUMesh *sourceMesh=build2D1DSegSourceMesh(shiftX, inclinationX);
+  MEDCouplingUMesh *targetMesh=build2D1DTriTargetMesh();
+  test2D1DMeshesIntersection(sourceMesh, targetMesh, 20., 2, 4);
+}
+
 void MEDCouplingBasicsTest::test3D2DBasicInterpP0P0()
 {
   MEDCouplingUMesh *sourceMesh=build3D2DSourceMesh();
@@ -2336,15 +2534,6 @@ void MEDCouplingBasicsTest::test3D2DBasicInterpP0P0()
   targetMesh->decrRef();
 }
 
-int MEDCouplingBasicsTest::countNonZero(const std::vector< std::map<int,double> >& matrix)
-{
-  int ret=0.;
-  for(std::vector< std::map<int,double> >::const_iterator iter=matrix.begin();iter!=matrix.end();iter++)
-    for(std::map<int,double>::const_iterator iter2=(*iter).begin();iter2!=(*iter).end();iter2++)
-      if (!INTERP_KERNEL::epsilonEqual((*iter2).second, 0.)) ret +=1;
-  return ret;
-}
-
 void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceMesh,
                                                        MEDCouplingUMesh *targetMesh,
                                                        const double correctSurf,
@@ -2387,16 +2576,14 @@ void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceM
   targetMesh->decrRef();
 }
 
-//dp TODO DP : adapter les commentaires
-
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_1()
 {
   MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh();
   MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh();
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 20);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_2()
 {
   const double shiftX = 3.;
   MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX);
@@ -2404,7 +2591,7 @@ void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_2()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 20);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_3()
 {
   const double shiftX = 1.5;
   const double inclinationX = 3.;
@@ -2413,7 +2600,7 @@ void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_3()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 20);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_4()
 {
   const double shiftX = 3.;
   const double inclinationX = 3.;
@@ -2422,7 +2609,7 @@ void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_4()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 20);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_5()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2431,7 +2618,7 @@ void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_5()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 15);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DQuadHexaInterpP0P0_6()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2440,14 +2627,14 @@ void MEDCouplingBasicsTest::test3D2QuadHexaInterpP0P0_6()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 10);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_1()
 {
   MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh();
   MEDCouplingUMesh *targetMesh=build3D2DHexaTargetMesh();
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_2()
 {
   const double shiftX = 3.;
   MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX);
@@ -2455,7 +2642,7 @@ void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_2()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 2 * 40);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_3()
 {
   const double shiftX = 1.5;
   const double inclinationX = 3.;
@@ -2464,7 +2651,7 @@ void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_3()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 40);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_4()
 {
   const double shiftX = 3.;
   const double inclinationX = 3.;
@@ -2473,7 +2660,7 @@ void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_4()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 2 * 40);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_5()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2482,7 +2669,7 @@ void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_5()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 30);
 }
 
-void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DTriHexaInterpP0P0_6()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2491,14 +2678,14 @@ void MEDCouplingBasicsTest::test3D2TriHexaInterpP0P0_6()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 20);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_1()
 {
   MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh();
   MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 20, 40);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_2()
 {
   const double shiftX = 3.;
   MEDCouplingUMesh *sourceMesh=build3D2DQuadSourceMesh(shiftX);
@@ -2506,7 +2693,7 @@ void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_2()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 20, 2 * 40);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_3()
 {
   const double shiftX = 1.5;
   const double inclinationX = 3.;
@@ -2515,7 +2702,7 @@ void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_3()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0, 100);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_4()
 {
   const double shiftX = 3.;
   const double inclinationX = 3.;
@@ -2524,7 +2711,7 @@ void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_4()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 20, 2 * 40);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_5()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2533,7 +2720,7 @@ void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_5()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0, 45);
 }
 
-void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DQuadTetraInterpP0P0_6()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2542,14 +2729,14 @@ void MEDCouplingBasicsTest::test3D2QuadTetraInterpP0P0_6()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0, 30);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_1()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_1()
 {
   MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh();
   MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 240., 0, 40);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_2()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_2()
 {
   const double shiftX = 3.;
   MEDCouplingUMesh *sourceMesh=build3D2DTriSourceMesh(shiftX);
@@ -2557,7 +2744,7 @@ void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_2()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 240., 40, 40 + 80);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_3()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_3()
 {
   const double shiftX = 1.5;
   const double inclinationX = 3.;
@@ -2566,7 +2753,7 @@ void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_3()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 300., 0);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_4()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_4()
 {
   const double shiftX = 3.;
   const double inclinationX = 3.;
@@ -2575,7 +2762,7 @@ void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_4()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 2. * 300., 40, 40 + 80);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_5()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_5()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2584,7 +2771,7 @@ void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_5()
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 180., 0);
 }
 
-void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_6()
+void MEDCouplingBasicsTest::test3D2DTriTetraInterpP0P0_6()
 {
   const double shiftX = 9.;
   const double inclinationX = 3.;
@@ -2592,3 +2779,4 @@ void MEDCouplingBasicsTest::test3D2TriTetraInterpP0P0_6()
   MEDCouplingUMesh *targetMesh=build3D2DTetraTargetMesh();
   test3D2DMeshesIntersection(sourceMesh, targetMesh, 150., 0);
 }
+