]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
1/Correction avoiding acos(1.0000000000001)
authorvbd <vbd>
Mon, 25 Aug 2008 13:40:29 +0000 (13:40 +0000)
committervbd <vbd>
Mon, 25 Aug 2008 13:40:29 +0000 (13:40 +0000)
2/Replacing HUGE with the more correct
std::numeric_limits<double>::max()

src/INTERP_KERNEL/BBTree.txx
src/INTERP_KERNEL/Geometric2D/Makefile.am
src/INTERP_KERNEL/InterpolationUtils.hxx
src/INTERP_KERNEL/Makefile.am
src/INTERP_KERNEL/PlanarIntersector.txx
src/INTERP_KERNEL/PointLocator.cxx
src/INTERP_KERNEL/PointLocatorAlgos.txx
src/INTERP_KERNEL/Test/Makefile.am
src/ParaMEDMEM/ElementLocator.cxx
src/ParaMEDMEM/ICoCoMEDField.cxx

index 597a2f08ec982664d5ad4636b9fff642e32e5cd7..4c9a851b4c4c646638677f08beea10ab206af895 100644 (file)
@@ -5,7 +5,7 @@
 #include <algorithm>
 
 #include <iostream>
-#include <math.h> // for HUGE constant
+#include <limits>
 const int MIN_NB_ELEMS =15;
 const int MAX_LEVEL=20;
 
@@ -60,8 +60,8 @@ public:
  
     new_elems_left.reserve(nbelems/2+1);
     new_elems_right.reserve(nbelems/2+1);
