Skip to content

Commit

Permalink
Deal with items like Neg (for now)
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed Aug 15, 2023
1 parent a2652c9 commit 9ca5789
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ffcx/codegeneration/C/c_implementation.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#
# SPDX-License-Identifier: LGPL-3.0-or-later

import warnings
import ffcx.codegeneration.lnodes as L
from ffcx.codegeneration.utils import scalar_to_value_type

Expand Down Expand Up @@ -274,10 +275,14 @@ def format_symbol(self, s) -> str:

def format_math_function(self, c) -> str:
# Get a table of functions for this type, if available
if c.args[0].dtype == L.DataType.REAL:
dtype_math_table = math_table.get(self.real_type, {})
elif c.args[0].dtype == L.DataType.SCALAR:
dtype_math_table = math_table.get(self.scalar_type, {})
arg_type = self.scalar_type
if hasattr(c.args[0], "dtype"):
if c.args[0].dtype == L.DataType.REAL:
arg_type = self.real_type
else:
warnings.warn(f"Syntax item without dtype {c.args[0]}")

dtype_math_table = math_table.get(arg_type, {})

# Get a function from the table, if available, else just use bare name
func = dtype_math_table.get(c.function, c.function)
Expand Down

0 comments on commit 9ca5789

Please sign in to comment.