Skip to content

Commit

Permalink
Fix for zero integrals case
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed Aug 10, 2023
1 parent 8b7fef2 commit 7613184
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 15 deletions.
33 changes: 20 additions & 13 deletions ffcx/codegeneration/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,26 @@ def generator(ir, options):
integral_ids += ir.subdomain_ids[itg_type]
integral_offsets.append(len(integrals))

d["form_integrals_init"] = L.ArrayDecl(
"static ufcx_integral*",
f"form_integrals_{ir.name}",
values=integrals,
sizes=len(integrals),
)

d["form_integral_ids_init"] = L.ArrayDecl(
"int",
f"form_integral_ids_{ir.name}",
values=integral_ids,
sizes=len(integral_ids),
)
if len(integrals) > 0:
d["form_integrals_init"] = L.ArrayDecl(
"static ufcx_integral*",
f"form_integrals_{ir.name}",
values=integrals,
sizes=len(integrals),
)
d["form_integrals"] = f"form_integrals_{ir.name}"
d["form_integral_ids_init"] = L.ArrayDecl(
"int",
f"form_integral_ids_{ir.name}",
values=integral_ids,
sizes=len(integral_ids),
)
d["form_integral_ids"] = f"form_integral_ids_{ir.name}"
else:
d["form_integrals_init"] = ""
d["form_integals"] = "NULL"
d["form_integrals_ids_init"] = ""
d["form_integral_ids"] = "NULL"

d["form_integral_offsets_init"] = L.ArrayDecl(
"int",
Expand Down
4 changes: 2 additions & 2 deletions ffcx/codegeneration/form_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@
.integrals = integrals_{factory_name},
.form_integrals = form_integrals_{factory_name},
.form_integral_ids = form_integral_ids_{factory_name},
.form_integrals = {form_integrals},
.form_integral_ids = {form_integral_ids},
.form_integral_offsets = form_integral_offsets_{factory_name}
}};
Expand Down

0 comments on commit 7613184

Please sign in to comment.