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

Merge branch 'TO/get-view' into 'develop'

Fised index type in assertions in getView/getConstView methods in...

See merge request !133
parents 4403b2dc 71b1d854
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -258,6 +258,12 @@ template< typename Value, typename Device, typename Index, typename Allocator >
typename Array< Value, Device, Index, Allocator >::ViewType
Array< Value, Device, Index, Allocator >::getView( IndexType begin, IndexType end )
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, getSize(), "Parameter 'begin' must be lower or equal to size of the array." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, getSize(), "Parameter 'end' must be lower or equal to size of the array." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = getSize();
   return ViewType( getData() + begin, end - begin );
@@ -267,6 +273,12 @@ template< typename Value, typename Device, typename Index, typename Allocator >
typename Array< Value, Device, Index, Allocator >::ConstViewType
Array< Value, Device, Index, Allocator >::getConstView( IndexType begin, IndexType end ) const
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, getSize(), "Parameter 'begin' must be lower or equal to size of the array." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, getSize(), "Parameter 'end' must be lower or equal to size of the array." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = getSize();
   return ConstViewType( getData() + begin, end - begin );
+12 −0
Original line number Diff line number Diff line
@@ -59,6 +59,12 @@ __cuda_callable__
typename ArrayView< Value, Device, Index >::ViewType
ArrayView< Value, Device, Index >::getView( IndexType begin, IndexType end )
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, getSize(), "Parameter 'begin' must be lower or equal to size of the array view." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, getSize(), "Parameter 'end' must be lower or equal to size of the array view." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ViewType( getData() + begin, end - begin );
@@ -70,6 +76,12 @@ __cuda_callable__
typename ArrayView< Value, Device, Index >::ConstViewType
ArrayView< Value, Device, Index >::getConstView( IndexType begin, IndexType end ) const
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, getSize(), "Parameter 'begin' must be lower or equal to size of the array view." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, getSize(), "Parameter 'end' must be lower or equal to size of the array view." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ConstViewType( getData() + begin, end - begin );
+12 −0
Original line number Diff line number Diff line
@@ -28,6 +28,12 @@ template< typename Real, typename Device, typename Index, typename Allocator >
typename Vector< Real, Device, Index, Allocator >::ViewType
Vector< Real, Device, Index, Allocator >::getView( IndexType begin, IndexType end )
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, this->getSize(), "Parameter 'begin' must be lower or equal to size of the vector." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, this->getSize(), "Parameter 'end' must be lower or equal to size of the vector." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ViewType( this->getData() + begin, end - begin );
@@ -37,6 +43,12 @@ template< typename Real, typename Device, typename Index, typename Allocator >
typename Vector< Real, Device, Index, Allocator >::ConstViewType
Vector< Real, Device, Index, Allocator >::getConstView( IndexType begin, IndexType end ) const
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, this->getSize(), "Parameter 'begin' must be lower or equal to size of the vector." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, this->getSize(), "Parameter 'end' must be lower or equal to size of the vector." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ConstViewType( this->getData() + begin, end - begin );
+12 −0
Original line number Diff line number Diff line
@@ -17,6 +17,12 @@ __cuda_callable__
typename VectorView< Real, Device, Index >::ViewType
VectorView< Real, Device, Index >::getView( IndexType begin, IndexType end )
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, this->getSize(), "Parameter 'begin' must be lower or equal to size of the vector view." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, this->getSize(), "Parameter 'end' must be lower or equal to size of the vector view." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ViewType( this->getData() + begin, end - begin );
@@ -28,6 +34,12 @@ __cuda_callable__
typename VectorView< Real, Device, Index >::ConstViewType
VectorView< Real, Device, Index >::getConstView( const IndexType begin, IndexType end ) const
{
   TNL_ASSERT_GE( begin, ( Index ) 0, "Parameter 'begin' must be non-negative." );
   TNL_ASSERT_LE( begin, this->getSize(), "Parameter 'begin' must be lower or equal to size of the vector view." );
   TNL_ASSERT_GE( end, ( Index ) 0, "Parameter 'end' must be non-negative." );
   TNL_ASSERT_LE( end, this->getSize(), "Parameter 'end' must be lower or equal to size of the vector view." );
   TNL_ASSERT_LE( begin, end, "Parameter 'begin' must be lower or equal to the parameter 'end'." );

   if( end == 0 )
      end = this->getSize();
   return ConstViewType( this->getData() + begin, end - begin );