From 6107ec75e4943b04578e416127d7c235ee25a461 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jakub=20Klinkovsk=C3=BD?= <klinkovsky@mmg.fjfi.cvut.cz>
Date: Sat, 29 Feb 2020 09:13:07 +0100
Subject: [PATCH] Using getData() instead of data in StaticArray

---
 src/TNL/Containers/StaticArray.hpp             | 18 +++++++++---------
 .../Containers/detail/StaticArrayAssignment.h  |  8 ++++----
 2 files changed, 13 insertions(+), 13 deletions(-)

diff --git a/src/TNL/Containers/StaticArray.hpp b/src/TNL/Containers/StaticArray.hpp
index c1ac8e62a7..c6af2e4edc 100644
--- a/src/TNL/Containers/StaticArray.hpp
+++ b/src/TNL/Containers/StaticArray.hpp
@@ -102,21 +102,21 @@ template< int Size, typename Value >
 __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value v[ Size ] )
 {
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, data, v );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, getData(), v );
 }
 
 template< int Size, typename Value >
 __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const Value& v )
 {
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignValueFunctor{}, data, v );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignValueFunctor{}, getData(), v );
 }
 
 template< int Size, typename Value >
 __cuda_callable__
 StaticArray< Size, Value >::StaticArray( const StaticArray< Size, Value >& v )
 {
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, data, v.getData() );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, getData(), v.getData() );
 }
 
 template< int Size, typename Value >
@@ -228,7 +228,7 @@ template< int Size, typename Value >
 __cuda_callable__
 StaticArray< Size, Value >& StaticArray< Size, Value >::operator=( const StaticArray< Size, Value >& array )
 {
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, data, array.getData() );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, getData(), array.getData() );
    return *this;
 }
 
@@ -264,7 +264,7 @@ StaticArray< Size, Value >::
 operator StaticArray< Size, OtherValue >() const
 {
    StaticArray< Size, OtherValue > aux;
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, aux.getData(), data );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignArrayFunctor{}, aux.getData(), getData() );
    return aux;
 }
 
@@ -272,27 +272,27 @@ template< int Size, typename Value >
 __cuda_callable__
 void StaticArray< Size, Value >::setValue( const ValueType& val )
 {
-   Algorithms::StaticFor< 0, Size >::exec( detail::AssignValueFunctor{}, data, val );
+   Algorithms::StaticFor< 0, Size >::exec( detail::AssignValueFunctor{}, getData(), val );
 }
 
 template< int Size, typename Value >
 bool StaticArray< Size, Value >::save( File& file ) const
 {
-   file.save( data, Size );
+   file.save( getData(), Size );
    return true;
 }
 
 template< int Size, typename Value >
 bool StaticArray< Size, Value >::load( File& file)
 {
-   file.load( data, Size );
+   file.load( getData(), Size );
    return true;
 }
 
 template< int Size, typename Value >
 void StaticArray< Size, Value >::sort()
 {
-   detail::StaticArraySort< Size - 1, 0, Value >::exec( data );
+   detail::StaticArraySort< Size - 1, 0, Value >::exec( getData() );
 }
 
 template< int Size, typename Value >
diff --git a/src/TNL/Containers/detail/StaticArrayAssignment.h b/src/TNL/Containers/detail/StaticArrayAssignment.h
index 9a8d7d3eeb..6ba6c8e02a 100644
--- a/src/TNL/Containers/detail/StaticArrayAssignment.h
+++ b/src/TNL/Containers/detail/StaticArrayAssignment.h
@@ -21,7 +21,7 @@ struct AssignArrayFunctor
 {
    template< typename LeftValue, typename RightValue >
    __cuda_callable__
-   void operator()( int i, LeftValue& data, const RightValue& v ) const
+   void operator()( int i, LeftValue* data, const RightValue* v ) const
    {
       data[ i ] = v[ i ];
    }
@@ -31,7 +31,7 @@ struct AssignValueFunctor
 {
    template< typename LeftValue, typename RightValue >
    __cuda_callable__
-   void operator()( int i, LeftValue& data, const RightValue& v ) const
+   void operator()( int i, LeftValue* data, const RightValue& v ) const
    {
       data[ i ] = v;
    }
@@ -53,7 +53,7 @@ struct StaticArrayAssignment< StaticArray, T, true >
    static void assign( StaticArray& a, const T& v )
    {
       static_assert( StaticArray::getSize() == T::getSize(), "Cannot assign static arrays with different size." );
-      Algorithms::StaticFor< 0, StaticArray::getSize() >::exec( AssignArrayFunctor{}, a.getData(), v );
+      Algorithms::StaticFor< 0, StaticArray::getSize() >::exec( AssignArrayFunctor{}, a.getData(), v.getData() );
    }
 };
 
@@ -68,7 +68,7 @@ struct StaticArrayAssignment< StaticArray, T, false >
    __cuda_callable__
    static void assign( StaticArray& a, const T& v )
    {
-      Algorithms::StaticFor< 0, StaticArray::getSize() >::exec( AssignValueFunctor{}, a, v );
+      Algorithms::StaticFor< 0, StaticArray::getSize() >::exec( AssignValueFunctor{}, a.getData(), v );
    }
 };
 
-- 
GitLab