Commit 20aa4678 authored by Tomáš Oberhuber's avatar Tomáš Oberhuber
Browse files

Small fixes in arrays and vectors.

parent 016bd0be
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -53,7 +53,9 @@ class tnlConstSharedArray : public tnlObject
              const Index _size );

   template< typename Array >
   void bind( const Array& array );
   void bind( const Array& array,
              IndexType index = 0,
              IndexType size = 0 );

   void swap( tnlConstSharedArray< Element, Device, Index >& array );

+11 −3
Original line number Diff line number Diff line
@@ -92,10 +92,18 @@ template< typename Element,
          typename Device,
          typename Index >
   template< typename Array >
void tnlConstSharedArray< Element, Device, Index > :: bind( const Array& array )
void tnlConstSharedArray< Element, Device, Index > :: bind( const Array& array,
                                                            IndexType index,
                                                            IndexType size )
{
   tnlStaticAssert( Array::DeviceType::DeviceType == DeviceType::DeviceType,
                    "Attempt to bind arrays between different devices." );
   this->data = &( array. getData()[ index ] );
   if( ! size )
      this->size = array. getSize();
   this -> data = array. getData();
   else
      this->size = size;
   
};

template< typename Element,
+4 −1
Original line number Diff line number Diff line
@@ -64,7 +64,10 @@ class tnlSharedArray : public tnlObject
   void bind( Element* _data,
              const Index _size );

   void bind( tnlArray< Element, Device, Index >& array );
   template< typename Array >
   void bind( Array& array,
              IndexType index = 0,
              IndexType size = 0 );

   template< int Size >
   void bind( tnlStaticArray< Size, Element >& array );
+13 −4
Original line number Diff line number Diff line
@@ -117,10 +117,19 @@ void tnlSharedArray< Element, Device, Index > :: bind( Element* data,
template< typename Element,
          typename Device,
          typename Index >
void tnlSharedArray< Element, Device, Index > :: bind( tnlArray< Element, Device, Index >& array )
{
   template< typename Array >
void tnlSharedArray< Element, Device, Index > :: bind( Array& array,
                                                       IndexType index,
                                                       IndexType size )
{
   tnlStaticAssert( Array::DeviceType::DeviceType == DeviceType::DeviceType,
                    "Attempt to bind arrays between different devices." );
   this->data = &( array. getData()[ index ] );
   if( ! size )
      this->size = array. getSize();
   this->data = array. getData();
   else
      this->size = size;
   
};

template< typename Element,
+2 −0
Original line number Diff line number Diff line
@@ -78,6 +78,8 @@ class tnlVector : public tnlArray< Real, Device, Index >
   // TODO: implement
   //tnlVector< Real, Device, Index >& operator *= ( const RealType& c );
   
   //tnlVector< Real, Device, Index >& operator /= ( const RealType& c );

   Real max() const;

   Real min() const;
Loading