]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
3D2D -> 2D3D to ease readability.
authorAnthony Geay <anthony.geay@edf.fr>
Fri, 8 Jan 2016 18:28:48 +0000 (19:28 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Fri, 8 Jan 2016 18:28:48 +0000 (19:28 +0100)
12 files changed:
src/INTERP_KERNEL/CMakeLists.txt
src/INTERP_KERNEL/Interpolation2D3D.cxx [new file with mode: 0644]
src/INTERP_KERNEL/Interpolation2D3D.hxx [new file with mode: 0644]
src/INTERP_KERNEL/Interpolation2D3D.txx [new file with mode: 0644]
src/INTERP_KERNEL/Interpolation3D2D.cxx [deleted file]
src/INTERP_KERNEL/Interpolation3D2D.hxx [deleted file]
src/INTERP_KERNEL/Interpolation3D2D.txx [deleted file]
src/MEDCoupling/MEDCouplingRemapper.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTest0.cxx
src/MEDCoupling/Test/MEDCouplingBasicsTestInterp.cxx
src/ParaMEDMEM/InterpolationMatrix.cxx
src/ParaMEDMEM/OverlapInterpolationMatrix.cxx

index 2f2124db5efa8a0379a21cae8726b053353d53cc..c11319ff8aef0aa7206cc743539999e687b6feea 100644 (file)
@@ -34,7 +34,7 @@ SET(interpkernel_SOURCES
   Interpolation2DCurve.cxx
   Interpolation3DSurf.cxx
   Interpolation3D.cxx
-  Interpolation3D2D.cxx
+  Interpolation2D3D.cxx
   MeshElement.cxx
   InterpKernelMeshQuality.cxx
   InterpKernelCellSimplify.cxx
diff --git a/src/INTERP_KERNEL/Interpolation2D3D.cxx b/src/INTERP_KERNEL/Interpolation2D3D.cxx
new file mode 100644 (file)
index 0000000..2527c9e
--- /dev/null
@@ -0,0 +1,34 @@
+// Copyright (C) 2007-2015  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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#include "Interpolation2D3D.hxx"
+
+namespace INTERP_KERNEL
+{
+  /**
+   * Default constructor
+   * 
+   */
+  Interpolation2D3D::Interpolation2D3D()
+  {
+  }
+  Interpolation2D3D::Interpolation2D3D(const InterpolationOptions& io):Interpolation<Interpolation2D3D>(io)
+  {
+  }
+}
diff --git a/src/INTERP_KERNEL/Interpolation2D3D.hxx b/src/INTERP_KERNEL/Interpolation2D3D.hxx
new file mode 100644 (file)
index 0000000..0a68b11
--- /dev/null
@@ -0,0 +1,61 @@
+// Copyright (C) 2007-2015  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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+
+#ifndef __INTERPOLATION2D3D_HXX__
+#define __INTERPOLATION2D3D_HXX__
+
+#include <set>
+#include <map>
+
+#include "INTERPKERNELDefines.hxx"
+#include "Interpolation.hxx"
+#include "NormalizedUnstructuredMesh.hxx"
+#include "InterpolationOptions.hxx"
+
+namespace INTERP_KERNEL
+{
+  /*!
+   * Contrary to its name this class deals with 2D mesh in source and 3D mesh in target.
+   * The meshdim of 'MyMeshType' in input is ignored that's why 'meshS' and 'meshT'
+   * have the same type.
+   * '_duplicate_faces' attribute stores duplicated faces in the following format.
+   * The key of '_duplicate_faces' represents the 2D cellId that is shared by
+   * more than one 3D target cell, and the value of '_duplicate_faces'
+   * the 3D target cells. The size of the value of '_duplicate_faces' is more than or equal to 2.
+   */
+  class Interpolation2D3D : public Interpolation<Interpolation2D3D>
+  {
+  public:
+    typedef std::map<int,std::set<int> > DuplicateFacesType;
+
+    INTERPKERNEL_EXPORT Interpolation2D3D();
+    INTERPKERNEL_EXPORT Interpolation2D3D(const InterpolationOptions& io);
+    template<class MyMeshType, class MyMatrixType>
+    int interpolateMeshes(const MyMeshType& srcMesh,
+                          const MyMeshType& targetMesh,
+                          MyMatrixType& matrix,
+                          const std::string& method);
+    INTERPKERNEL_EXPORT DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; }
+  private:
+    SplittingPolicy _splitting_policy;
+    DuplicateFacesType _duplicate_faces;
+  };
+}
+
+#endif
diff --git a/src/INTERP_KERNEL/Interpolation2D3D.txx b/src/INTERP_KERNEL/Interpolation2D3D.txx
new file mode 100644 (file)
index 0000000..43045f8
--- /dev/null
@@ -0,0 +1,190 @@
+// Copyright (C) 2007-2015  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, 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
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
+//
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+//
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+//
+#ifndef __INTERPOLATION2D3D_TXX__
+#define __INTERPOLATION2D3D_TXX__
+
+#include "Interpolation2D3D.hxx"
+#include "Interpolation.txx"
+#include "MeshElement.txx"
+#include "TransformedTriangle.hxx"
+#include "Polyhedron3D2DIntersectorP0P0.txx"
+#include "PointLocator3DIntersectorP0P0.txx"
+#include "PolyhedronIntersectorP0P1.txx"
+#include "PointLocator3DIntersectorP0P1.txx"
+#include "PolyhedronIntersectorP1P0.txx"
+#include "PolyhedronIntersectorP1P0Bary.txx"
+#include "PointLocator3DIntersectorP1P0.txx"
+#include "PolyhedronIntersectorP1P1.txx"
+#include "PointLocator3DIntersectorP1P1.txx"
+#include "Log.hxx"
+
+#include "BBTree.txx"
+
+namespace INTERP_KERNEL
+{
+  /**
+   * Calculates the matrix of volumes of intersection between the elements of srcMesh and the elements of targetMesh.
+   * The calculation is done in two steps. First a filtering process reduces the number of pairs of elements for which the
+   * calculation must be carried out by eliminating pairs that do not intersect based on their bounding boxes. Then, the 
+   * volume of intersection is calculated by an object of type Intersector3D for the remaining pairs, and entered into the
+   * intersection matrix. 
+   * 
+   * The matrix is partially sparse : it is a vector of maps of integer - double pairs. 
+   * It can also be an INTERP_KERNEL::Matrix object.
+   * The length of the vector is equal to the number of target elements - for each target element there is a map, regardless
+   * of whether the element intersects any source elements or not. But in the maps there are only entries for those source elements
+   * which have a non-zero intersection volume with the target element. The vector has indices running from 
+   * 0 to (nb target elements - 1), meaning that the map for target element i is stored at index i - 1. In the maps, however,
+   * the indexing is more natural : the intersection volume of the target element i with source element j is found at matrix[i-1][j].
+   * 
+
+   * @param srcMesh     3DSurf source mesh (meshDim=2,spaceDim=3)
+   * @param targetMesh  3D target mesh, containing only tetraedra
+   * @param matrix      matrix in which the result is stored
+   *
+   */
+  template<class MyMeshType, class MyMatrixType>
+  int Interpolation2D3D::interpolateMeshes(const MyMeshType& srcMesh,
+                                           const MyMeshType& targetMesh,
+                                           MyMatrixType& matrix,
+                                           const std::string& method)
+  {
+    typedef typename MyMeshType::MyConnType ConnType;
+    // create MeshElement objects corresponding to each element of the two meshes
+    const unsigned long numSrcElems = srcMesh.getNumberOfElements();
+    const unsigned long numTargetElems = targetMesh.getNumberOfElements();
+
+    LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
+
+    std::vector<MeshElement<ConnType>*> srcElems(numSrcElems);
+    std::vector<MeshElement<ConnType>*> targetElems(numTargetElems);
+
+    std::map<MeshElement<ConnType>*, int> indices;
+    DuplicateFacesType intersectFaces;
+
+    for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+      srcElems[i] = new MeshElement<ConnType>(i, srcMesh);       
+
+    for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+      targetElems[i] = new MeshElement<ConnType>(i, targetMesh);
+
+    Intersector3D<MyMeshType,MyMatrixType>* intersector=0;
+    std::string methC = InterpolationOptions::filterInterpolationMethod(method);
+    const double dimCaracteristic = CalculateCharacteristicSizeOfMeshes(srcMesh, targetMesh, InterpolationOptions::getPrintLevel());
+    if(methC=="P0P0")
+      {
+        switch(InterpolationOptions::getIntersectionType())
+          {
+          case Triangulation:
+            intersector=new Polyhedron3D2DIntersectorP0P0<MyMeshType,MyMatrixType>(targetMesh,
+                                                                                   srcMesh,
+                                                                                   dimCaracteristic,
+                                                                                   getPrecision(),
+                                                                                   intersectFaces,
+                                                                                   getSplittingPolicy());
+            break;
+          case PointLocator:// switch target and source
+            intersector=new PointLocator3DIntersectorP0P0<MyMeshType,MyMatrixType>(srcMesh,targetMesh,getPrecision());
+            break;
+          default:
+            throw INTERP_KERNEL::Exception("Invalid 3D to 2D intersection type for P0P0 interp specified : must be Triangulation or PointLocator.");
+          }
+      }
+    else
+      throw Exception("Invalid method choosed must be in \"P0P0\".");
+    // create empty maps for all source elements
+    matrix.resize(intersector->getNumberOfRowsOfResMatrix());
+
+    // create BBTree structure
+    // - get bounding boxes
+    double* bboxes = new double[6 * numSrcElems];
+    int* srcElemIdx = new int[numSrcElems];
+    for(unsigned long i = 0; i < numSrcElems ; ++i)
+      {
+        // get source bboxes in right order
+        const BoundingBox* box = srcElems[i]->getBoundingBox();
+        bboxes[6*i+0] = box->getCoordinate(BoundingBox::XMIN);
+        bboxes[6*i+1] = box->getCoordinate(BoundingBox::XMAX);
+        bboxes[6*i+2] = box->getCoordinate(BoundingBox::YMIN);
+        bboxes[6*i+3] = box->getCoordinate(BoundingBox::YMAX);
+        bboxes[6*i+4] = box->getCoordinate(BoundingBox::ZMIN);
+        bboxes[6*i+5] = box->getCoordinate(BoundingBox::ZMAX);
+
+        // source indices have to begin with zero for BBox, I think
+        srcElemIdx[i] = srcElems[i]->getIndex();
+      }
+
+    BBTree<3,ConnType> tree(bboxes, srcElemIdx, 0, numSrcElems, 0.);
+
+    // for each target element, get source elements with which to calculate intersection
+    // - calculate intersection by calling intersectCells
+    for(unsigned long i = 0; i < numTargetElems; ++i)
+      {
+        const BoundingBox* box = targetElems[i]->getBoundingBox();
+        const int targetIdx = targetElems[i]->getIndex();
+
+        // get target bbox in right order
+        double targetBox[6];
+        targetBox[0] = box->getCoordinate(BoundingBox::XMIN);
+        targetBox[1] = box->getCoordinate(BoundingBox::XMAX);
+        targetBox[2] = box->getCoordinate(BoundingBox::YMIN);
+        targetBox[3] = box->getCoordinate(BoundingBox::YMAX);
+        targetBox[4] = box->getCoordinate(BoundingBox::ZMIN);
+        targetBox[5] = box->getCoordinate(BoundingBox::ZMAX);
+
+        std::vector<ConnType> intersectElems;
+
+        tree.getIntersectingElems(targetBox, intersectElems);
+
+        if ( !intersectElems.empty() )
+            intersector->intersectCells(targetIdx, intersectElems, matrix);
+
+      }
+
+    delete [] bboxes;
+    delete [] srcElemIdx;
+
+    DuplicateFacesType::iterator iter;
+    for (iter = intersectFaces.begin(); iter != intersectFaces.end(); ++iter)
+      {
+        if (iter->second.size() > 1)
+          {
+            _duplicate_faces.insert(std::make_pair(iter->first, iter->second));
+          }
+      }
+
+    // free allocated memory
+    int ret=intersector->getNumberOfColsOfResMatrix();
+
+    delete intersector;
+
+    for(unsigned long i = 0 ; i < numSrcElems ; ++i)
+      {
+        delete srcElems[i];
+      }
+    for(unsigned long i = 0 ; i < numTargetElems ; ++i)
+      {
+        delete targetElems[i];
+      }
+    return ret;
+
+  }
+}
+
+#endif
diff --git a/src/INTERP_KERNEL/Interpolation3D2D.cxx b/src/INTERP_KERNEL/Interpolation3D2D.cxx
deleted file mode 100644 (file)
index 4e8cee7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright (C) 2007-2015  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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#include "Interpolation3D2D.hxx"
-
-namespace INTERP_KERNEL
-{
-  /**
-   * Default constructor
-   * 
-   */
-  Interpolation3D2D::Interpolation3D2D()
-  {
-  }
-  Interpolation3D2D::Interpolation3D2D(const InterpolationOptions& io):Interpolation<Interpolation3D2D>(io)
-  {
-  }
-}
diff --git a/src/INTERP_KERNEL/Interpolation3D2D.hxx b/src/INTERP_KERNEL/Interpolation3D2D.hxx
deleted file mode 100644 (file)
index 761c37f..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (C) 2007-2015  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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-
-#ifndef __INTERPOLATION3D2D_HXX__
-#define __INTERPOLATION3D2D_HXX__
-
-#include <set>
-#include <map>
-
-#include "INTERPKERNELDefines.hxx"
-#include "Interpolation.hxx"
-#include "NormalizedUnstructuredMesh.hxx"
-#include "InterpolationOptions.hxx"
-
-namespace INTERP_KERNEL
-{
-  /*!
-   * Contrary to its name this class deals with 2D mesh in source and 3D mesh in target.
-   * The meshdim of 'MyMeshType' in input is ignored that's why 'meshS' and 'meshT'
-   * have the same type.
-   * '_duplicate_faces' attribute stores duplicated faces in the following format.
-   * The key of '_duplicate_faces' represents the 2D cellId that is shared by
-   * more than one 3D target cell, and the value of '_duplicate_faces'
-   * the 3D target cells. The size of the value of '_duplicate_faces' is more than or equal to 2.
-   */
-  class Interpolation3D2D : public Interpolation<Interpolation3D2D>
-  {
-  public:
-    typedef std::map<int,std::set<int> > DuplicateFacesType;
-
-    INTERPKERNEL_EXPORT Interpolation3D2D();
-    INTERPKERNEL_EXPORT Interpolation3D2D(const InterpolationOptions& io);
-    template<class MyMeshType, class MyMatrixType>
-    int interpolateMeshes(const MyMeshType& srcMesh,
-                          const MyMeshType& targetMesh,
-                          MyMatrixType& matrix,
-                          const std::string& method);
-    INTERPKERNEL_EXPORT DuplicateFacesType retrieveDuplicateFaces() const { return _duplicate_faces; }
-  private:
-    SplittingPolicy _splitting_policy;
-    DuplicateFacesType _duplicate_faces;
-  };
-}
-
-#endif
diff --git a/src/INTERP_KERNEL/Interpolation3D2D.txx b/src/INTERP_KERNEL/Interpolation3D2D.txx
deleted file mode 100644 (file)
index 29d9ec2..0000000
+++ /dev/null
@@ -1,190 +0,0 @@
-// Copyright (C) 2007-2015  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, 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
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-// Lesser General Public License for more details.
-//
-// You should have received a copy of the GNU Lesser General Public
-// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-#ifndef __INTERPOLATION3D2D_TXX__
-#define __INTERPOLATION3D2D_TXX__
-
-#include "Interpolation3D2D.hxx"
-#include "Interpolation.txx"
-#include "MeshElement.txx"
-#include "TransformedTriangle.hxx"
-#include "Polyhedron3D2DIntersectorP0P0.txx"
-#include "PointLocator3DIntersectorP0P0.txx"
-#include "PolyhedronIntersectorP0P1.txx"
-#include "PointLocator3DIntersectorP0P1.txx"
-#include "PolyhedronIntersectorP1P0.txx"
-#include "PolyhedronIntersectorP1P0Bary.txx"
-#include "PointLocator3DIntersectorP1P0.txx"
-#include "PolyhedronIntersectorP1P1.txx"
-#include "PointLocator3DIntersectorP1P1.txx"
-#include "Log.hxx"
-
-#include "BBTree.txx"
-
-namespace INTERP_KERNEL
-{
-  /**
-   * Calculates the matrix of volumes of intersection between the elements of srcMesh and the elements of targetMesh.
-   * The calculation is done in two steps. First a filtering process reduces the number of pairs of elements for which the
-   * calculation must be carried out by eliminating pairs that do not intersect based on their bounding boxes. Then, the 
-   * volume of intersection is calculated by an object of type Intersector3D for the remaining pairs, and entered into the
-   * intersection matrix. 
-   * 
-   * The matrix is partially sparse : it is a vector of maps of integer - double pairs. 
-   * It can also be an INTERP_KERNEL::Matrix object.
-   * The length of the vector is equal to the number of target elements - for each target element there is a map, regardless
-   * of whether the element intersects any source elements or not. But in the maps there are only entries for those source elements
-   * which have a non-zero intersection volume with the target element. The vector has indices running from 
-   * 0 to (nb target elements - 1), meaning that the map for target element i is stored at index i - 1. In the maps, however,
-   * the indexing is more natural : the intersection volume of the target element i with source element j is found at matrix[i-1][j].
-   * 
-
-   * @param srcMesh     3DSurf source mesh (meshDim=2,spaceDim=3)
-   * @param targetMesh  3D target mesh, containing only tetraedra
-   * @param matrix      matrix in which the result is stored
-   *
-   */
-  template<class MyMeshType, class MyMatrixType>
-  int Interpolation3D2D::interpolateMeshes(const MyMeshType& srcMesh,
-                                           const MyMeshType& targetMesh,
-                                           MyMatrixType& matrix,
-                                           const std::string& method)
-  {
-    typedef typename MyMeshType::MyConnType ConnType;
-    // create MeshElement objects corresponding to each element of the two meshes
-    const unsigned long numSrcElems = srcMesh.getNumberOfElements();
-    const unsigned long numTargetElems = targetMesh.getNumberOfElements();
-
-    LOG(2, "Source mesh has " << numSrcElems << " elements and target mesh has " << numTargetElems << " elements ");
-
-    std::vector<MeshElement<ConnType>*> srcElems(numSrcElems);
-    std::vector<MeshElement<ConnType>*> targetElems(numTargetElems);
-
-    std::map<MeshElement<ConnType>*, int> indices;
-    DuplicateFacesType intersectFaces;
-
-    for(unsigned long i = 0 ; i < numSrcElems ; ++i)
-      srcElems[i] = new MeshElement<ConnType>(i, srcMesh);       
-
-    for(unsigned long i = 0 ; i < numTargetElems ; ++i)
-      targetElems[i] = new MeshElement<ConnType>(i, targetMesh);
-
-    Intersector3D<MyMeshType,MyMatrixType>* intersector=0;
-    std::string methC = InterpolationOptions::filterInterpolationMethod(method);
-    const double dimCaracteristic = CalculateCharacteristicSizeOfMeshes(srcMesh, targetMesh, InterpolationOptions::getPrintLevel());
-    if(methC=="P0P0")
-      {
-        switch(InterpolationOptions::getIntersectionType())
-          {
-          case Triangulation:
-            intersector=new Polyhedron3D2DIntersectorP0P0<MyMeshType,MyMatrixType>(targetMesh,
-                                                                                   srcMesh,
-                                                                                   dimCaracteristic,
-                                                                                   getPrecision(),
-                                                                                   intersectFaces,
-                                                                                   getSplittingPolicy());
-            break;
-          case PointLocator:// switch target and source
-            intersector=new PointLocator3DIntersectorP0P0<MyMeshType,MyMatrixType>(srcMesh,targetMesh,getPrecision());
-            break;
-          default:
-            throw INTERP_KERNEL::Exception("Invalid 3D to 2D intersection type for P0P0 interp specified : must be Triangulation or PointLocator.");
-          }
-      }
-    else
-      throw Exception("Invalid method choosed must be in \"P0P0\".");
-    // create empty maps for all source elements
-    matrix.resize(intersector->getNumberOfRowsOfResMatrix());
-
-    // create BBTree structure
-    // - get bounding boxes
-    double* bboxes = new double[6 * numSrcElems];
-    int* srcElemIdx = new int[numSrcElems];
-    for(unsigned long i = 0; i < numSrcElems ; ++i)
-      {
-        // get source bboxes in right order
-        const BoundingBox* box = srcElems[i]->getBoundingBox();
-        bboxes[6*i+0] = box->getCoordinate(BoundingBox::XMIN);
-        bboxes[6*i+1] = box->getCoordinate(BoundingBox::XMAX);
-        bboxes[6*i+2] = box->getCoordinate(BoundingBox::YMIN);
-        bboxes[6*i+3] = box->getCoordinate(BoundingBox::YMAX);
-        bboxes[6*i+4] = box->getCoordinate(BoundingBox::ZMIN);
-        bboxes[6*i+5] = box->getCoordinate(BoundingBox::ZMAX);
-
-        // source indices have to begin with zero for BBox, I think
-        srcElemIdx[i] = srcElems[i]->getIndex();
-      }
-
-    BBTree<3,ConnType> tree(bboxes, srcElemIdx, 0, numSrcElems, 0.);
-
-    // for each target element, get source elements with which to calculate intersection
-    // - calculate intersection by calling intersectCells
-    for(unsigned long i = 0; i < numTargetElems; ++i)
-      {
-        const BoundingBox* box = targetElems[i]->getBoundingBox();
-        const int targetIdx = targetElems[i]->getIndex();
-
-        // get target bbox in right order
-        double targetBox[6];
-        targetBox[0] = box->getCoordinate(BoundingBox::XMIN);
-        targetBox[1] = box->getCoordinate(BoundingBox::XMAX);
-        targetBox[2] = box->getCoordinate(BoundingBox::YMIN);
-        targetBox[3] = box->getCoordinate(BoundingBox::YMAX);
-        targetBox[4] = box->getCoordinate(BoundingBox::ZMIN);
-        targetBox[5] = box->getCoordinate(BoundingBox::ZMAX);
-
-        std::vector<ConnType> intersectElems;
-
-        tree.getIntersectingElems(targetBox, intersectElems);
-
-        if ( !intersectElems.empty() )
-            intersector->intersectCells(targetIdx, intersectElems, matrix);
-
-      }
-
-    delete [] bboxes;
-    delete [] srcElemIdx;
-
-    DuplicateFacesType::iterator iter;
-    for (iter = intersectFaces.begin(); iter != intersectFaces.end(); ++iter)
-      {
-        if (iter->second.size() > 1)
-          {
-            _duplicate_faces.insert(std::make_pair(iter->first, iter->second));
-          }
-      }
-
-    // free allocated memory
-    int ret=intersector->getNumberOfColsOfResMatrix();
-
-    delete intersector;
-
-    for(unsigned long i = 0 ; i < numSrcElems ; ++i)
-      {
-        delete srcElems[i];
-      }
-    for(unsigned long i = 0 ; i < numTargetElems ; ++i)
-      {
-        delete targetElems[i];
-      }
-    return ret;
-
-  }
-}
-
-#endif
index 8dad02890b6d1684c53c7e6656f1adf9b0983c4b..becba486098bd1554a1e58ab7ed93e81a7a16b52 100644 (file)
@@ -34,7 +34,7 @@
 #include "Interpolation3D.txx"
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation2D1D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "InterpolationCU.txx"
 #include "InterpolationCC.txx"
 
@@ -520,9 +520,9 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
     {
       MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
-      INTERP_KERNEL::Interpolation3D2D interpolation(*this);
+      INTERP_KERNEL::Interpolation2D3D interpolation(*this);
       nbCols=interpolation.interpolateMeshes(source_mesh_wrapper,target_mesh_wrapper,_matrix,method);
-      INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
+      INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
       if(!duplicateFaces.empty())
         {
           std::ostringstream oss; oss << "An unexpected situation happend ! For the following 2D Cells are part of edges shared by 3D cells :\n";
@@ -538,13 +538,13 @@ int MEDCouplingRemapper::prepareInterpKernelOnlyUU()
     {
       MEDCouplingNormalizedUnstructuredMesh<3,3> source_mesh_wrapper(src_mesh);
       MEDCouplingNormalizedUnstructuredMesh<3,3> target_mesh_wrapper(target_mesh);
-      INTERP_KERNEL::Interpolation3D2D interpolation(*this);
+      INTERP_KERNEL::Interpolation2D3D interpolation(*this);
       std::vector<std::map<int,double> > matrixTmp;
       std::string revMethod(BuildMethodFrom(trgMeth,srcMeth));
       nbCols=interpolation.interpolateMeshes(target_mesh_wrapper,source_mesh_wrapper,matrixTmp,revMethod);
       ReverseMatrix(matrixTmp,nbCols,_matrix);
       nbCols=matrixTmp.size();
-      INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
+      INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces=interpolation.retrieveDuplicateFaces();
       if(!duplicateFaces.empty())
         {
           std::ostringstream oss; oss << "An unexpected situation happend ! For the following 2D Cells are part of edges shared by 3D cells :\n";
index f42235c44829a478084fdc8abb904557c25b3035..5cb54cde8c886b769aa2a278dff64089006d44a5 100644 (file)
@@ -28,7 +28,7 @@
 #include "MEDCouplingBasicsTestData1.hxx"
 
 #include "Interpolation2D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "Interpolation2D1D.txx"
 #include "MEDCouplingNormalizedUnstructuredMesh.txx"
 #include "MEDCouplingNormalizedCartesianMesh.txx"
@@ -1657,7 +1657,7 @@ void MEDCouplingBasicsTest::test2D1DMeshesIntersection(MEDCouplingUMesh *sourceM
   LOG(1, "length =  " << surf <<"  correctLength = " << correctLength );
   CPPUNIT_ASSERT_DOUBLES_EQUAL(correctLength, length, prec * std::max(correctLength, length));
 
-  INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+  INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
   int duplicateFacesNbr = duplicateFaces.size();
   LOG(1, "duplicateFacesNbr =  " << duplicateFacesNbr <<"  correctDuplicateFacesNbr = " <<  correctDuplicateFacesNbr);
   CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr);
@@ -1681,7 +1681,7 @@ void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceM
 {
   MEDCouplingNormalizedUnstructuredMesh<3,3> sourceWrapper(sourceMesh);
   MEDCouplingNormalizedUnstructuredMesh<3,3> targetWrapper(targetMesh);
-  INTERP_KERNEL::Interpolation3D2D myInterpolator;
+  INTERP_KERNEL::Interpolation2D3D myInterpolator;
   myInterpolator.setPrecision(1e-12);
   const double prec = 1.0e-5;
   IntersectionMatrix matrix;
@@ -1698,7 +1698,7 @@ void MEDCouplingBasicsTest::test3D2DMeshesIntersection(MEDCouplingUMesh *sourceM
     LOG(1, "surf =  " << surf <<"  correctSurf = " << correctSurf );
     CPPUNIT_ASSERT_DOUBLES_EQUAL(correctSurf, surf, prec * std::max(correctSurf, surf));
 
-    INTERP_KERNEL::Interpolation3D2D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
+    INTERP_KERNEL::Interpolation2D3D::DuplicateFacesType duplicateFaces = myInterpolator.retrieveDuplicateFaces();
     int duplicateFacesNbr = duplicateFaces.size();
     LOG(1, "duplicateFacesNbr =  " << duplicateFacesNbr <<"  correctDuplicateFacesNbr = " <<  correctDuplicateFacesNbr);
     CPPUNIT_ASSERT_EQUAL(correctDuplicateFacesNbr, duplicateFacesNbr);
index f50b74de97f59751a06ada86cf5fd8111bd8a224..4b2ba7b81d38a9427a7b865e83102775a647a2a8 100644 (file)
@@ -27,7 +27,7 @@
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation3D.txx"
 #include "Interpolation2D1D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "InterpolationCC.txx"
 #include "InterpolationCU.txx"
 #include "Interpolation2DCurve.hxx"
@@ -2302,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);
@@ -2427,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 };
@@ -2463,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);
index 8b8c50f610a4ff9398cf3aad59a8c1e887e86db7..ea878e8fe4c1932a1e2b2a9cf2ed1814f533ad23 100644 (file)
@@ -29,7 +29,7 @@
 #include "Interpolation2D.txx"
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation3D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "Interpolation2D1D.txx"
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingNormalizedUnstructuredMesh.txx"
@@ -157,7 +157,7 @@ namespace ParaMEDMEM
       {
         MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(distant_supportC);
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(source_supportC);
-        INTERP_KERNEL::Interpolation3D2D interpolator (*this);
+        INTERP_KERNEL::Interpolation2D3D interpolator (*this);
         interpolator.interpolateMeshes(target_wrapper,source_wrapper,surfaces,interpMethod);
         target_wrapper.releaseTempArrays();
         source_wrapper.releaseTempArrays();
index 0607838330ff4bbb9b6d81ad6617182a5fc059b5..9be3646f257cd437121b5cd02616166a059f9b87 100644 (file)
@@ -29,7 +29,7 @@
 #include "Interpolation2D.txx"
 #include "Interpolation3DSurf.hxx"
 #include "Interpolation3D.txx"
-#include "Interpolation3D2D.txx"
+#include "Interpolation2D3D.txx"
 #include "Interpolation2D1D.txx"
 #include "MEDCouplingUMesh.hxx"
 #include "MEDCouplingNormalizedUnstructuredMesh.txx"
@@ -147,7 +147,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(trgC);
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC);
         
-        INTERP_KERNEL::Interpolation3D2D interpolator (*this);
+        INTERP_KERNEL::Interpolation2D3D interpolator (*this);
         colSize=interpolator.interpolateMeshes(source_wrapper,target_wrapper,sparse_matrix_part,interpMethod);
       }
     else if ( src->getMeshDimension() == 3 && trg->getMeshDimension() == 2
@@ -156,7 +156,7 @@ namespace ParaMEDMEM
         MEDCouplingNormalizedUnstructuredMesh<3,3> target_wrapper(trgC);
         MEDCouplingNormalizedUnstructuredMesh<3,3> source_wrapper(srcC);
         
-        INTERP_KERNEL::Interpolation3D2D interpolator (*this);
+        INTERP_KERNEL::Interpolation2D3D interpolator (*this);
         vector<SparseDoubleVec > matrixTranspose;
         colSize=interpolator.interpolateMeshes(target_wrapper,source_wrapper,sparse_matrix_part,interpMethod);//not a bug target in source.
         TransposeMatrix(matrixTranspose,colSize,sparse_matrix_part);