From a4ca817cdd157160807a9f059c00d7ccb7515596 Mon Sep 17 00:00:00 2001
From: Ellis <eshoag@illinois.edu>
Date: Wed, 18 Oct 2017 00:08:36 -0500
Subject: [PATCH] working

---
 grudge/execution.py                 |  2 ++
 grudge/symbolic/mappers/__init__.py | 13 +++++++++++++
 grudge/symbolic/operators.py        |  1 +
 grudge/symbolic/primitives.py       |  4 +++-
 4 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/grudge/execution.py b/grudge/execution.py
index ec0d6c6..d6725f2 100644
--- a/grudge/execution.py
+++ b/grudge/execution.py
@@ -575,6 +575,8 @@ def process_sym_operator(sym_operator, post_bind_mapper=None,
     # dumper("before-derivative-join", sym_operator)
     # sym_operator = mappers.DerivativeJoiner()(sym_operator)
 
+    sys_operator = mappers.DistributedMapper()(sym_operator)
+
     dumper("process-finished", sym_operator)
 
     return sym_operator
diff --git a/grudge/symbolic/mappers/__init__.py b/grudge/symbolic/mappers/__init__.py
index 60b489c..ae67662 100644
--- a/grudge/symbolic/mappers/__init__.py
+++ b/grudge/symbolic/mappers/__init__.py
@@ -331,6 +331,19 @@ class OperatorBinder(CSECachingMapperMixin, IdentityMapper):
 # }}}
 
 
+class DistributedMapper(CSECachingMapperMixin, IdentityMapper):
+
+    # FIXME: Not sure what this is
+    map_common_subexpression_uncached = IdentityMapper.map_common_subexpression
+
+    def map_operator_binding(self, expr):
+        if isinstance(expr.op, op.OppositeInteriorFaceSwap):
+            return 42
+            # return expr.op + op.OppositeRankFaceSwap()(self.rec(expr.field))
+        else:
+            return IdentityMapper.map_operator_binding(self, expr)
+
+
 # {{{ operator specializer
 
 class OperatorSpecializer(CSECachingMapperMixin, IdentityMapper):
diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py
index 70c43a1..23ca69b 100644
--- a/grudge/symbolic/operators.py
+++ b/grudge/symbolic/operators.py
@@ -383,6 +383,7 @@ class OppositeRankFaceSwap(Operator):
     def __init__(self, dd_in=None, dd_out=None):
         sym = _sym()
 
+        from meshmode.mesh import BTAG_PARTITION
         if dd_in is None:
             dd_in = sym.DOFDesc(BTAG_PARTITION, None)
         if dd_out is None:
diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py
index 11d5ae8..4fe9b13 100644
--- a/grudge/symbolic/primitives.py
+++ b/grudge/symbolic/primitives.py
@@ -28,7 +28,7 @@ from six.moves import range, intern
 
 import numpy as np
 import pymbolic.primitives
-from meshmode.mesh import BTAG_ALL, BTAG_REALLY_ALL, BTAG_NONE  # noqa
+from meshmode.mesh import BTAG_ALL, BTAG_REALLY_ALL, BTAG_NONE, BTAG_PARTITION  # noqa
 from meshmode.discretization.connection import (  # noqa
         FRESTR_ALL_FACES, FRESTR_INTERIOR_FACES)
 
@@ -183,6 +183,8 @@ class DOFDesc(object):
             pass
         elif domain_tag in [BTAG_ALL, BTAG_REALLY_ALL, BTAG_NONE]:
             pass
+        elif domain_tag is BTAG_PARTITION:
+            pass
         elif isinstance(domain_tag, DTAG_BOUNDARY):
             pass
         else:
-- 
GitLab