From 1215b84f549e9b2534ade178b036b41068497e4d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkjak@fjfi.cvut.cz>
Date: Tue, 9 Jul 2019 13:56:57 +0200
Subject: [PATCH] Throw NotImplementedError from empty prefix sum methods

---
 src/TNL/Containers/Algorithms/PrefixSum.hpp | 5 ++---
 src/TNL/Containers/Vector.hpp               | 5 +++--
 src/TNL/Containers/VectorView.hpp           | 5 +++--
 3 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/TNL/Containers/Algorithms/PrefixSum.hpp b/src/TNL/Containers/Algorithms/PrefixSum.hpp
index 7b6ced47a7..d3c3b30719 100644
--- a/src/TNL/Containers/Algorithms/PrefixSum.hpp
+++ b/src/TNL/Containers/Algorithms/PrefixSum.hpp
@@ -21,6 +21,7 @@
 #include <TNL/Containers/Algorithms/ReductionOperations.h>
 #include <TNL/Containers/Algorithms/ArrayOperations.h>
 #include <TNL/Containers/Algorithms/CudaPrefixSumKernel.h>
+#include <TNL/Exceptions/NotImplementedError.h>
 
 #ifdef CUDA_REDUCTION_PROFILING
 #include <iostream>
@@ -167,7 +168,7 @@ perform( Vector& v,
    using IndexType = typename Vector::IndexType;
    using IndexType = typename Vector::IndexType;
 #ifdef HAVE_CUDA
-   throw 0; // NOT IMPLEMENTED YET
+   throw Exceptions::NotImplementedError( "Segmented prefix sum is not implemented for CUDA." ); // NOT IMPLEMENTED YET
    /*CudaPrefixSumKernelLauncher< Type, RealType, IndexType >::start(
       ( IndexType ) ( end - begin ),
       ( IndexType ) 256,
@@ -179,8 +180,6 @@ perform( Vector& v,
 #endif
 }
 
-
-
 } // namespace Algorithms
 } // namespace Containers
 } // namespace TNL
diff --git a/src/TNL/Containers/Vector.hpp b/src/TNL/Containers/Vector.hpp
index eca2eba964..855e3296f4 100644
--- a/src/TNL/Containers/Vector.hpp
+++ b/src/TNL/Containers/Vector.hpp
@@ -11,6 +11,7 @@
 #pragma once
 
 #include <TNL/Containers/Vector.h>
+#include <TNL/Exceptions/NotImplementedError.h>
 
 namespace TNL {
 namespace Containers {
@@ -394,7 +395,7 @@ void
 Vector< Real, Device, Index >::
 prefixSum( const VectorExpression& expression, const IndexType begin, const IndexType end )
 {
-
+   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
 }
 
 template< typename Real,
@@ -407,7 +408,7 @@ void
 Vector< Real, Device, Index >::
 segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin, const IndexType end )
 {
-
+   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
 }
 
 } // namespace Containers
diff --git a/src/TNL/Containers/VectorView.hpp b/src/TNL/Containers/VectorView.hpp
index 7c7fe5a962..a0142d5969 100644
--- a/src/TNL/Containers/VectorView.hpp
+++ b/src/TNL/Containers/VectorView.hpp
@@ -14,6 +14,7 @@
 #include <TNL/Containers/Algorithms/VectorOperations.h>
 #include <TNL/Containers/VectorViewExpressions.h>
 #include <TNL/Containers/Algorithms/VectorAssignment.h>
+#include <TNL/Exceptions/NotImplementedError.h>
 
 namespace TNL {
 namespace Containers {
@@ -411,7 +412,7 @@ void
 VectorView< Real, Device, Index >::
 prefixSum( const VectorExpression& expression, const IndexType begin, const IndexType end )
 {
-
+   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
 }
 
 template< typename Real,
@@ -424,7 +425,7 @@ void
 VectorView< Real, Device, Index >::
 segmentedPrefixSum( const VectorExpression& expression, FlagsArray& flags, const IndexType begin, const IndexType end )
 {
-
+   throw Exceptions::NotImplementedError( "Prefix sum with vector expressions is not implemented." );
 }
 
 } // namespace Containers
-- 
GitLab