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

tnlLongVectorCUDA returns null pointer on data if it is not initialized.

parent 9426c7a4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -110,6 +110,7 @@ template< class T > class tnlLongVector : public tnlObject
   /*! This is not clear from the OOP point of view however it is necessary for keeping 
       good performance of derived numerical structure like solvers.
    */
   // TODO: return zero pointer if size == 0
   const T* Data() const
   {
      return data;
@@ -138,7 +139,13 @@ template< class T > class tnlLongVector : public tnlObject
      return data[ i ];
   };

   void Zeros()
   void Zeros() // TODO: replace by setValue
   {
      int i;
      for( i = 0; i < size; i ++ ) data[ i ] = ( T ) 0;
   };

   void setValue( const T& v )
   {
	   int i;
	   for( i = 0; i < size; i ++ ) data[ i ] = ( T ) 0;
+4 −0
Original line number Diff line number Diff line
@@ -178,12 +178,16 @@ template< class T > class tnlLongVectorCUDA : public tnlObject
    */
   const T* Data() const
   {
	   if( ! size )
		   return NULL;
      return data;
   };

   //! Returns pointer to data
   T* Data()
   {
	  if( ! size )
		  return NULL;
      return data;
   }