-    double max_left=-HUGE;
-    double min_right=HUGE;
+    double max_left = -std::numeric_limits<double>::max();
+    double min_right=  std::numeric_limits<double>::max();
     for (int i=0; i<nbelems;i++)
       {
         int elem;
index 65a017b53c26fcd3fd47f759f3548fde94da6505..e7a41cf117c8c4cc1c2ed890bf9f75259862e208 100644 (file)
@@ -42,4 +42,19 @@ ElementaryEdge.cxx   \
 Node.cxx             \
 QuadraticPolygon.cxx
 
+salomeinclude_HEADERS = \
+AbstractEdge.hxx     \
+Bounds.hxx           \
+Precision.hxx        \
+ComposedEdge.hxx     \
+EdgeArcCircle.hxx    \
+Edge.hxx             \
+EdgeInfLin.hxx       \
+EdgeLin.hxx          \
+ElementaryEdge.hxx   \
+Node.hxx             \
+QuadraticPolygon.hxx \
+ComposedEdgeWithIt.hxx \
+Edge.txx
+
 libInterpGeometric2DAlg_la_CPPFLAGS = -I$(srcdir)/..
index 936bd6c4f40a2dfa0bcdfd148f5f61724d3ef6b4..d9544d1e1bf5cffbd7f2b1702b610d80d75b900f 100644 (file)
@@ -103,10 +103,14 @@ namespace INTERP_KERNEL
     double N=P1_P2*P1_P2+P3_P1*P3_P1-P2_P3*P2_P3;
     double D=2.0*P1_P2*P3_P1;
     double COS=N/D;
+               if (COS>1.0) COS=1.0;
+               if (COS<-1.0) COS=-1.0;
     Vect.push_back(COS);
     double V=mon_determinant(P_2,P_3,P_1);
     double D_1=P1_P2*P3_P1;
     double SIN=V/D_1;
+               if (SIN>1.0) SIN=1.0;
+               if (SIN<-1.0) SIN=-1.0;
     Vect.push_back(SIN);
        
     return Vect;
@@ -372,10 +376,13 @@ namespace INTERP_KERNEL
   template<int DIM, NumberingPolicy numPol, class MyMeshType>
   inline void getElemBB(double* bb, const double *coordsOfMesh, int iP, int nb_nodes)
   {
-    bb[0]=HUGE;bb[1]=-HUGE;
-    bb[2]=HUGE;bb[3]=-HUGE;
-    bb[4]=HUGE;bb[5]=-HUGE;
-              
+    bb[0]=std::numeric_limits<double>::max();
+               bb[1]=-std::numeric_limits<double>::max();
+               bb[2]=std::numeric_limits<double>::max();
+               bb[3]=-std::numeric_limits<double>::max();
+               bb[4]=std::numeric_limits<double>::max();
+               bb[5]=-std::numeric_limits<double>::max();
+               
     for (int i=0; i<nb_nodes; i++)
       {
         double x = coordsOfMesh[3*(iP+i)];
index a2c9f5684c1b6e3acf6be0f62169e88a69e22bfd..a4a1703b893c707a80fa81b6c89fcdbe83177072 100644 (file)
@@ -40,12 +40,23 @@ lib_LTLIBRARIES= libinterpkernel.la
 
 
 salomeinclude_HEADERS = \
-Interpolation.hxx\
-Interpolation3D.hxx\
-Interpolation2D.hxx\
-Interpolation3DSurf.hxx\
-Remapper.hxx\
-PointLocator.hxx
+BoundingBox.hxx             IntersectorTetra.hxx               Remapper.hxx \
+ConvexIntersector.hxx       Log.hxx                            TargetIntersector.hxx\
+Geometric2DIntersector.hxx  MEDNormalizedUnstructuredMesh.hxx  TetraAffineTransform.hxx\
+InterpKernelMatrix.hxx      MeshElement.hxx                    TransformedTriangle.hxx\
+Interpolation2D.hxx         MeshRegion.hxx                     TransformedTriangle_inline.hxx\
+Interpolation3D.hxx         MeshUtils.hxx                      TranslationRotationMatrix.hxx\
+Interpolation3DSurf.hxx     NormalizedUnstructuredMesh.hxx     TriangulationIntersector.hxx\
+Interpolation.hxx           PlanarIntersector.hxx              VectorUtils.hxx\
+InterpolationPlanar.hxx     PointLocator.hxx                   VTKNormalizedUnstructuredMesh.hxx\
+InterpolationUtils.hxx      PolygonAlgorithms.hxx\
+IntersectorHexa.hxx         RegionNode.hxx\
+BBTree.txx                  InterpolationPlanar.txx            PlanarIntersector.txx\
+ConvexIntersector.txx       IntersectorHexa.txx                PointLocatorAlgos.txx\
+Geometric2DIntersector.txx  IntersectorTetra.txx               PolygonAlgorithms.txx\
+Interpolation2D.txx         MEDNormalizedUnstructuredMesh.txx  TriangulationIntersector.txx\
+Interpolation3DSurf.txx     MeshElement.txx                    VTKNormalizedUnstructuredMesh.txx\
+Interpolation3D.txx         MeshRegion.txx
 
 # Libraries targets
 
index 122c29e4a321424754f48f18838c697406674c92..f37facc5046167de2a8f192678c8e68a266e6346 100644 (file)
@@ -6,6 +6,7 @@
 #include "TranslationRotationMatrix.hxx"
 
 #include <iostream>
+#include <limits>
 
 namespace INTERP_KERNEL
 {
@@ -42,8 +43,8 @@ namespace INTERP_KERNEL
         //initializing bounding box limits
         for(int idim=0; idim<SPACEDIM; idim++)
           {
-            bbox[2*SPACEDIM*ibox+2*idim]   =  HUGE;
-            bbox[2*SPACEDIM*ibox+2*idim+1] = -HUGE;
+            bbox[2*SPACEDIM*ibox+2*idim]   =  std::numeric_limits<double>::max();
+            bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits<double>::max();
           }
         //updating the bounding box with each node of the element
         for (int j=0; j<nb_nodes_per_elem; j++)
@@ -72,8 +73,8 @@ namespace INTERP_KERNEL
     //initializing bounding box limits
     for(int idim=0; idim<SPACEDIM; idim++)
       {
-        bb[2*idim  ] =  HUGE;
-        bb[2*idim+1] = -HUGE;
+        bb[2*idim  ] =  std::numeric_limits<double>::max();
+        bb[2*idim+1] = -std::numeric_limits<double>::max();
       }
   
     for (ConnType i=0; i<nb_nodes; i++)
@@ -103,7 +104,7 @@ namespace INTERP_KERNEL
     long size = bbox.size()/(2*SPACEDIM);
     for (int i=0; i<size; i++)
       {
-        double max=-HUGE;
+        double max=- std::numeric_limits<double>::max();
         for(int idim=0; idim<SPACEDIM; idim++)
           {            
             double Dx=bbox[i*2*SPACEDIM+1+2*idim]-bbox[i*2*SPACEDIM+2*idim];
index 4b3da54d853fe798dbe871b115643f41673a271c..019419f3f48765560aa99eb5152cd116131ff89c 100644 (file)
@@ -28,7 +28,7 @@ namespace INTERP_KERNEL {
     delete _point_locator;
   }
 
-  std::list<int> PointLocator::locate(const double* x)
+std::list<int> PointLocator::locate(const double* x)
   {
     return _point_locator->locates(x);
   }
index ffe41b600c2f749e8f358cbf92f9df356c45ca72..e4952dd99ce5b988ee236c46dc3a38c035eb46ed 100644 (file)
@@ -5,6 +5,7 @@
 #include "CellModel.hxx"
 #include "BBTree.txx"
 #include <list>
+#include <limits>
 
 namespace INTERP_KERNEL{
 
@@ -39,8 +40,8 @@ namespace INTERP_KERNEL{
         {
           for (int idim=0; idim<SPACEDIM; idim++)
             {
-              _bb[2*(i*SPACEDIM+idim)]=HUGE;
-              _bb[2*(i*SPACEDIM+idim)+1]=-HUGE;
+              _bb[2*(i*SPACEDIM+idim)]=std::numeric_limits<double>::max();
+              _bb[2*(i*SPACEDIM+idim)+1]=-std::numeric_limits<double>::max();
             }
           for (int index= conn_index[i]; index < conn_index[i+1];index++)
             {
index 3ade2cabc619f8701239ab8b84294951d0099319..356dec9e1257f4f253ebf07b9d9a6f792ef78380 100644 (file)
@@ -32,13 +32,17 @@ salomeinclude_HEADERS = CppUnitTest.hxx \
                 MultiElementTetraTests.hxx \
                 HexaTests.hxx \
                 MeshTestToolkit.hxx \
+                MeshTestToolkit.txx \
                 BBTreeTest.hxx \
                 RemapperTest.hxx \
                 SingleElementPlanarTests.hxx \
                 MultiElement2DTests.hxx \
-                InterpolationPlanarTestSuite.hxx \
+                InterpolationPlanarTestSuite.hxx       \
+          PointLocatorTest.hxx \
+                MEDMeshMaker.hxx \
                 QuadraticPlanarInterpTest.hxx
 
+
 EXTRA_DIST += BasicMainTest.hxx
 
 dist_libInterpKernelTest_la_SOURCES= \
index a3e1ee4c7315cd72b2d30b8bd1a2800e3b0694fd..c91753534e63ae825aad789a5073c8cfd525c4b5 100644 (file)
@@ -11,8 +11,9 @@
 #include "MEDMEM_Meshing.hxx"
 
 #include <set>
+#include <limits>
 using namespace std;
-//const double HUGE=1e200;
+
 
 namespace ParaMEDMEM 
 { 
@@ -76,8 +77,8 @@ void ElementLocator::exchangeMesh(int idistantrank, MEDMEM::MESH*& distant_mesh,
      {
        for (int i=0; i<dim; i++)
         {
-          elem_bb[i*2]=HUGE;
-          elem_bb[i*2+1]=-HUGE;
+          elem_bb[i*2]=std::numeric_limits<double>::max();
+          elem_bb[i*2+1]=-std::numeric_limits<double>::max();
         }
        for (int inode=conn_index[ielem]; inode<conn_index[ielem+1]; inode++)
         {
@@ -131,8 +132,8 @@ void ElementLocator::_computeBoundingBoxes()
   double * minmax=new double [2*dim];
   for (int idim=0; idim<dim; idim++)
   {
-    minmax[idim*2]=HUGE;
-    minmax[idim*2+1]=-HUGE;
+    minmax[idim*2]=std::numeric_limits<double>::max();
+    minmax[idim*2+1]=-std::numeric_limits<double>::max();
   } 
   for (int i=0; i<nbnodes; i++)
     for (int idim=0; idim<dim;idim++)
index ba312811b6d3efe4320980fbae54bb0d3a9f9db9..456723dec46ed9be10c613b40b85ea99125d75b1 100644 (file)
@@ -69,6 +69,7 @@ namespace ICoCo
                                        default:
                                                throw MEDMEM::MEDEXCEPTION("incompatible Trio field - wrong nb of nodes per elem");
                                        }
+                               break;
                        default:
                                throw MEDMEM::MEDEXCEPTION("incompatible Trio field - wrong mesh dimension");
                        }