diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp index 0ceb7a6bd496932c7cb79bca153378f59d3911f0..ed25d6df477fd7115490242f4dce88dd3f65ce62 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp @@ -35,7 +35,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp index 9493758b4954d8056a5398c3134b46c072608ea9..a71c51519e13b31addefbedfe865d3545da65825 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_2.cpp @@ -34,7 +34,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forElements.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forElements.cpp index 37267a889fd87a5880e24de6d0d0ed1a83d6402b..26499804622aaf3da1e15129a05f1a50a0899364 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forElements.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forElements.cpp @@ -33,7 +33,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp index 3bf7cc50bd46dd6dc2bc72d78d9bc47700fa2589..f2eb0ae13ae66198008d4d8299f2d819bbf96d8e 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_forSegments.cpp @@ -36,7 +36,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp index ade0263fbc590e96c3a27309c7c97737de5d708f..7e4aced7ea0df0d640c2c6177a774fd23b450062 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp @@ -36,7 +36,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( IndexType globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; /*** * Compute sums of elements in particular segments. diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forElements.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forElements.cpp index 8b34501678902dad0b37cdd021ae6f9f551b96e6..621a2123aeb7bddeedffc81e2690f9b81be9462d 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forElements.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forElements.cpp @@ -34,7 +34,7 @@ void SegmentsExample() std::cout << "Data setup with no check ... " << std::endl; std::cout << "Array: " << data << std::endl; auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ) << std::endl; + std::cout << segments.print( fetch ) << std::endl; /*** * Insert data into particular segments. @@ -50,7 +50,7 @@ void SegmentsExample() */ std::cout << "Data setup with check for padding elements..." << std::endl; std::cout << "Array: " << data << std::endl; - printSegments( segments, fetch, std::cout ) << std::endl; + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-1.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-1.cpp index d8be1f04c737c4c2e8da55dc2104741d445e5c96..fa81662e8ac24204b4c4a9161734aef61aaa0b5f 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-1.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-1.cpp @@ -39,7 +39,7 @@ void SegmentsExample() * Print the data managed by the segments. */ auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-2.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-2.cpp index a5d7d0caa943c658b9ffd86c36e24003f6c6d331..0439b846a156e4fe0b9c9ae4b08e6d4f76000b21 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-2.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_forSegments-2.cpp @@ -33,7 +33,7 @@ void SegmentsExample() */ std::cout << "Values of elements after intial setup: " << std::endl; auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ); /*** * Divide elements in each segment by a sum of all elements in the segment @@ -55,7 +55,7 @@ void SegmentsExample() * Print the data managed by the segments. */ std::cout << "Value of elements after dividing by sum in each segment:" << std::endl; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_reduceSegments.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_reduceSegments.cpp index c9a7476c724ec7cc36f9b7af4c3159bcc5e5af6e..e6701f36bbc31cefda7db5a9a226d8323eecd857 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_reduceSegments.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_reduceSegments.cpp @@ -36,7 +36,7 @@ void SegmentsExample() */ std::cout << "Values of elements after intial setup: " << std::endl; auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; /*** * Compute sums of elements in each segment. diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp index 8d98455a577fe7aafd79544d8e9f36333d5c0184..73d2e415d776705ae2463e228c65c223820d4755 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp @@ -32,7 +32,7 @@ void SegmentsExample() */ auto data_view = data.getView(); auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - printSegments( segments, fetch, std::cout ); + std::cout << segments.print( fetch ) << std::endl; std::cout << std::endl; } diff --git a/src/TNL/Algorithms/Segments/BiEllpack.h b/src/TNL/Algorithms/Segments/BiEllpack.h index ee202d25ce91aa8dccab7f80eb17e617b75913f7..3830d8e14190388e4f0656c92afcd206498dcda6 100644 --- a/src/TNL/Algorithms/Segments/BiEllpack.h +++ b/src/TNL/Algorithms/Segments/BiEllpack.h @@ -135,6 +135,9 @@ class BiEllpack void load(File &file); + template< typename Fetch > + SegmentsPrinter< BiEllpack, Fetch > print( Fetch&& fetch ) const; + void printStructure(std::ostream &str) const; // TODO: nvcc needs this public because of lambda function used inside diff --git a/src/TNL/Algorithms/Segments/BiEllpack.hpp b/src/TNL/Algorithms/Segments/BiEllpack.hpp index 1412d1be506d85437be8bc4db614c2c03b57097e..4bbccbb0eec375ec6d312adcc85e894bae4851c7 100644 --- a/src/TNL/Algorithms/Segments/BiEllpack.hpp +++ b/src/TNL/Algorithms/Segments/BiEllpack.hpp @@ -581,6 +581,19 @@ load( File& file ) >> this->groupPointers; } +template< typename Device, + typename Index, + typename IndexAllocator, + ElementsOrganization Organization, + int WarpSize > + template< typename Fetch > +auto +BiEllpack< Device, Index, IndexAllocator, Organization, WarpSize >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< BiEllpack, Fetch > +{ + return SegmentsPrinter< BiEllpack, Fetch >( *this, fetch ); +} + template< typename Device, typename Index, typename IndexAllocator, diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.h b/src/TNL/Algorithms/Segments/BiEllpackView.h index c0ae1559e83d0ddbf9d440bc0466c78a9c9e5291..62d60509c2cbbafc40eae5d0d3cf4ff5a6b3c0ff 100644 --- a/src/TNL/Algorithms/Segments/BiEllpackView.h +++ b/src/TNL/Algorithms/Segments/BiEllpackView.h @@ -138,6 +138,9 @@ class BiEllpackView void load( File& file ); + template< typename Fetch > + SegmentsPrinter< BiEllpackView, Fetch > print( Fetch&& fetch ) const; + void printStructure( std::ostream& str ) const; protected: diff --git a/src/TNL/Algorithms/Segments/BiEllpackView.hpp b/src/TNL/Algorithms/Segments/BiEllpackView.hpp index b480deac08392cd150f397afeb00535afc884af2..ab79d5833357146820d86a18ae9c69300ee57dce 100644 --- a/src/TNL/Algorithms/Segments/BiEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/BiEllpackView.hpp @@ -477,6 +477,18 @@ save( File& file ) const << this->groupPointers; } +template< typename Device, + typename Index, + ElementsOrganization Organization, + int WarpSize > + template< typename Fetch > +auto +BiEllpackView< Device, Index, Organization, WarpSize >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< BiEllpackView, Fetch > +{ + return SegmentsPrinter< BiEllpackView, Fetch >( *this, fetch ); +} + template< typename Device, typename Index, ElementsOrganization Organization, diff --git a/src/TNL/Algorithms/Segments/CSR.h b/src/TNL/Algorithms/Segments/CSR.h index f3f1aa88106a3ed9401b23ec27226ebb49b190c0..eebd186a6fef2f9c253a80118917e9a8fbf6dbbd 100644 --- a/src/TNL/Algorithms/Segments/CSR.h +++ b/src/TNL/Algorithms/Segments/CSR.h @@ -486,6 +486,27 @@ class CSR */ void load( File& file ); + /** + * \brief Return simple proxy object for insertion to output stream. + * + * The proxy object serves for wrapping segments with lambda function mediating access to data managed by the segments. + * + * \tparam Fetch is type of lambda function for data access. + * \param fetch is an instance of lambda function for data access. It is supposed to be defined as + * + * ``` + * auto fetch = [=] __cuda_callable__ ( IndexType globalIdx ) -> ValueType { return data_view[ globalIdx ]; }; + * ``` + * \return Proxy object for insertion to output stream. + * + * \par Example + * \include Algorithms/Segments/SegmentsPrintingExample-2.cpp + * \par Output + * \include SegmentsPrintingExample-2.out + */ + template< typename Fetch > + SegmentsPrinter< CSR, Fetch > print( Fetch&& fetch ) const; + protected: OffsetsContainer offsets; diff --git a/src/TNL/Algorithms/Segments/CSR.hpp b/src/TNL/Algorithms/Segments/CSR.hpp index b427f4acdee48540e9a725e1ac157d4a2c8bf26a..0d15790bf8f9b284f764532f15ac3e08df8754e8 100644 --- a/src/TNL/Algorithms/Segments/CSR.hpp +++ b/src/TNL/Algorithms/Segments/CSR.hpp @@ -368,6 +368,18 @@ load( File& file ) this->kernel.init( this->offsets ); } +template< typename Device, + typename Index, + typename Kernel, + typename IndexAllocator > + template< typename Fetch > +auto +CSR< Device, Index, Kernel, IndexAllocator >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< CSR, Fetch > +{ + return SegmentsPrinter< CSR, Fetch >( *this, fetch ); +} + } // namespace Segments } // namespace Algorithms } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/CSRView.h b/src/TNL/Algorithms/Segments/CSRView.h index 5daa3e7c288290d4b17289bcc5a3b24354fe5329..dee96ba5ad2080a78738780d5867f10ed88cddc3 100644 --- a/src/TNL/Algorithms/Segments/CSRView.h +++ b/src/TNL/Algorithms/Segments/CSRView.h @@ -139,6 +139,9 @@ class CSRView void load( File& file ); + template< typename Fetch > + SegmentsPrinter< CSRView, Fetch > print( Fetch&& fetch ) const; + protected: OffsetsView offsets; diff --git a/src/TNL/Algorithms/Segments/CSRView.hpp b/src/TNL/Algorithms/Segments/CSRView.hpp index 08822ca94884d17490ac80f3ee633b2bb3826d34..b69e61e5a9e3a7995ab5fe87ba9459f178c0f16d 100644 --- a/src/TNL/Algorithms/Segments/CSRView.hpp +++ b/src/TNL/Algorithms/Segments/CSRView.hpp @@ -318,6 +318,18 @@ load( File& file ) this->kernel.init( this->offsets ); } +template< typename Device, + typename Index, + typename Kernel > + template< typename Fetch > +auto +CSRView< Device, Index, Kernel >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< CSRView, Fetch > +{ + return SegmentsPrinter< CSRView, Fetch >( *this, fetch ); +} + + } // namespace Segments } // namespace Containers } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.h b/src/TNL/Algorithms/Segments/ChunkedEllpack.h index 5b0916d2011ac27ff1e1a3c02aa5697b2c53f713..1d4f9fabcdc53293d5240f14554209fab4902525 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpack.h +++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.h @@ -131,6 +131,9 @@ class ChunkedEllpack void load( File& file ); + template< typename Fetch > + SegmentsPrinter< ChunkedEllpack, Fetch > print( Fetch&& fetch ) const; + void printStructure( std::ostream& str ); // TODO const; protected: diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp index 82ddd7d8ed330194f36552aeda356a1e6c12b86b..e39a166707a644e7bae7d6b804d342e7c0d81f9f 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp +++ b/src/TNL/Algorithms/Segments/ChunkedEllpack.hpp @@ -534,6 +534,18 @@ load( File& file ) file.load( &this->numberOfSlices ); } +template< typename Device, + typename Index, + typename IndexAllocator, + ElementsOrganization Organization > + template< typename Fetch > +auto +ChunkedEllpack< Device, Index, IndexAllocator, Organization >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< ChunkedEllpack, Fetch > +{ + return SegmentsPrinter< ChunkedEllpack, Fetch >( *this, fetch ); +} + template< typename Device, typename Index, typename IndexAllocator, diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h index a20d5a41a6ced00bef0216aab66d6c2f9d3b0579..a54f8e5ef4a604838526dfba8bc64110ca3a9aa9 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.h +++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.h @@ -150,6 +150,9 @@ class ChunkedEllpackView void save( File& file ) const; + template< typename Fetch > + SegmentsPrinter< ChunkedEllpackView, Fetch > print( Fetch&& fetch ) const; + void printStructure( std::ostream& str ) const; protected: diff --git a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp index 5f73fd8ab2b8604351827bfe1cc86b3d5529dd04..6fc7671079b09a845f540887c51c6720a96a5571 100644 --- a/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/ChunkedEllpackView.hpp @@ -513,6 +513,18 @@ save( File& file ) const file.save( &this->numberOfSlices ); } +template< typename Device, + typename Index, + ElementsOrganization Organization > + template< typename Fetch > +auto +ChunkedEllpackView< Device, Index, Organization >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< ChunkedEllpackView, Fetch > +{ + return SegmentsPrinter< ChunkedEllpackView, Fetch >( *this, fetch ); +} + + template< typename Device, typename Index, ElementsOrganization Organization > diff --git a/src/TNL/Algorithms/Segments/Ellpack.h b/src/TNL/Algorithms/Segments/Ellpack.h index e68ebdf622bee61c5811697bdb24ea29b8c90c3c..c363d30003a0aa74d02d464e4096889741e37296 100644 --- a/src/TNL/Algorithms/Segments/Ellpack.h +++ b/src/TNL/Algorithms/Segments/Ellpack.h @@ -130,6 +130,9 @@ class Ellpack void load( File& file ); + template< typename Fetch > + SegmentsPrinter< Ellpack, Fetch > print( Fetch&& fetch ) const; + protected: IndexType segmentSize, size, alignedSize; diff --git a/src/TNL/Algorithms/Segments/Ellpack.hpp b/src/TNL/Algorithms/Segments/Ellpack.hpp index 589d9f9448ade93c809564f6f8669aa8263b3c04..27e7dcbe3cc8edc86a6bec5d5f15baf20d9aa002 100644 --- a/src/TNL/Algorithms/Segments/Ellpack.hpp +++ b/src/TNL/Algorithms/Segments/Ellpack.hpp @@ -383,6 +383,19 @@ load( File& file ) file.load( &alignedSize ); } +template< typename Device, + typename Index, + typename IndexAllocator, + ElementsOrganization Organization, + int Alignment > + template< typename Fetch > +auto +Ellpack< Device, Index, IndexAllocator, Organization, Alignment >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< Ellpack, Fetch > +{ + return SegmentsPrinter< Ellpack, Fetch >( *this, fetch ); +} + } // namespace Segments } // namespace Containers } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/EllpackView.h b/src/TNL/Algorithms/Segments/EllpackView.h index 0857886f2f1a1f45e7c4c5766b9a6cd2749336e5..6e4995e1d8dfd41952ba4112910bbc77c4bfd767 100644 --- a/src/TNL/Algorithms/Segments/EllpackView.h +++ b/src/TNL/Algorithms/Segments/EllpackView.h @@ -123,6 +123,9 @@ class EllpackView void load( File& file ); + template< typename Fetch > + SegmentsPrinter< EllpackView, Fetch > print( Fetch&& fetch ) const; + protected: IndexType segmentSize, segmentsCount, alignedSize; diff --git a/src/TNL/Algorithms/Segments/EllpackView.hpp b/src/TNL/Algorithms/Segments/EllpackView.hpp index 1ec928336ba7618d29fc09d84b19ac813d8ad285..18f1cde7b320e0edf340809bb0437ccd9dc6edc2 100644 --- a/src/TNL/Algorithms/Segments/EllpackView.hpp +++ b/src/TNL/Algorithms/Segments/EllpackView.hpp @@ -357,6 +357,18 @@ load( File& file ) file.load( &alignedSize ); } +template< typename Device, + typename Index, + ElementsOrganization Organization, + int Alignment > + template< typename Fetch > +auto +EllpackView< Device, Index, Organization, Alignment >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< EllpackView, Fetch > +{ + return SegmentsPrinter< EllpackView, Fetch >( *this, fetch ); +} + } // namespace Segments } // namespace Algorithms } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/SegmentsPrinting.h b/src/TNL/Algorithms/Segments/SegmentsPrinting.h index 5018471b353555c6f3c0aaede92001ddbf45927a..260ad71e8d38e762a5d4af2e8d76724e4a7c92ea 100644 --- a/src/TNL/Algorithms/Segments/SegmentsPrinting.h +++ b/src/TNL/Algorithms/Segments/SegmentsPrinting.h @@ -99,6 +99,30 @@ std::ostream& printSegments( const Segments& segments, Fetch&& fetch, std::ostre return str; } + +template< typename Segments, + typename Fetch > +struct SegmentsPrinter +{ + SegmentsPrinter( const Segments& segments, Fetch& fetch ) + : segments( segments ), fetch( fetch ) {} + + std::ostream& print( std::ostream& str ) const { return printSegments( segments, fetch, str ); } + + protected: + + const Segments& segments; + + Fetch& fetch; +}; + +template< typename Segments, + typename Fetch > +std::ostream& operator<<( std::ostream& str, const SegmentsPrinter< Segments, Fetch >& printer ) +{ + return printer.print( str ); +} + } // namespace Segments } // namespace Algorithms } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/SlicedEllpack.h b/src/TNL/Algorithms/Segments/SlicedEllpack.h index 092af6a1f10c72972a1ea6d9ef6f43b4150cef8b..974087e4b8ca8b8e8936b96838a6ae4b1ff8575e 100644 --- a/src/TNL/Algorithms/Segments/SlicedEllpack.h +++ b/src/TNL/Algorithms/Segments/SlicedEllpack.h @@ -127,6 +127,9 @@ class SlicedEllpack void load( File& file ); + template< typename Fetch > + SegmentsPrinter< SlicedEllpack, Fetch > print( Fetch&& fetch ) const; + protected: IndexType size, alignedSize, segmentsCount; diff --git a/src/TNL/Algorithms/Segments/SlicedEllpack.hpp b/src/TNL/Algorithms/Segments/SlicedEllpack.hpp index 6c58c3ed13b3502dc29d96e22589bb56e9e7210c..8a4903cbd6d1c8d5f2f9b156d508fd5835e55459 100644 --- a/src/TNL/Algorithms/Segments/SlicedEllpack.hpp +++ b/src/TNL/Algorithms/Segments/SlicedEllpack.hpp @@ -423,6 +423,19 @@ load( File& file ) file >> this->sliceSegmentSizes; } +template< typename Device, + typename Index, + typename IndexAllocator, + ElementsOrganization Organization, + int SliceSize > + template< typename Fetch > +auto +SlicedEllpack< Device, Index, IndexAllocator, Organization, SliceSize >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< SlicedEllpack, Fetch > +{ + return SegmentsPrinter< SlicedEllpack, Fetch >( *this, fetch ); +} + } // namespace Segments } // namespace Algorithms } // namespace TNL diff --git a/src/TNL/Algorithms/Segments/SlicedEllpackView.h b/src/TNL/Algorithms/Segments/SlicedEllpackView.h index e614f9dc0ebca33678f7d05b0ef4bcce48d47ec3..16e2c082f55f14045e6dcd1ca66877f9478ddbf8 100644 --- a/src/TNL/Algorithms/Segments/SlicedEllpackView.h +++ b/src/TNL/Algorithms/Segments/SlicedEllpackView.h @@ -121,6 +121,9 @@ class SlicedEllpackView void load( File& file ); + template< typename Fetch > + SegmentsPrinter< SlicedEllpackView, Fetch > print( Fetch&& fetch ) const; + protected: IndexType size, alignedSize, segmentsCount; diff --git a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp index 871aa2da05eba9b4a3d0bd474589ea5a183e4969..5b97c72e20b6c84601cb7f078c6a1af9d742bffd 100644 --- a/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp +++ b/src/TNL/Algorithms/Segments/SlicedEllpackView.hpp @@ -427,6 +427,18 @@ load( File& file ) file >> this->sliceSegmentSizes; } +template< typename Device, + typename Index, + ElementsOrganization Organization, + int SliceSize > + template< typename Fetch > +auto +SlicedEllpackView< Device, Index, Organization, SliceSize >:: +print( Fetch&& fetch ) const -> SegmentsPrinter< SlicedEllpackView, Fetch > +{ + return SegmentsPrinter< SlicedEllpackView, Fetch >( *this, fetch ); +} + } // namespace Segments } // namespace Algorithms } // namespace TNL