Salome HOME
Add test for .mesh file format
[tools/medcoupling.git] / src / INTERP_KERNEL / Interpolation.txx
old mode 100644 (file)
new mode 100755 (executable)
index ee85877..33848df
@@ -1,9 +1,9 @@
-// Copyright (C) 2007-2013  CEA/DEN, EDF R&D
+// Copyright (C) 2007-2024  CEA, EDF
 //
 // 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
@@ -29,10 +29,10 @@ namespace INTERP_KERNEL
 { 
   template<class TrueMainInterpolator>
   template<class MyMeshType, class MatrixType>
-  int Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method)
+  typename MyMeshType::MyConnType Interpolation<TrueMainInterpolator>::fromToIntegralUniform(bool fromTo, const MyMeshType& mesh, MatrixType& result, const std::string& method)
   {
     typedef typename MyMeshType::MyConnType ConnType;
-    int ret=-1;
+    ConnType ret=-1;
     if(method=="P0")
       {
         IntegralUniformIntersectorP0<MyMeshType,MatrixType> intersector(mesh,InterpolationOptions::getMeasureAbsStatus());
@@ -59,9 +59,10 @@ namespace INTERP_KERNEL
   double Interpolation<TrueMainInterpolator>::CalculateCharacteristicSizeOfMeshes(const MyMeshType& myMeshS, const MyMeshType& myMeshT, const int printLevel)
   {
     static const int SPACEDIM=MyMeshType::MY_SPACEDIM;
+    typedef typename MyMeshType::MyConnType ConnType;
 
-    long nbMailleS=myMeshS.getNumberOfElements();
-    long nbMailleT=myMeshT.getNumberOfElements();
+    ConnType nbMailleS=myMeshS.getNumberOfElements();
+    ConnType nbMailleT=myMeshT.getNumberOfElements();
 
     /**************************************************/
     /* Search the characteristic size of the meshes   */
@@ -73,13 +74,13 @@ namespace INTERP_KERNEL
     if(nbMailleS!=0)
       {
         diagonalS=getDistanceBtw2Pts<SPACEDIM>(BoxS+SPACEDIM,BoxS);
-        dimCaracteristicS=diagonalS/nbMailleS;
+        dimCaracteristicS=diagonalS/(double)nbMailleS;
       }
     double diagonalT,dimCaracteristicT=std::numeric_limits<double>::max();
     if(nbMailleT!=0)
       {
         diagonalT=getDistanceBtw2Pts<SPACEDIM>(BoxT+SPACEDIM,BoxT);
-        dimCaracteristicT=diagonalT/nbMailleT;
+        dimCaracteristicT=diagonalT/(double)nbMailleT;
       }
     if (printLevel>=1)
       {