Skip to content

Commit 9819a06

Browse files
committed
null pointer for kernels that are not defined
1 parent 7289483 commit 9819a06

File tree

2 files changed

+19
-3
lines changed

2 files changed

+19
-3
lines changed

ffcx/codegeneration/C/integrals.py

+14-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,14 @@ def generator(ir, options):
5656
code["additional_includes_set"] = set() # FIXME: Get this out of code[]
5757
code["tabulate_tensor"] = body
5858

59+
code["tabulate_tensor_float32"] = "NULL"
60+
code["tabulate_tensor_float64"] = "NULL"
61+
code["tabulate_tensor_longdouble"] = "NULL"
62+
code["tabulate_tensor_complex64"] = "NULL"
63+
code["tabulate_tensor_complex128"] = "NULL"
64+
np_scalar_type=np.dtype(options["scalar_type"]).name
65+
code[f"tabulate_tensor_{np_scalar_type}"] = f"tabulate_tensor_{factory_name}"
66+
5967
implementation = ufcx_integrals.factory.format(
6068
factory_name=factory_name,
6169
enabled_coefficients=code["enabled_coefficients"],
@@ -64,7 +72,11 @@ def generator(ir, options):
6472
needs_facet_permutations="true" if ir.needs_facet_permutations else "false",
6573
scalar_type=dtype_to_c_type(options["scalar_type"]),
6674
geom_type=dtype_to_c_type(dtype_to_scalar_dtype(options["scalar_type"])),
67-
np_scalar_type=np.dtype(options["scalar_type"]).name,
68-
coordinate_element=f"&{ir.coordinate_element}")
75+
coordinate_element=f"&{ir.coordinate_element}",
76+
tabulate_tensor_float32=code["tabulate_tensor_float32"],
77+
tabulate_tensor_float64=code["tabulate_tensor_float64"],
78+
tabulate_tensor_longdouble=code["tabulate_tensor_longdouble"],
79+
tabulate_tensor_complex64=code["tabulate_tensor_complex64"],
80+
tabulate_tensor_complex128=code["tabulate_tensor_complex128"])
6981

7082
return declaration, implementation

ffcx/codegeneration/C/integrals_template.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@
2525
ufcx_integral {factory_name} =
2626
{{
2727
.enabled_coefficients = {enabled_coefficients},
28-
.tabulate_tensor_{np_scalar_type} = tabulate_tensor_{factory_name},
28+
.tabulate_tensor_float32 = {tabulate_tensor_float32},
29+
.tabulate_tensor_float64 = {tabulate_tensor_float64},
30+
.tabulate_tensor_longdouble = {tabulate_tensor_longdouble},
31+
.tabulate_tensor_complex64 = {tabulate_tensor_complex64},
32+
.tabulate_tensor_complex128 = {tabulate_tensor_complex128},
2933
.needs_facet_permutations = {needs_facet_permutations},
3034
.coordinate_element = {coordinate_element},
3135
}};

0 commit comments

Comments
 (0)