From 8480f3898c93d853bd17760270017cf6b97a451f Mon Sep 17 00:00:00 2001 From: vbd Date: Mon, 25 Aug 2008 13:40:29 +0000 Subject: [PATCH] 1/Correction avoiding acos(1.0000000000001) 2/Replacing HUGE with the more correct std::numeric_limits::max() --- src/INTERP_KERNEL/BBTree.txx | 6 +++--- src/INTERP_KERNEL/Geometric2D/Makefile.am | 15 +++++++++++++++ src/INTERP_KERNEL/InterpolationUtils.hxx | 15 +++++++++++---- src/INTERP_KERNEL/Makefile.am | 23 +++++++++++++++++------ src/INTERP_KERNEL/PlanarIntersector.txx | 11 ++++++----- src/INTERP_KERNEL/PointLocator.cxx | 2 +- src/INTERP_KERNEL/PointLocatorAlgos.txx | 5 +++-- src/INTERP_KERNEL/Test/Makefile.am | 6 +++++- src/ParaMEDMEM/ElementLocator.cxx | 11 ++++++----- src/ParaMEDMEM/ICoCoMEDField.cxx | 1 + 10 files changed, 68 insertions(+), 27 deletions(-) diff --git a/src/INTERP_KERNEL/BBTree.txx b/src/INTERP_KERNEL/BBTree.txx index 597a2f08e..4c9a851b4 100644 --- a/src/INTERP_KERNEL/BBTree.txx +++ b/src/INTERP_KERNEL/BBTree.txx @@ -5,7 +5,7 @@ #include #include -#include // for HUGE constant +#include 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::max(); + double min_right= std::numeric_limits::max(); for (int i=0; i1.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 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::max(); + bb[1]=-std::numeric_limits::max(); + bb[2]=std::numeric_limits::max(); + bb[3]=-std::numeric_limits::max(); + bb[4]=std::numeric_limits::max(); + bb[5]=-std::numeric_limits::max(); + for (int i=0; i +#include namespace INTERP_KERNEL { @@ -42,8 +43,8 @@ namespace INTERP_KERNEL //initializing bounding box limits for(int idim=0; idim::max(); + bbox[2*SPACEDIM*ibox+2*idim+1] = -std::numeric_limits::max(); } //updating the bounding box with each node of the element for (int j=0; j::max(); + bb[2*idim+1] = -std::numeric_limits::max(); } for (ConnType i=0; i::max(); for(int idim=0; idim PointLocator::locate(const double* x) +std::list PointLocator::locate(const double* x) { return _point_locator->locates(x); } diff --git a/src/INTERP_KERNEL/PointLocatorAlgos.txx b/src/INTERP_KERNEL/PointLocatorAlgos.txx index ffe41b600..e4952dd99 100644 --- a/src/INTERP_KERNEL/PointLocatorAlgos.txx +++ b/src/INTERP_KERNEL/PointLocatorAlgos.txx @@ -5,6 +5,7 @@ #include "CellModel.hxx" #include "BBTree.txx" #include +#include namespace INTERP_KERNEL{ @@ -39,8 +40,8 @@ namespace INTERP_KERNEL{ { for (int idim=0; idim::max(); + _bb[2*(i*SPACEDIM+idim)+1]=-std::numeric_limits::max(); } for (int index= conn_index[i]; index < conn_index[i+1];index++) { diff --git a/src/INTERP_KERNEL/Test/Makefile.am b/src/INTERP_KERNEL/Test/Makefile.am index 3ade2cabc..356dec9e1 100644 --- a/src/INTERP_KERNEL/Test/Makefile.am +++ b/src/INTERP_KERNEL/Test/Makefile.am @@ -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= \ diff --git a/src/ParaMEDMEM/ElementLocator.cxx b/src/ParaMEDMEM/ElementLocator.cxx index a3e1ee4c7..c91753534 100644 --- a/src/ParaMEDMEM/ElementLocator.cxx +++ b/src/ParaMEDMEM/ElementLocator.cxx @@ -11,8 +11,9 @@ #include "MEDMEM_Meshing.hxx" #include +#include 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::max(); + elem_bb[i*2+1]=-std::numeric_limits::max(); } for (int inode=conn_index[ielem]; inode::max(); + minmax[idim*2+1]=-std::numeric_limits::max(); } for (int i=0; i