diff --git a/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp b/Documentation/Examples/Algorithms/Segments/SegmentsExample_CSR_constructor_1.cpp index ed25d6df477fd7115490242f4dce88dd3f65ce62..0ceb7a6bd496932c7cb79bca153378f59d3911f0 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 a71c51519e13b31addefbedfe865d3545da65825..9493758b4954d8056a5398c3134b46c072608ea9 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 26499804622aaf3da1e15129a05f1a50a0899364..37267a889fd87a5880e24de6d0d0ed1a83d6402b 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 f2eb0ae13ae66198008d4d8299f2d819bbf96d8e..3bf7cc50bd46dd6dc2bc72d78d9bc47700fa2589 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 d64fdbfde07cb3d68ee9dd28c43fc4926098c19b..ade0263fbc590e96c3a27309c7c97737de5d708f 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsExample_General.cpp @@ -35,10 +35,8 @@ void SegmentsExample() /*** * Print the data managed by the segments. */ - std::cerr << data << std::endl; 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 621a2123aeb7bddeedffc81e2690f9b81be9462d..7d7eac76c1285720c740add0f75711a33f958b8f 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); /*** * 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; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 fa81662e8ac24204b4c4a9161734aef61aaa0b5f..d8be1f04c737c4c2e8da55dc2104741d445e5c96 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 0439b846a156e4fe0b9c9ae4b08e6d4f76000b21..a5d7d0caa943c658b9ffd86c36e24003f6c6d331 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 ]; }; - std::cout << segments.print( fetch ); + printSegments( segments, fetch, std::cout ); /*** * 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; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); } 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 e6701f36bbc31cefda7db5a9a226d8323eecd857..c9a7476c724ec7cc36f9b7af4c3159bcc5e5af6e 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 ]; }; - std::cout << segments.print( fetch ) << std::endl; + printSegments( segments, fetch, std::cout ); /*** * 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 73d2e415d776705ae2463e228c65c223820d4755..8f25b8bad929cae6863356196ba107a17f29154e 100644 --- a/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp +++ b/Documentation/Examples/Algorithms/Segments/SegmentsPrintingExample-2.cpp @@ -32,8 +32,7 @@ void SegmentsExample() */ auto data_view = data.getView(); auto fetch = [=] __cuda_callable__ ( int globalIdx ) -> double { return data_view[ globalIdx ]; }; - std::cout << segments.print( fetch ) << std::endl; - std::cout << std::endl; + printSegments( segments, fetch, std::cout ) << std::endl; } int main( int argc, char* argv[] ) diff --git a/src/TNL/Algorithms/Segments/SegmentsPrinting.h b/src/TNL/Algorithms/Segments/SegmentsPrinting.h index fa5d6c62841c1a8b4052bd424fd21e5cf1594887..f8fd7412edc134c3c5454d2fca819b53b16e0474 100644 --- a/src/TNL/Algorithms/Segments/SegmentsPrinting.h +++ b/src/TNL/Algorithms/Segments/SegmentsPrinting.h @@ -92,12 +92,12 @@ struct SegmentsPrinter Fetch fetch; }; -template< typename Segments, +/*template< typename Segments, typename Fetch > std::ostream& operator<<( std::ostream& str, const SegmentsPrinter< Segments, Fetch >& printer ) { return printer.print( str ); -} +}*/ template< typename Segments, typename Fetch >