From c04814b8bbdf2cec64ed78828286b3bd2d078492 Mon Sep 17 00:00:00 2001
From: Tomas Oberhuber <tomas.oberhuber@fjfi.cvut.cz>
Date: Thu, 12 Apr 2018 12:11:52 +0200
Subject: [PATCH] Added CUDA build for eikonal solver.

---
 .../Solvers/hamilton-jacobi/CMakeLists.txt               | 9 +++++++--
 .../Solvers/hamilton-jacobi/tnlFastSweepingMethod.h      | 6 +++---
 2 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/CMakeLists.txt b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/CMakeLists.txt
index 176c9859e3..fa8dd56d37 100644
--- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/CMakeLists.txt
+++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/CMakeLists.txt
@@ -10,8 +10,13 @@ set( tnl_hamilton_jacobi_SOURCES
 #ADD_EXECUTABLE(tnl-hamilton-jacobi${debugExt} main.cpp)
 #target_link_libraries (tnl-hamilton-jacobi${debugExt} tnl${debugExt}-${tnlVersion} )
 
-ADD_EXECUTABLE(tnl-direct-eikonal-solver${debugExt} tnl-direct-eikonal-solver.cpp )
-target_link_libraries (tnl-direct-eikonal-solver${debugExt} tnl${debugExt}-${tnlVersion} )
+IF( BUILD_CUDA )
+    CUDA_ADD_EXECUTABLE(tnl-direct-eikonal-solver${debugExt} tnl-direct-eikonal-solver.cu )
+    target_link_libraries (tnl-direct-eikonal-solver${debugExt} tnl${debugExt}-${tnlVersion} ${CUSPARSE_LIBRARY} )
+ELSE(  BUILD_CUDA )               
+    ADD_EXECUTABLE(tnl-direct-eikonal-solver${debugExt} tnl-direct-eikonal-solver.cpp )
+    target_link_libraries (tnl-direct-eikonal-solver${debugExt} tnl${debugExt}-${tnlVersion} )
+ENDIF( BUILD_CUDA )
 
 
 INSTALL( TARGETS #tnl-hamilton-jacobi${debugExt} 
diff --git a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlFastSweepingMethod.h b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlFastSweepingMethod.h
index 17d139b0ec..61104a143c 100644
--- a/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlFastSweepingMethod.h
+++ b/src/TNL/Experimental/Hamilton-Jacobi/Solvers/hamilton-jacobi/tnlFastSweepingMethod.h
@@ -28,7 +28,7 @@ template< typename Real,
 class FastSweepingMethod< Meshes::Grid< 1, Real, Device, Index >, Anisotropy >
    : public tnlDirectEikonalMethodsBase< Meshes::Grid< 1, Real, Device, Index > >
 {
-   static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
+   //static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
    
    public:
       
@@ -66,7 +66,7 @@ template< typename Real,
 class FastSweepingMethod< Meshes::Grid< 2, Real, Device, Index >, Anisotropy >
    : public tnlDirectEikonalMethodsBase< Meshes::Grid< 2, Real, Device, Index > >
 {
-   static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
+   //static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
    
    public:
       
@@ -104,7 +104,7 @@ template< typename Real,
 class FastSweepingMethod< Meshes::Grid< 3, Real, Device, Index >, Anisotropy >
    : public tnlDirectEikonalMethodsBase< Meshes::Grid< 3, Real, Device, Index > >
 {
-   static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
+   //static_assert(  std::is_same< Device, TNL::Devices::Host >::value, "The fast sweeping method works only on CPU." );
    
    public:
       
-- 
GitLab