Commit 1081a25c authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Reordered methods of Array to group similar methods together

parent a3ad5ce8
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -82,15 +82,13 @@ class Array : public Object

      void reset();

      void setElement( const Index& i, const Value& x );
      __cuda_callable__ const Value* getData() const;

      Value getElement( const Index& i ) const;
      __cuda_callable__ Value* getData();

      // Checks if there is an element with value v in this array
      bool containsValue( const Value& v ) const;
      void setElement( const Index& i, const Value& x );

      // Checks if all elements in this array have the same value v
      bool containsOnlyValue( const Value& v ) const;
      Value getElement( const Index& i ) const;

      __cuda_callable__ inline Value& operator[] ( const Index& i );

@@ -109,9 +107,11 @@ class Array : public Object

      void setValue( const Value& v );

      __cuda_callable__ const Value* getData() const;
      // Checks if there is an element with value v in this array
      bool containsValue( const Value& v ) const;

      __cuda_callable__ Value* getData();
      // Checks if all elements in this array have the same value v
      bool containsOnlyValue( const Value& v ) const;

      /*!
       * Returns true if non-zero size is set.
+24 −25
Original line number Diff line number Diff line
@@ -300,45 +300,43 @@ reset()
template< typename Value,
          typename Device,
          typename Index >
void
Array< Value, Device, Index >::
setElement( const Index& i, const Value& x )
__cuda_callable__
const Value* Array< Value, Device, Index >::getData() const
{
   TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
   TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
   return Algorithms::ArrayOperations< Device >::setMemoryElement( &( this->data[ i ] ), x );
   return this->data;
}

template< typename Value,
          typename Device,
          typename Index >
Value
Array< Value, Device, Index >::
getElement( const Index& i ) const
__cuda_callable__
Value* Array< Value, Device, Index >::getData()
{
   TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
   TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
   return Algorithms::ArrayOperations< Device >::getMemoryElement( & ( this->data[ i ] ) );
   return this->data;
}

template< typename Value,
          typename Device,
          typename Index >
bool
void
Array< Value, Device, Index >::
containsValue( const Value& v ) const
setElement( const Index& i, const Value& x )
{
   return Algorithms::ArrayOperations< Device >::containsValue( this->data, this->size, v );
   TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
   TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
   return Algorithms::ArrayOperations< Device >::setMemoryElement( &( this->data[ i ] ), x );
}

template< typename Value,
          typename Device,
          typename Index >
bool
Value
Array< Value, Device, Index >::
containsOnlyValue( const Value& v ) const
getElement( const Index& i ) const
{
   return Algorithms::ArrayOperations< Device >::containsOnlyValue( this->data, this->size, v );
   TNL_ASSERT_GE( i, 0, "Element index must be non-negative." );
   TNL_ASSERT_LT( i, this->getSize(), "Element index is out of bounds." );
   return Algorithms::ArrayOperations< Device >::getMemoryElement( & ( this->data[ i ] ) );
}

template< typename Value,
@@ -431,7 +429,6 @@ bool Array< Value, Device, Index >::operator != ( const ArrayT& array ) const
   return ! ( ( *this ) == array );
}


template< typename Value,
          typename Device,
          typename Index >
@@ -444,19 +441,21 @@ void Array< Value, Device, Index >::setValue( const Value& e )
template< typename Value,
          typename Device,
          typename Index >
__cuda_callable__
const Value* Array< Value, Device, Index >::getData() const
bool
Array< Value, Device, Index >::
containsValue( const Value& v ) const
{
   return this -> data;
   return Algorithms::ArrayOperations< Device >::containsValue( this->data, this->size, v );
}

template< typename Value,
          typename Device,
          typename Index >
__cuda_callable__
Value* Array< Value, Device, Index >::getData()
bool
Array< Value, Device, Index >::
containsOnlyValue( const Value& v ) const
{
   return this -> data;
   return Algorithms::ArrayOperations< Device >::containsOnlyValue( this->data, this->size, v );
}

template< typename Value,