diff --git a/src/TNL/Algorithms/Segments/BiEllpack.h b/src/TNL/Algorithms/Segments/BiEllpack.h index 48aa4e6be6458fb8815afa32757cfe75710746da..ee202d25ce91aa8dccab7f80eb17e617b75913f7 100644 --- a/src/TNL/Algorithms/Segments/BiEllpack.h +++ b/src/TNL/Algorithms/Segments/BiEllpack.h @@ -190,7 +190,7 @@ template <typename Device, typename IndexAllocator, ElementsOrganization Organization, int WarpSize > -std::ostream& operator<<( std::ostream& str, const BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >& segments ) { return printSegments( str, segments ); } +std::ostream& operator<<( std::ostream& str, const BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >& segments ) { return printSegments( segments, str ); } } // namespace Segments diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.h b/src/TNL/Algorithms/Segments/BiEllpackView.h index c37ed6d730d42d6e7d7ea4438dae403807e99705..c0ae1559e83d0ddbf9d440bc0466c78a9c9e5291 100644 --- a/src/TNL/Algorithms/Segments/BiEllpackView.h +++ b/src/TNL/Algorithms/Segments/BiEllpackView.h @@ -32,7 +32,7 @@ class BiEllpackView using DeviceType = Device; using IndexType = std::remove_const_t< Index >; - using OffsetsView = typename Containers::VectorView< IndexType, DeviceType, IndexType >; + using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >; using ConstOffsetsView = typename OffsetsView::ConstViewType; using ViewType = BiEllpackView; template< typename Device_, typename Index_ > diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.h b/src/TNL/Algorithms/Segments/ChunkedEllpack.h index d5d459a00500ee875267027865ebeb6a7148227f..5b0916d2011ac27ff1e1a3c02aa5697b2c53f713 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpack.h +++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.h @@ -14,6 +14,7 @@ #include <TNL/Containers/Vector.h> #include <TNL/Algorithms/Segments/ChunkedEllpackView.h> #include <TNL/Algorithms/Segments/SegmentView.h> +#include <TNL/Algorithms/Segments/SegmentsPrinting.h> namespace TNL { namespace Algorithms { @@ -34,7 +35,7 @@ class ChunkedEllpack using ViewType = ChunkedEllpackView< Device, Index, Organization >; template< typename Device_, typename Index_ > using ViewTemplate = ChunkedEllpackView< Device_, Index_, Organization >; - using ConstViewType = ChunkedEllpackView< Device, std::add_const_t< IndexType >, Organization >; + using ConstViewType = typename ViewType::ConstViewType; using SegmentViewType = typename ViewType::SegmentViewType; using ChunkedEllpackSliceInfoType = typename ViewType::ChunkedEllpackSliceInfoType; // detail::ChunkedEllpackSliceInfo< IndexType >; //TODO: using ChunkedEllpackSliceInfoAllocator = typename IndexAllocatorType::retype< ChunkedEllpackSliceInfoType >; @@ -176,7 +177,7 @@ template <typename Device, typename Index, typename IndexAllocator, ElementsOrganization Organization > -std::ostream& operator<<( std::ostream& str, const ChunkedEllpack< Device, Index, IndexAllocator, Organization >& segments ) { return printSegments( str, segments ); } +std::ostream& operator<<( std::ostream& str, const ChunkedEllpack< Device, Index, IndexAllocator, Organization >& segments ) { return printSegments( segments, str ); } } // namespace Segments diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp index 8992d095156cd878220d1c45aec196d476fd238c..82ddd7d8ed330194f36552aeda356a1e6c12b86b 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp +++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp @@ -348,10 +348,10 @@ template< typename Device, auto ChunkedEllpack< Device, Index, IndexAllocator, Organization >:: getSegmentSize( const IndexType segmentIdx ) const -> IndexType { - return detail::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSize( - rowToSliceMapping.getView(), - slices.getView(), - rowToChunkMapping.getView(), + return details::ChunkedEllpack< IndexType, DeviceType, Organization >::getSegmentSize( + rowToSliceMapping.getConstView(), + slices.getConstView(), + rowToChunkMapping.getConstView(), segmentIdx ); } diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h index 123bc1cb9281db3668533e00eeed509147140c16..a20d5a41a6ced00bef0216aab66d6c2f9d3b0579 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h +++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h @@ -32,7 +32,7 @@ class ChunkedEllpackView using DeviceType = Device; using IndexType = std::remove_const_t< Index >; - using OffsetsView = typename Containers::VectorView< IndexType, DeviceType, IndexType >; + using OffsetsView = typename Containers::VectorView< Index, DeviceType, IndexType >; using ConstOffsetsView = typename OffsetsView::ConstViewType; using ViewType = ChunkedEllpackView; template< typename Device_, typename Index_ > @@ -41,7 +41,7 @@ class ChunkedEllpackView using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >; using ChunkedEllpackSliceInfoType = detail::ChunkedEllpackSliceInfo< IndexType >; using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >; - using ChunkedEllpackSliceInfoContainer = Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >; + using ChunkedEllpackSliceInfoContainer = Containers::Array< typename TNL::copy_const< ChunkedEllpackSliceInfoType >::template from< Index >::type, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >; using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ViewType; static constexpr bool havePadding() { return true; }; diff --git a/src/TNL/Algorithms/Segments/detail/BiEllpack.h b/src/TNL/Algorithms/Segments/detail/BiEllpack.h index 43c42e43c803cf9fff51c7a237e58bb3ce656a98..db64d392d99d85c6b8aba5938566fdf072144434 100644 --- a/src/TNL/Algorithms/Segments/detail/BiEllpack.h +++ b/src/TNL/Algorithms/Segments/detail/BiEllpack.h @@ -32,7 +32,7 @@ class BiEllpack using IndexType = Index; static constexpr bool getOrganization() { return Organization; } using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >; - using OffsetsHolderView = typename OffsetsContainer::ViewType; + using OffsetsHolderView = typename OffsetsContainer::ConstViewType; using ConstOffsetsHolderView = typename OffsetsHolderView::ConstViewType; using SegmentsSizes = OffsetsContainer; using SegmentViewType = BiEllpackSegmentView< IndexType, Organization >; diff --git a/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h b/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h index 3e279b02bac498eb87032aafa98bdd8c114fa3cd..d9a6c30f21f5256f8874723920e8977b0ac5e7d4 100644 --- a/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h +++ b/src/TNL/Algorithms/Segments/detail/ChunkedEllpack.h @@ -63,12 +63,12 @@ class ChunkedEllpack using IndexType = Index; static constexpr ElementsOrganization getOrganization() { return Organization; } using OffsetsContainer = Containers::Vector< IndexType, DeviceType, IndexType >; - using OffsetsHolderView = typename OffsetsContainer::ViewType; + using OffsetsHolderView = typename OffsetsContainer::ConstViewType; using SegmentsSizes = OffsetsContainer; using ChunkedEllpackSliceInfoType = details::ChunkedEllpackSliceInfo< IndexType >; using ChunkedEllpackSliceInfoAllocator = typename Allocators::Default< Device >::template Allocator< ChunkedEllpackSliceInfoType >; using ChunkedEllpackSliceInfoContainer = Containers::Array< ChunkedEllpackSliceInfoType, DeviceType, IndexType, ChunkedEllpackSliceInfoAllocator >; - using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ViewType; + using ChunkedEllpackSliceInfoContainerView = typename ChunkedEllpackSliceInfoContainer::ConstViewType; using SegmentViewType = ChunkedEllpackSegmentView< IndexType, Organization >; __cuda_callable__ static