From e4dec607f64ad71d4c7aeb048251bc34996ce5a8 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Fri, 16 Sep 2016 19:03:09 -0500
Subject: [PATCH] Check length of refine_flags in refiner

---
 meshmode/mesh/refinement/__init__.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/meshmode/mesh/refinement/__init__.py b/meshmode/mesh/refinement/__init__.py
index ac2f9833..cb001e32 100644
--- a/meshmode/mesh/refinement/__init__.py
+++ b/meshmode/mesh/refinement/__init__.py
@@ -348,6 +348,10 @@ class Refiner(object):
             indicating which elements should be split.
         """
 
+        if len(refine_flags) != self.last_mesh.nelements:
+            raise ValueError("length of refine_flags does not match "
+                    "element count of last generated mesh")
+
         #vertices and groups for next generation
         nvertices = len(self.last_mesh.vertices[0])
 
-- 
GitLab