Git Product home page Git Product logo

Comments (7)

dham avatar dham commented on July 29, 2024 1

Oh, I see. The MathFunction handler assumes there is only one argument.

from firedrake.

dham avatar dham commented on July 29, 2024 1

Those PRs have landed and I have updated our UFL fork. I believe this is now fixed.

from firedrake.

angus-g avatar angus-g commented on July 29, 2024

We've just hit this too, looks like there are a couple of causes:

  1. The ufl.utils.formatting.camel2undercase function still translates Atan2 -> atan_2, so the differentation handler isn't set up to a valid function.
  2. TSFC doesn't set up the correct multifunction handler (it's still called atan_2 over there: https://github.com/firedrakeproject/tsfc/blob/b378c0879fea5a7cc88cabf9eae6c52b9921c34b/tsfc/ufl2gem.py#L81-L82)

This seems to be a sufficient patch to catch the missing changes:

diff --git a/ufl/utils/formatting.py b/ufl/utils/formatting.py
index d35164be..4df63cd9 100644
--- a/ufl/utils/formatting.py
+++ b/ufl/utils/formatting.py
@@ -11,7 +11,7 @@ def camel2underscore(name):
     letters = []
     lastlower = False
     for i in name:
-        thislower = i.islower()
+        thislower = i.islower() or i.isdigit()
         if not thislower:
             # Don't insert _ between multiple upper case letters
             if lastlower:
diff --git a/tsfc/ufl2gem.py b/tsfc/ufl2gem.py
index fc1c760..e283fb1 100644
--- a/tsfc/ufl2gem.py
+++ b/tsfc/ufl2gem.py
@@ -78,7 +78,7 @@ class Mixin(object):
     def math_function(self, o, expr):
         return MathFunction(o._name, expr)
 
-    def atan_2(self, o, y, x):
+    def atan2(self, o, y, x):
         return MathFunction("atan2", y, x)
 
     def bessel_i(self, o, nu, arg):

from firedrake.

dham avatar dham commented on July 29, 2024

I think the TSFC thing is a red herring, because atan2 will get caught by the generic MathFunction handler on line 78. We should probably delete the atan_2 handler.

from firedrake.

angus-g avatar angus-g commented on July 29, 2024

Curious, I needed that fix after making the change in UFL. There's a traceback in g-adopt/g-adopt#22 (comment) showing the result with only the UFL fix. It does seem to make more sense to use the generic handler, however.

from firedrake.

dham avatar dham commented on July 29, 2024

FEniCS/ufl#216

from firedrake.

dham avatar dham commented on July 29, 2024

also firedrakeproject/tsfc#299

from firedrake.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.