Skip to content
Snippets Groups Projects
Commit 6107ec75 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Using getData() instead of data in StaticArray

parent f3156459
No related branches found
No related tags found
1 merge request!49Bug fixes
......@@ -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 >
......
......@@ -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 );
}
};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment