Commit 6107ec75 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Using getData() instead of data in StaticArray

parent f3156459
Loading
Loading
Loading
Loading
+9 −9
Original line number Diff line number Diff line
@@ -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 >
+4 −4
Original line number Diff line number Diff line
@@ -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 );
   }
};