From d92d27f6e32c26742545e9944cef2fe5f4509e3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Oberhuber?= <oberhuber.tomas@gmail.com>
Date: Mon, 1 Feb 2021 16:30:00 +0100
Subject: [PATCH] Added offsets getter to CSR segments.

---
 src/TNL/Algorithms/Segments/CSR.h   |  4 ++++
 src/TNL/Algorithms/Segments/CSR.hpp | 22 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/src/TNL/Algorithms/Segments/CSR.h b/src/TNL/Algorithms/Segments/CSR.h
index a05dccf29a..fd5a80fd84 100644
--- a/src/TNL/Algorithms/Segments/CSR.h
+++ b/src/TNL/Algorithms/Segments/CSR.h
@@ -96,6 +96,10 @@ class CSR
       __cuda_callable__
       SegmentViewType getSegmentView( const IndexType segmentIdx ) const;
 
+      const OffsetsHolder& getOffsets() const;
+
+      OffsetsHolder& getOffsets();
+
       /***
        * \brief Go over all segments and for each segment element call
        * function 'f' with arguments 'args'. The return type of 'f' is bool.
diff --git a/src/TNL/Algorithms/Segments/CSR.hpp b/src/TNL/Algorithms/Segments/CSR.hpp
index d6a177f3be..6ea5c49f7a 100644
--- a/src/TNL/Algorithms/Segments/CSR.hpp
+++ b/src/TNL/Algorithms/Segments/CSR.hpp
@@ -201,6 +201,28 @@ getSegmentView( const IndexType segmentIdx ) const -> SegmentViewType
    return SegmentViewType( offsets[ segmentIdx ], offsets[ segmentIdx + 1 ] - offsets[ segmentIdx ] );
 }
 
+template< typename Device,
+          typename Index,
+          typename Kernel,
+          typename IndexAllocator >
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::
+getOffsets() const -> const OffsetsHolder&
+{
+   return this->offsets;
+}
+
+template< typename Device,
+          typename Index,
+          typename Kernel,
+          typename IndexAllocator >
+auto
+CSR< Device, Index, Kernel, IndexAllocator >::
+getOffsets() -> OffsetsHolder&
+{
+   return this->offsets;
+}
+
 template< typename Device,
           typename Index,
           typename Kernel,
-- 
GitLab