From b7b4afa81a9c71ee270bbbb6e07af716755c389d Mon Sep 17 00:00:00 2001
From: Thomas Gibson <gibsonthomas1120@hotmail.com>
Date: Wed, 26 May 2021 13:34:42 -0500
Subject: [PATCH] Test equivalence of nodes/normal routines for dcoll

---
 test/test_grudge.py | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/test/test_grudge.py b/test/test_grudge.py
index 41a52edf..83b084b4 100644
--- a/test/test_grudge.py
+++ b/test/test_grudge.py
@@ -1055,6 +1055,43 @@ def test_empty_boundary(actx_factory):
         assert len(component) == len(dcoll.discr_from_dd(BTAG_NONE).groups)
 
 
+# {{{ DiscretizationCollection testing
+
+def test_dcoll_nodes_and_normals(actx_factory):
+    actx = actx_factory()
+
+    from meshmode.mesh import BTAG_ALL
+    from meshmode.mesh.generation import generate_warped_rect_mesh
+
+    mesh = generate_warped_rect_mesh(dim=2, order=4, nelements_side=6)
+
+    dcoll = DiscretizationCollection(actx, mesh, order=3)
+
+    # Nodes should be *indentical*
+    nodes = thaw(op.nodes(dcoll), actx)
+    dcoll_nodes = thaw(dcoll.nodes(), actx)
+
+    assert op.norm(dcoll, nodes - dcoll_nodes, np.inf) == 0.0
+
+    nodes_btag = thaw(op.nodes(dcoll, BTAG_ALL), actx)
+    dcoll_nodes_btag = thaw(dcoll.nodes(BTAG_ALL), actx)
+
+    assert op.norm(dcoll, nodes_btag - dcoll_nodes_btag, np.inf) == 0.0
+
+    # Normals should be *indentical*
+    normals = thaw(op.normal(dcoll, "int_faces"), actx)
+    dcoll_normals = thaw(dcoll.normal("int_faces"), actx)
+
+    assert op.norm(dcoll, normals - dcoll_normals, np.inf) == 0.0
+
+    normals_btag = thaw(op.normal(dcoll, BTAG_ALL), actx)
+    dcoll_normals_btag = thaw(dcoll.normal(BTAG_ALL), actx)
+
+    assert op.norm(dcoll, normals_btag - dcoll_normals_btag, np.inf) == 0.0
+
+# }}}
+
+
 # You can test individual routines by typing
 # $ python test_grudge.py 'test_routine()'
 
-- 
GitLab