'atan_2' is not a member of 'std'

Issue #147 resolved
Eric Chen created an issue

The following snippet raises a FFCJitError:

from dolfin import *

# Just need to call something that will call the JIT compiler:
mesh = UnitSquareMesh(10, 10)
x = SpatialCoordinate(mesh)
project(atan_2(x[0], x[1]), FunctionSpace(mesh, 'P', 1))

And in the resulting error.log that gets created it says:

#!

/tmp/tmpvpaia3_h/ffc_form_eeb4a2e8d04a9cff29951d50959be95c0baedf65.cpp:109:18: error: atan_2 is not a member of std
         sv6[0] = std::atan_2(x_c0, x_c1);

If I manually edit the cpp file and change atan_2 to atan2 and run the recompile.sh script then all is well.

This is with 2017.1.0 using both the Docker image and Anaconda build on Linux.

Comments (4)

  1. Eric Chen reporter

    I edited ffc/uflacs/language/ufl_to_cnodes.py from:

        def atan_2(self, o, y, x):
            return self._cmath("atan_2", (y, x))
    

    to:

        def atan_2(self, o, y, x):
            return self._cmath("atan2", (y, x))
    

    And that fixes the issue but I'm not sure if this will break anything else.

  2. Log in to comment