From 0088abdc8b9653101f4048617ff3f5255e15b9b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Sat, 15 Sep 2018 16:19:29 +0200
Subject: [PATCH] Revert "Fixed problem with std::isnan on older g++."

The std::isnan method can be safely used in host code (if the compiler
is not moron). There is no device code which uses isnan so the
TNL::isNan function is useless.

This reverts commit 0eff2f63d0d5bf214ce069373f8488220aca3677.
---
 src/TNL/Math.h                          | 18 ------------------
 src/TNL/Solvers/IterativeSolver_impl.h  |  4 ++--
 src/TNL/Solvers/Linear/BICGStabL_impl.h |  2 +-
 3 files changed, 3 insertions(+), 21 deletions(-)

diff --git a/src/TNL/Math.h b/src/TNL/Math.h
index 2d81bea667..67e9f5e082 100644
--- a/src/TNL/Math.h
+++ b/src/TNL/Math.h
@@ -168,24 +168,6 @@ T sign( const T& a )
    return ( T ) 1;
 }
 
-template< class T >
-__cuda_callable__
-bool isNan( const T& v )
-{
-#if defined HAVE_CUDA
-   #if defined(__CUDA_ARCH__)
-      return isnan( v );
-   #else
-      #if defined (__GNUC__) && ( __GNUC__  < 5 )
-         return false;
-      #else
-         return std::isnan( v );
-      #endif
-   #endif
-#else
-   return std::isnan( v );
-#endif
-}
 template< typename Real >
 __cuda_callable__
 bool isSmall( const Real& v,
diff --git a/src/TNL/Solvers/IterativeSolver_impl.h b/src/TNL/Solvers/IterativeSolver_impl.h
index e65b3cdd41..333c38cd44 100644
--- a/src/TNL/Solvers/IterativeSolver_impl.h
+++ b/src/TNL/Solvers/IterativeSolver_impl.h
@@ -107,7 +107,7 @@ bool IterativeSolver< Real, Index> :: checkNextIteration()
 {
    this->refreshSolverMonitor();
 
-   if( isNan( this->getResidue() ) ||
+   if( std::isnan( this->getResidue() ) ||
        this->getIterations() > this->getMaxIterations()  ||
        ( this->getResidue() > this->getDivergenceResidue() && this->getIterations() >= this->getMinIterations() ) ||
        ( this->getResidue() < this->getConvergenceResidue() && this->getIterations() >= this->getMinIterations() ) )
@@ -120,7 +120,7 @@ bool
 IterativeSolver< Real, Index>::
 checkConvergence()
 {
-   if( isNan( this->getResidue() ) )
+   if( std::isnan( this->getResidue() ) )
    {
       std::cerr << std::endl << "The residue is NaN." << std::endl;
       return false;
diff --git a/src/TNL/Solvers/Linear/BICGStabL_impl.h b/src/TNL/Solvers/Linear/BICGStabL_impl.h
index 467f1a91a0..6606bddd56 100644
--- a/src/TNL/Solvers/Linear/BICGStabL_impl.h
+++ b/src/TNL/Solvers/Linear/BICGStabL_impl.h
@@ -87,7 +87,7 @@ BICGStabL< Matrix >::solve( ConstVectorViewType b, VectorViewType x )
    }
 
    sigma[ 0 ] = r_0.lpNorm( 2.0 );
-   if( isNan( sigma[ 0 ] ) )
+   if( std::isnan( sigma[ 0 ] ) )
       throw std::runtime_error( "BiCGstab(ell): initial residue is NAN" );
 
    r_ast = r_0;
-- 
GitLab