Salome HOME
Merge branch 'BR_2017_PORTING' into BR_2018_V8_5
[modules/hydro.git] / src / HYDROData / HYDROData_DTM.cxx
index 3313bfe03501bdf03c81fd6b2206dbd141986751..207530f8df59e3a0c37bc80081e3315a3197bbcc 100644 (file)
@@ -58,6 +58,7 @@
 #include <TopTools_ListIteratorOfListOfShape.hxx>
 #include <TopTools_SequenceOfShape.hxx>
 #include <assert.h>
+#include <float.h>
 
 IMPLEMENT_STANDARD_RTTIEXT( HYDROData_DTM, HYDROData_Bathymetry )
 
@@ -98,7 +99,7 @@ HYDROData_DTM::CurveUZ HYDROData_DTM::CurveUZ::operator + ( const CurveUZ& c ) c
   {
     std::cout << "Warning: different number of points in curves: " << n << ", " << n1 << std::endl;
   }
-  int q = std::min(n, n1);
+  int q = n < n1 ? n : n1;
   res.reserve( q );
   for( int i=0; i<q; i++ )
   {
@@ -428,7 +429,7 @@ void HYDROData_DTM::GetProperties( const Handle(HYDROData_Profile)& theProfile,
   HYDROData_Profile::ProfilePoints points = theProfile->GetProfilePoints();
   int lo = points.Lower();
   int up = points.Upper();
-  theZMin = std::numeric_limits<double>::max();
+  theZMin = DBL_MAX;
   theZMax = -theZMin;
   for( int i=lo; i<=up; i++ )
   {
@@ -656,7 +657,7 @@ std::vector<Handle(Geom2d_Curve)> HYDROData_DTM::ProfileToParametric(
 
 bool CalcMidWidth( const std::set<double>& intersections, double& theMid, double& theWid )
 {
-  double umin = std::numeric_limits<double>::max(),
+  double umin = DBL_MAX,
          umax = -umin;
 
   size_t n = intersections.size();
@@ -684,7 +685,7 @@ void HYDROData_DTM::ProfileDiscretization( const Handle(HYDROData_Profile)& theP
                                            int& intersection_nb,
                                            double theTolerance)
 {
-  double aDblMax = std::numeric_limits<double>::max(),
+  double aDblMax = DBL_MAX,
          aUMin = aDblMax,
          aUMax = -aUMin,
          aVMax = 1000000;
@@ -823,21 +824,21 @@ void HYDROData_DTM::CurveTo3D( const Handle(Geom2d_BSplineCurve)& theHydraulicAx
       thePoints.push_back( it->second );
 }
 
-inline double max( double a, double b )
-{
-  if( a>b )
-    return a;
-  else
-    return b;
-}
-
-inline double min( double a, double b )
-{
-  if( a<b )
-    return a;
-  else
-    return b;
-}
+//inline double max( double a, double b )
+//{
+//  if( a>b )
+//    return a;
+//  else
+//    return b;
+//}
+//
+//inline double min( double a, double b )
+//{
+//  if( a<b )
+//    return a;
+//  else
+//    return b;
+//}
 
 #include <BRepLib_MakeWire.hxx>
 
@@ -858,7 +859,7 @@ std::vector<HYDROData_Bathymetry::AltitudePoints> HYDROData_DTM::Interpolate
   GetProperties( theProfileB, lowestB, dirB, zminB, zmaxB ); 
 
   
-  double hmax = max( zmaxA-zminA, zmaxB-zminB );
+  double hmax = zmaxA-zminA > zmaxB-zminB ? zmaxA-zminA : zmaxB-zminB;
 
   //double dz = zminB - zminA;
   //double zmin = min( zminA, zminB );