From 6a9610a2c0e60f821e96681129f7c00a7badef37 Mon Sep 17 00:00:00 2001
From: Alexandru Fikl <alexfikl@gmail.com>
Date: Sun, 17 May 2020 21:10:08 -0500
Subject: [PATCH] add docs for reduction operators

---
 doc/conf.py                  | 12 ++++++------
 grudge/execution.py          |  2 +-
 grudge/symbolic/operators.py | 21 ++++++++++++++++++++-
 test/test_grudge.py          |  2 +-
 4 files changed, 28 insertions(+), 9 deletions(-)

diff --git a/doc/conf.py b/doc/conf.py
index 560efec5..6bb94873 100644
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -319,12 +319,12 @@ texinfo_documents = [
 
 # Example configuration for intersphinx: refer to the Python standard library.
 intersphinx_mapping = {
-    'http://docs.python.org/': None,
-    'http://docs.scipy.org/doc/numpy/': None,
-    'http://documen.tician.de/pyopencl/': None,
-    'http://documen.tician.de/modepy/': None,
-    'http://documen.tician.de/pymbolic/': None,
-    'http://documen.tician.de/meshmode/': None,
+    'https://docs.python.org/': None,
+    'https://docs.scipy.org/doc/numpy/': None,
+    'https://documen.tician.de/pyopencl/': None,
+    'https://documen.tician.de/modepy/': None,
+    'https://documen.tician.de/pymbolic/': None,
+    'https://documen.tician.de/meshmode/': None,
     #'http://documen.tician.de/loopy/': None,
     }
 autoclass_content = "both"
diff --git a/grudge/execution.py b/grudge/execution.py
index 5423eb0a..a95b15e7 100644
--- a/grudge/execution.py
+++ b/grudge/execution.py
@@ -123,7 +123,7 @@ class ExecutionMapper(mappers.Evaluator,
 
         result = discr.empty(queue=self.queue, dtype=field.dtype,
                 allocator=self.bound_op.allocator)
-        for igrp, grp in enumerate(discr.groups):
+        for grp in discr.groups:
             knl()(self.queue,
                     operand=grp.view(field),
                     result=grp.view(result))
diff --git a/grudge/symbolic/operators.py b/grudge/symbolic/operators.py
index 5678d4fb..2722e161 100644
--- a/grudge/symbolic/operators.py
+++ b/grudge/symbolic/operators.py
@@ -43,6 +43,8 @@ Basic Operators
 Reductions
 ^^^^^^^^^^
 
+.. autoclass:: ElementwiseSumOperator
+.. autoclass:: ElementwiseMinOperator
 .. autoclass:: ElementwiseMaxOperator
 
 .. autoclass:: NodalReductionOperator
@@ -178,14 +180,26 @@ class ElementwiseReductionOperator(Operator):
 
 
 class ElementwiseSumOperator(ElementwiseReductionOperator):
+    """Returns a vector of DOFs with all entries on each element set
+    to the sum of DOFs on that element.
+    """
+
     mapper_method = intern("map_elementwise_sum")
 
 
 class ElementwiseMinOperator(ElementwiseReductionOperator):
+    """Returns a vector of DOFs with all entries on each element set
+    to the minimum of DOFs on that element.
+    """
+
     mapper_method = intern("map_elementwise_min")
 
 
 class ElementwiseMaxOperator(ElementwiseReductionOperator):
+    """Returns a vector of DOFs with all entries on each element set
+    to the maximum of DOFs on that element.
+    """
+
     mapper_method = intern("map_elementwise_max")
 
 # }}}
@@ -702,7 +716,12 @@ def norm(p, arg, dd=None):
         raise ValueError("unsupported value of p")
 
 
-def h_max(ambient_dim, dim=None, dd=None):
+def h_max_from_volume(ambient_dim, dim=None, dd=None):
+    """Defines a characteristic length based on the volume of the elements.
+    This length may not be representative if the elements have very high
+    aspect ratios.
+    """
+
     import grudge.symbolic.primitives as prim
     if dd is None:
         dd = prim.DD_VOLUME
diff --git a/test/test_grudge.py b/test/test_grudge.py
index 3d92db15..53bd4975 100644
--- a/test/test_grudge.py
+++ b/test/test_grudge.py
@@ -334,7 +334,7 @@ def test_convergence_advec(ctx_factory, mesh_name, mesh_pars, op_type, flux_type
         else:
             final_time = 0.2
 
-        h_max = bind(discr, sym.h_max(discr.ambient_dim))(queue)
+        h_max = bind(discr, sym.h_max_from_volume(discr.ambient_dim))(queue)
         dt = dt_factor * h_max/order**2
         nsteps = (final_time // dt) + 1
         dt = final_time/nsteps + 1e-15
-- 
GitLab