@@ -41,14 +41,12 @@ def generator(ir, options):
41
41
d ["tabulate_expression" ] = CF .c_format (parts )
42
42
43
43
if len (ir .original_coefficient_positions ) > 0 :
44
- d [
45
- "original_coefficient_positions"
46
- ] = f"original_coefficient_positions_{ ir .name } "
44
+ d ["original_coefficient_positions" ] = f"original_coefficient_positions_{ ir .name } "
47
45
n = len (ir .original_coefficient_positions )
48
46
originals = ", " .join (str (i ) for i in ir .original_coefficient_positions )
49
- d [
50
- "original_coefficient_positions_init "
51
- ] = f"static int original_coefficient_positions_ { ir . name } [ { n } ] = {{ { originals } }};"
47
+ d ["original_coefficient_positions_init" ] = (
48
+ f"static int original_coefficient_positions_ { ir . name } [ { n } ] = {{ { originals } }}; "
49
+ )
52
50
53
51
else :
54
52
d ["original_coefficient_positions" ] = "NULL"
@@ -78,9 +76,9 @@ def generator(ir, options):
78
76
if len (ir .coefficient_names ) > 0 :
79
77
names = ", " .join (f'"{ name } "' for name in ir .coefficient_names )
80
78
n = len (ir .coefficient_names )
81
- d [
82
- "coefficient_names_init "
83
- ] = f"static const char* coefficient_names_ { ir . name } [ { n } ] = {{ { names } }};"
79
+ d ["coefficient_names_init" ] = (
80
+ f"static const char* coefficient_names_ { ir . name } [ { n } ] = {{ { names } }}; "
81
+ )
84
82
85
83
d ["coefficient_names" ] = f"coefficient_names_{ ir .name } "
86
84
else :
@@ -90,9 +88,9 @@ def generator(ir, options):
90
88
if len (ir .constant_names ) > 0 :
91
89
names = ", " .join (f'"{ name } "' for name in ir .constant_names )
92
90
n = len (ir .constant_names )
93
- d [
94
- "constant_names_init "
95
- ] = f"static const char* constant_names_ { ir . name } [ { n } ] = {{ { names } }};"
91
+ d ["constant_names_init" ] = (
92
+ f"static const char* constant_names_ { ir . name } [ { n } ] = {{ { names } }}; "
93
+ )
96
94
d ["constant_names" ] = f"constant_names_{ ir .name } "
97
95
else :
98
96
d ["constant_names_init" ] = ""
@@ -103,9 +101,7 @@ def generator(ir, options):
103
101
# FIXME: Should be handled differently, revise how
104
102
# ufcx_function_space is generated (also for ufcx_form)
105
103
for name , (element , dofmap , cmap_family , cmap_degree ) in ir .function_spaces .items ():
106
- code += [
107
- f"static ufcx_function_space function_space_{ name } _{ ir .name_from_uflfile } ="
108
- ]
104
+ code += [f"static ufcx_function_space function_space_{ name } _{ ir .name_from_uflfile } =" ]
109
105
code += ["{" ]
110
106
code += [f".finite_element = &{ element } ," ]
111
107
code += [f".dofmap = &{ dofmap } ," ]
@@ -123,24 +119,18 @@ def generator(ir, options):
123
119
for (name , _ ) in ir .function_spaces .items ()
124
120
)
125
121
n = len (ir .function_spaces .items ())
126
- d [
127
- "function_spaces_init "
128
- ] = f"ufcx_function_space* function_spaces_ { ir . name } [ { n } ] = {{ { fs_list } }};"
122
+ d ["function_spaces_init" ] = (
123
+ f"ufcx_function_space* function_spaces_ { ir . name } [ { n } ] = {{ { fs_list } }}; "
124
+ )
129
125
else :
130
126
d ["function_spaces" ] = "NULL"
131
127
d ["function_spaces_init" ] = ""
132
128
133
129
# Check that no keys are redundant or have been missed
134
130
from string import Formatter
135
131
136
- fields = [
137
- fname
138
- for _ , fname , _ , _ in Formatter ().parse (expressions_template .factory )
139
- if fname
140
- ]
141
- assert set (fields ) == set (
142
- d .keys ()
143
- ), "Mismatch between keys in template and in formatting dict"
132
+ fields = [fname for _ , fname , _ , _ in Formatter ().parse (expressions_template .factory ) if fname ]
133
+ assert set (fields ) == set (d .keys ()), "Mismatch between keys in template and in formatting dict"
144
134
145
135
# Format implementation code
146
136
implementation = expressions_template .factory .format_map (d )
0 commit comments