From 1cba047a1d58e593f8896c05afbc8a145a7746e8 Mon Sep 17 00:00:00 2001
From: Mark Olesen <Mark.Olesen@esi-group.com>
Date: Thu, 11 Apr 2019 15:35:49 +0200
Subject: [PATCH] ENH: add indirect slicing list (#1220)

---
 .../test/sliceRange/Test-sliceRange.C         | 25 +++++++++++++++++--
 .../Lists/IndirectList/IndirectList.H         |  1 -
 .../containers/Lists/SliceList/SliceList.H    |  4 +--
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/applications/test/sliceRange/Test-sliceRange.C b/applications/test/sliceRange/Test-sliceRange.C
index 5b38e93f36..f398c6fbbe 100644
--- a/applications/test/sliceRange/Test-sliceRange.C
+++ b/applications/test/sliceRange/Test-sliceRange.C
@@ -30,10 +30,9 @@ Description
 #include "FixedList.H"
 #include "sliceRange.H"
 #include "SliceList.H"
+#include "IndirectList.H"
 #include "Random.H"
 
-#include "UIndirectList2.H"
-
 using namespace Foam;
 
 
@@ -158,6 +157,28 @@ int main(int argc, char *argv[])
 
         // Changed list via slice:
         Info<< nl << "Changed via slice: " << flatOutput(list1) << nl;
+
+        // Some indirect list
+
+        IndirectList<scalar> indlist
+        (
+            list1,
+            identity(slice1.size(), list1.size()-slice1.size())
+        );
+
+        Info<< nl << "Indirect slice: " << flatOutput(indlist) << nl;
+
+        indlist = 1000;
+        Info<< nl << "zeroed slice: " << flatOutput(indlist) << nl;
+
+        slice1 = indlist;
+
+        Info<< nl << "self-copy: " << flatOutput(list1) << nl;
+
+        slice1 = 100000;
+
+        Info<< nl << "set values: " << flatOutput(slice1) << nl
+            << " = " << flatOutput(list1) << nl;
     }
 
     Info<< "\nEnd\n" << endl;
diff --git a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H
index 1b467d99a7..1e14060953 100644
--- a/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H
+++ b/src/OpenFOAM/containers/Lists/IndirectList/IndirectList.H
@@ -54,7 +54,6 @@ namespace Foam
 
 template<class T>
 class IndirectList
-:
 :
     private Detail::IndirectListAddressing<labelList>,
     public UIndirectList<T>
diff --git a/src/OpenFOAM/containers/Lists/SliceList/SliceList.H b/src/OpenFOAM/containers/Lists/SliceList/SliceList.H
index 5908c6c1cf..d7fbb99697 100644
--- a/src/OpenFOAM/containers/Lists/SliceList/SliceList.H
+++ b/src/OpenFOAM/containers/Lists/SliceList/SliceList.H
@@ -41,8 +41,8 @@ SourceFiles
 #ifndef SliceList_H
 #define SliceList_H
 
+#include "IndirectListAddressing.H"
 #include "IndirectListDetail.H"
-#include "IndirectListDetailAddressing.H"
 #include "sliceRange.H"
 
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -96,7 +96,7 @@ public:
         template<class AnyAddr>
         inline void operator=(const Detail::IndirectList<T, AnyAddr>& rhs)
         {
-            copyValues(rhs);
+            this->copyValues(rhs);
         }
 
 
-- 
GitLab