From 2a91c9a85f239dfd937b8e239275377686097415 Mon Sep 17 00:00:00 2001
From: Alex Fikl <alexfikl@gmail.com>
Date: Tue, 27 Feb 2018 08:06:51 -0600
Subject: [PATCH] make nranges be equal to the number of blocks

---
 sumpy/p2p.py | 8 ++++----
 sumpy/qbx.py | 8 ++++----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/sumpy/p2p.py b/sumpy/p2p.py
index 422a3c92..d8586cc2 100644
--- a/sumpy/p2p.py
+++ b/sumpy/p2p.py
@@ -291,8 +291,8 @@ class P2PMatrixBlockGenerator(SingleSrcTgtListP2PBase):
             + [
                 lp.GlobalArg("srcindices", None, shape="nsrcindices"),
                 lp.GlobalArg("tgtindices", None, shape="ntgtindices"),
-                lp.GlobalArg("srcranges", None, shape="nranges"),
-                lp.GlobalArg("tgtranges", None, shape="nranges"),
+                lp.GlobalArg("srcranges", None, shape="nranges + 1"),
+                lp.GlobalArg("tgtranges", None, shape="nranges + 1"),
                 lp.ValueArg("nsrcindices", np.int32),
                 lp.ValueArg("ntgtindices", np.int32),
                 lp.ValueArg("nranges", None)
@@ -300,7 +300,7 @@ class P2PMatrixBlockGenerator(SingleSrcTgtListP2PBase):
 
     def get_domains(self):
         return [
-                "{[irange]: 0 <= irange < nranges - 1}",
+                "{[irange]: 0 <= irange < nranges}",
                 "{[j, k]: 0 <= j < tgt_length and 0 <= k < src_length}",
                 "{[idim]: 0 <= idim < dim}"
                 ]
@@ -348,7 +348,7 @@ class P2PMatrixBlockGenerator(SingleSrcTgtListP2PBase):
                 ]
 
     def get_assumptions(self):
-        return "nranges>=2"
+        return "nranges>=1"
 
     def get_optimized_kernel(self, targets_is_obj_array, sources_is_obj_array):
         # FIXME
diff --git a/sumpy/qbx.py b/sumpy/qbx.py
index 50d41464..0f617e62 100644
--- a/sumpy/qbx.py
+++ b/sumpy/qbx.py
@@ -327,8 +327,8 @@ class LayerPotentialMatrixBlockGenerator(LayerPotentialBase):
             + [
                 lp.GlobalArg("srcindices", None, shape="nsrcindices"),
                 lp.GlobalArg("tgtindices", None, shape="ntgtindices"),
-                lp.GlobalArg("srcranges", None, shape="nranges"),
-                lp.GlobalArg("tgtranges", None, shape="nranges"),
+                lp.GlobalArg("srcranges", None, shape="nranges + 1"),
+                lp.GlobalArg("tgtranges", None, shape="nranges + 1"),
                 lp.ValueArg("nsrcindices", np.int32),
                 lp.ValueArg("ntgtindices", np.int32),
                 lp.ValueArg("nranges", None)
@@ -337,7 +337,7 @@ class LayerPotentialMatrixBlockGenerator(LayerPotentialBase):
     def get_domains(self):
         # FIXME: this doesn't work when separating j and k
         return [
-                "{[irange]: 0 <= irange < nranges - 1}",
+                "{[irange]: 0 <= irange < nranges}",
                 "{[j, k]: 0 <= j < tgt_length and 0 <= k < src_length}",
                 "{[idim]: 0 <= idim < dim}"
                 ]
@@ -385,7 +385,7 @@ class LayerPotentialMatrixBlockGenerator(LayerPotentialBase):
                 ]
 
     def get_assumptions(self):
-        return "nranges>=2"
+        return "nranges>=1"
 
     @memoize_method
     def get_optimized_kernel(self):
-- 
GitLab