Commit c8e6c5d5 authored by Jakub Klinkovský's avatar Jakub Klinkovský
Browse files

Removed print method and operator<< for DistributedArray and DistributedArrayView

It does not make sense to print a distributed array like this, because
it may contain ghost elements. Users should examine the local array
view manually.
parent e059f1a1
Loading
Loading
Loading
Loading
+0 −10
Original line number Diff line number Diff line
@@ -270,16 +270,6 @@ private:
   static void setSynchronizerHelper( ViewType& view, const Array& array ) {}
};

template< typename Value,
          typename Device,
          typename Index,
          typename Allocator >
std::ostream& operator<<( std::ostream& str, const DistributedArray< Value, Device, Index, Allocator >& array )
{
   return array.getConstView().print( str );
}


} // namespace Containers
} // namespace TNL

+0 −11
Original line number Diff line number Diff line
@@ -230,7 +230,6 @@ public:
      template< typename Function >
      void forElements( IndexType begin, IndexType end, Function&& f ) const;

   std::ostream& print( std::ostream& str ) const;
protected:
   LocalRangeType localRange;
   IndexType ghosts = 0;
@@ -242,16 +241,6 @@ protected:
   int valuesPerElement = 1;
};


template< typename Value,
          typename Device = Devices::Host,
          typename Index = int >
std::ostream& operator<<( std::ostream& str, const DistributedArrayView< Value, Device, Index >& view )
{
   return view.print( str );
}


} // namespace Containers
} // namespace TNL

+0 −27
Original line number Diff line number Diff line
@@ -471,32 +471,5 @@ forElements( IndexType begin, IndexType end, Function&& f ) const

}


template< typename Value,
          typename Device,
          typename Index >
std::ostream&
DistributedArrayView< Value, Device, Index >::
print( std::ostream& str ) const
{
   // The following does not work properly
   /*if( MPI::GetRank( communicator ) == 0 )
   {
      str << "[ ";
      for( IndexType i = 0; i < localData.getSize(); i++ )
         str << ", " << localData.getElement( i );
      for( int proc = 1; proc < MPI::GetSize( communicator ); proc++ )
      {
         Array< std::remove_const_t< Value >, Device, Index > localArray;
         receive( localArray, proc, 0, communicator );
         for( IndexType i = 0; i < localArray.getSize(); i++ )
            str << ", " << localArray.getElement( i );
      }
      str << " ]";
   }
   else send( this->localData, 0, 0, this->communicator );*/
   return str;
}

} // namespace Containers
} // namespace TNL