From eb5a9595b6627a661019bd78d3551a4f80177f38 Mon Sep 17 00:00:00 2001
From: Andreas Kloeckner <inform@tiker.net>
Date: Tue, 20 Oct 2015 11:13:42 -0500
Subject: [PATCH] Predeclare a few often-used C functions

---
 grudge/symbolic/primitives.py | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/grudge/symbolic/primitives.py b/grudge/symbolic/primitives.py
index 5a179532..3eb69dac 100644
--- a/grudge/symbolic/primitives.py
+++ b/grudge/symbolic/primitives.py
@@ -128,6 +128,12 @@ class CFunction(pymbolic.primitives.Variable):
 
     mapper_method = "map_c_function"
 
+
+sqrt = CFunction("sqrt")
+exp = CFunction("exp")
+sin = CFunction("sin")
+cos = CFunction("cos")
+
 # }}}
 
 
@@ -394,7 +400,7 @@ def pseudoscalar(ambient_dim, dim=None, where=None, quadrature_tag=None):
 
 def area_element(ambient_dim, dim=None, where=None, quadrature_tag=None):
     return cse(
-            CFunction("sqrt")(
+            sqrt(
                 pseudoscalar(ambient_dim, dim, where, quadrature_tag=quadrature_tag)
                 .norm_squared()),
             "area_element", cse_scope.DISCRETIZATION)
-- 
GitLab