]> SALOME platform Git repositories - tools/medcoupling.git/blobdiff - src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx
Salome HOME
Normaly finished
[tools/medcoupling.git] / src / MEDCoupling / Test / MEDCouplingBasicsTestInterp.cxx
index 33c4a793de5791661641b77a722826b827f11b5a..683a8d1959838715444ca6050c8b134bcb7cb8a5 100644 (file)
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2012  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
 // License as published by the Free Software Foundation; either
-// version 2.1 of the License.
+// version 2.1 of the License, or (at your option) any later version.
 //
 // This library is distributed in the hope that it will be useful,
 // but WITHOUT ANY WARRANTY; without even the implied warranty of
 //
 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+// Author : Anthony Geay (CEA/DEN)
 
 #include "MEDCouplingBasicsTestInterp.hxx"
 #include "MEDCouplingUMesh.hxx"
-#include "MEDCouplingExtrudedMesh.hxx"
+#include "MEDCouplingMappedExtrudedMesh.hxx"
 #include "MEDCouplingFieldDouble.hxx"
 #include "MEDCouplingMemArray.hxx"
 #include "Interpolation2D.txx"
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation3D.txx"
 #include "Interpolation2D1D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "InterpolationCC.txx"
 #include "InterpolationCU.txx"
 #include "Interpolation2DCurve.hxx"
@@ -38,7 +39,7 @@
 #include <cmath>
 #include <functional>
 
-using namespace ParaMEDMEM;
+using namespace MEDCoupling;
 
 typedef std::vector<std::map<int,double> > IntersectionMatrix;
 
@@ -1464,7 +1465,7 @@ void MEDCouplingBasicsTestInterp::test3DInterpP0P0Empty()
   sourceMesh->allocateCells(0);
   sourceMesh->finishInsertingCells();
   DataArrayDouble *myCoords=DataArrayDouble::New();
-  myCoords->alloc(0,0);
+  myCoords->alloc(0,2);
   sourceMesh->setCoords(myCoords);
   myCoords->decrRef();
   MEDCouplingUMesh *targetMesh=MEDCouplingUMesh::New();
@@ -1524,7 +1525,7 @@ void MEDCouplingBasicsTestInterp::testInterpolationCC()
       {
         sum += s_v->second;
         double vvv;
-#ifdef WNT
+#ifdef WIN32
         double vv = s_v->second / precis;
         if(vv>=0.0)
           {
@@ -1931,9 +1932,8 @@ void MEDCouplingBasicsTestInterp::test2DInterpP1P0Bary_1()
   MEDCouplingNormalizedUnstructuredMesh<2,2> sourceWrapper(sourceMesh);
   MEDCouplingNormalizedUnstructuredMesh<2,2> targetWrapper(targetMesh);
   INTERP_KERNEL::Interpolation2D myInterpolator;
-  myInterpolator.setP1P0BaryMethod(true);
   std::vector<std::map<int,double> > res;
-  INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+  INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
   for(int i=0;i<2;i++)
     {
       myInterpolator.setPrecision(1e-12);
@@ -1973,9 +1973,8 @@ void MEDCouplingBasicsTestInterp::test3DSurfInterpP1P0Bary_1()
   MEDCouplingNormalizedUnstructuredMesh<3,2> sourceWrapper(sourceMesh);
   MEDCouplingNormalizedUnstructuredMesh<3,2> targetWrapper(targetMesh);
   INTERP_KERNEL::Interpolation3DSurf myInterpolator;
-  myInterpolator.setP1P0BaryMethod(true);
   std::vector<std::map<int,double> > res;
-  INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Triangulation, INTERP_KERNEL::Geometric2D};
+  INTERP_KERNEL::IntersectionType types[2]={INTERP_KERNEL::Barycentric,INTERP_KERNEL::BarycentricGeo2D};
   for(int i=0;i<2;i++)
     {
       myInterpolator.setPrecision(1e-12);
@@ -2016,9 +2015,9 @@ void MEDCouplingBasicsTestInterp::test3DInterpP1P0Bary_1()
   MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
   MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
   INTERP_KERNEL::Interpolation3D myInterpolator;
-  myInterpolator.setP1P0BaryMethod(true);
   std::vector<std::map<int,double> > res;
   myInterpolator.setPrecision(1e-12);
+  myInterpolator.setIntersectionType(INTERP_KERNEL::Barycentric);
   myInterpolator.interpolateMeshes(sourceWrapper,targetWrapper,res,"P1P0");
   CPPUNIT_ASSERT_EQUAL(5,(int)res.size());
 
@@ -2303,10 +2302,10 @@ void MEDCouplingBasicsTestInterp::test2D1DBasicInterpP0P0()
   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();
+  INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
   CPPUNIT_ASSERT_EQUAL(1,(int)duplicateFaces.size());
 
-  INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType correctDuplicateFaces;
+  INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
   std::set<int> face6;
   face6.insert(0);
   face6.insert(1);
@@ -2428,7 +2427,7 @@ void MEDCouplingBasicsTestInterp::test3D2DBasicInterpP0P0()
 
   MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
   MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
-  INTERP_KERNEL::Interpolation3D2D myInterpolator;
+  INTERP_KERNEL::Interpolation2D3D myInterpolator;
   myInterpolator.setPrecision(1e-12);
   std::vector<std::map<int,double> > matrix;
   INTERP_KERNEL::SplittingPolicy sp[] = { INTERP_KERNEL::PLANAR_FACE_5, INTERP_KERNEL::PLANAR_FACE_6, INTERP_KERNEL::GENERAL_24, INTERP_KERNEL::GENERAL_48 };
@@ -2464,10 +2463,10 @@ void MEDCouplingBasicsTestInterp::test3D2DBasicInterpP0P0()
     CPPUNIT_ASSERT_DOUBLES_EQUAL(80.        ,matrix[2][5],1e-12);
     CPPUNIT_ASSERT_DOUBLES_EQUAL(112.       ,matrix[2][6],1e-12);
 
-    INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+    INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
     CPPUNIT_ASSERT_EQUAL(3,(int)duplicateFaces.size());
 
-    INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType correctDuplicateFaces;
+    INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType correctDuplicateFaces;
     std::set<int> face2;
     face2.insert(0);
     face2.insert(1);