Skip to content

Commit edbe915

Browse files
committed
Merge branch 'main' into mscroggs/prism-ds
2 parents 9881fb7 + 008bd94 commit edbe915

14 files changed

+97
-118
lines changed

demo/MixedGradient.py

-15
This file was deleted.

demo/TraceElement.py

-26
This file was deleted.

demo/test_demos.py

-12
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,6 @@ def test_demo(file, scalar_type):
2121
# Skip complex demos on win32
2222
pytest.skip(reason="_Complex not supported on Windows")
2323

24-
if file == "Symmetry":
25-
pytest.xfail("Demo currently failing. See https://github.com/FEniCS/ufl/issues/343.")
26-
if file in [
27-
"MixedGradient",
28-
"TraceElement", # HDiv Trace
29-
"MixedElasticity", # VectorElement of BDM
30-
"RestrictedElement",
31-
"_TensorProductElement",
32-
]:
33-
# Skip demos that use elements not yet implemented in Basix
34-
pytest.skip(reason="Element not yet implemented in Basix")
35-
3624
if "complex" in scalar_type and file in [
3725
"BiharmonicHHJ",
3826
"BiharmonicRegge",

ffcx/codegeneration/C/expressions.py

+2
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ def generator(ir: ExpressionIR, options):
103103
d["constant_names_init"] = ""
104104
d["constant_names"] = "NULL"
105105

106+
d["coordinate_element_hash"] = f"UINT64_C({ir.expression.coordinate_element_hash})"
107+
106108
# Check that no keys are redundant or have been missed
107109
from string import Formatter
108110

ffcx/codegeneration/C/expressions_template.py

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
.value_shape = {value_shape},
5050
.num_components = {num_components},
5151
.rank = {rank},
52+
.coordinate_element_hash = {coordinate_element_hash},
5253
}};
5354
5455
// Alias name

ffcx/codegeneration/C/integrals.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ def generator(ir: IntegralIR, domain: basix.CellType, options):
7474
f".tabulate_tensor_{np_scalar_type} = tabulate_tensor_{factory_name},"
7575
)
7676

77-
element_hash = 0 if ir.coordinate_element_hash is None else ir.coordinate_element_hash
78-
77+
assert ir.expression.coordinate_element_hash is not None
7978
implementation = ufcx_integrals.factory.format(
8079
factory_name=factory_name,
8180
enabled_coefficients=code["enabled_coefficients"],
@@ -84,7 +83,7 @@ def generator(ir: IntegralIR, domain: basix.CellType, options):
8483
needs_facet_permutations="true" if ir.expression.needs_facet_permutations else "false",
8584
scalar_type=dtype_to_c_type(options["scalar_type"]),
8685
geom_type=dtype_to_c_type(dtype_to_scalar_dtype(options["scalar_type"])),
87-
coordinate_element_hash=f"UINT64_C({element_hash})",
86+
coordinate_element_hash=f"UINT64_C({ir.expression.coordinate_element_hash})",
8887
tabulate_tensor_float32=code["tabulate_tensor_float32"],
8988
tabulate_tensor_float64=code["tabulate_tensor_float64"],
9089
tabulate_tensor_complex64=code["tabulate_tensor_complex64"],

ffcx/codegeneration/definitions.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def coefficient(
133133
end = begin + bs * (num_dofs - 1) + 1
134134

135135
if ttype == "zeros":
136-
logging.debug("Not expecting zero coefficients to get this far.")
136+
logger.debug("Not expecting zero coefficients to get this far.")
137137
return []
138138

139139
# For a constant coefficient we reference the dofs directly, so no definition needed
@@ -239,7 +239,7 @@ def spatial_coordinate(
239239
if self.integral_type in ufl.custom_integral_types:
240240
# FIXME: Jacobian may need adjustment for custom_integral_types
241241
if mt.local_derivatives:
242-
logging.exception("FIXME: Jacobian in custom integrals is not implemented.")
242+
logger.exception("FIXME: Jacobian in custom integrals is not implemented.")
243243
return []
244244
else:
245245
return self._define_coordinate_dofs_lincomb(mt, tabledata, quadrature_rule, access)

ffcx/codegeneration/symbols.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def entity(self, entity_type, restriction):
109109
elif entity_type == "vertex":
110110
return self.entity_local_index[0]
111111
else:
112-
logging.exception(f"Unknown entity_type {entity_type}")
112+
logger.exception(f"Unknown entity_type {entity_type}")
113113

114114
def argument_loop_index(self, iarg):
115115
"""Loop index for argument iarg."""
@@ -135,8 +135,9 @@ def x_component(self, mt):
135135

136136
def J_component(self, mt):
137137
"""Jacobian component."""
138-
# FIXME: Add domain number!
139-
return L.Symbol(format_mt_name("J", mt), dtype=L.DataType.REAL)
138+
return L.Symbol(
139+
format_mt_name(f"J{mt.expr.ufl_domain().ufl_id()}", mt), dtype=L.DataType.REAL
140+
)
140141

141142
def domain_dof_access(self, dof, component, gdim, num_scalar_dofs, restriction):
142143
"""Domain DOF access."""

ffcx/codegeneration/ufcx.h

+24-19
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@
1616
#define UFCX_VERSION_RELEASE 0
1717

1818
#if UFCX_VERSION_RELEASE
19-
#define UFCX_VERSION \
19+
#define UFCX_VERSION \
2020
UFCX_VERSION_MAJOR "." UFCX_VERSION_MINOR "." UFCX_VERSION_MAINTENANCE
2121
#else
22-
#define UFCX_VERSION \
23-
UFCX_VERSION_MAJOR "." UFCX_VERSION_MINOR "." UFCX_VERSION_MAINTENANCE ".dev0"
22+
#define UFCX_VERSION \
23+
UFCX_VERSION_MAJOR "." UFCX_VERSION_MINOR "." UFCX_VERSION_MAINTENANCE ".de" \
24+
"v0"
2425
#endif
2526

2627
#include <stdbool.h>
@@ -86,8 +87,8 @@ extern "C"
8687
/// null pointer can be passed. For interior facets the array will have size 2
8788
/// (one permutation for each cell adjacent to the facet).
8889
typedef void(ufcx_tabulate_tensor_float32)(
89-
float* restrict A, const float* restrict w,
90-
const float* restrict c, const float* restrict coordinate_dofs,
90+
float* restrict A, const float* restrict w, const float* restrict c,
91+
const float* restrict coordinate_dofs,
9192
const int* restrict entity_local_index,
9293
const uint8_t* restrict quadrature_permutation);
9394

@@ -96,8 +97,8 @@ extern "C"
9697
///
9798
/// @see ufcx_tabulate_tensor_single
9899
typedef void(ufcx_tabulate_tensor_float64)(
99-
double* restrict A, const double* restrict w,
100-
const double* restrict c, const double* restrict coordinate_dofs,
100+
double* restrict A, const double* restrict w, const double* restrict c,
101+
const double* restrict coordinate_dofs,
101102
const int* restrict entity_local_index,
102103
const uint8_t* restrict quadrature_permutation);
103104

@@ -136,21 +137,21 @@ extern "C"
136137
#endif // __STDC_NO_COMPLEX__
137138
bool needs_facet_permutations;
138139

139-
/// Get the hash of the coordinate element associated with the geometry of the mesh.
140+
/// Hash of the coordinate element associated with the geometry of the mesh.
140141
uint64_t coordinate_element_hash;
141142

142143
uint8_t domain;
143144
} ufcx_integral;
144145

145146
typedef struct ufcx_expression
146147
{
147-
/// Evaluate expression into tensor A with compiled evaluation points
148+
/// Evaluate expression into tensor A with compiled evaluation
149+
/// points.
148150
///
149-
/// @param[out] A
150-
/// Dimensions: A[num_points][num_components][num_argument_dofs]
151+
/// @param[out] A Dimensions:
152+
/// `A[num_points][num_components][num_argument_dofs]`
151153
///
152154
/// @see ufcx_tabulate_tensor
153-
///
154155
ufcx_tabulate_tensor_float32* tabulate_tensor_float32;
155156
ufcx_tabulate_tensor_float64* tabulate_tensor_float64;
156157
#ifndef __STDC_NO_COMPLEX__
@@ -180,7 +181,7 @@ extern "C"
180181
int entity_dimension;
181182

182183
/// Coordinates of evaluations points. Dimensions:
183-
/// points[num_points][entity_dimension]
184+
/// `points[num_points][entity_dimension]`
184185
const double* points;
185186

186187
/// Shape of expression. Dimension: value_shape[num_components]
@@ -192,6 +193,9 @@ extern "C"
192193
/// Rank, i.e. number of arguments
193194
int rank;
194195

196+
/// Hash of the coordinate element associated with the geometry of
197+
/// the mesh.
198+
uint64_t coordinate_element_hash;
195199
} ufcx_expression;
196200

197201
/// This class defines the interface for the assembly of the global
@@ -205,9 +209,9 @@ extern "C"
205209
///
206210
/// A = a(V1, V2, ..., Vr, w1, w2, ..., wn),
207211
///
208-
/// where each argument Vj represents the application to the
209-
/// sequence of basis functions of Vj and w1, w2, ..., wn are given
210-
/// fixed functions (coefficients).
212+
/// where each argument Vj represents the application to the sequence
213+
/// of basis functions of Vj and w1, w2, ..., wn are given fixed
214+
/// functions (coefficients).
211215
typedef struct ufcx_form
212216
{
213217
/// String identifying the form
@@ -231,8 +235,8 @@ extern "C"
231235
/// List of names of constants
232236
const char** constant_name_map;
233237

234-
/// Get the hash of the finite element for the i-th argument function, where 0 <=
235-
/// i < r + n.
238+
/// Get the hash of the finite element for the i-th argument
239+
/// function, where 0 <= i < r + n.
236240
///
237241
/// @param i Argument number if 0 <= i < r Coefficient number j = i
238242
/// - r if r + j <= i < r + n
@@ -244,7 +248,8 @@ extern "C"
244248
/// IDs for each integral in form_integrals list
245249
int* form_integral_ids;
246250

247-
/// Offsets for cell, interior facet and exterior facet integrals in form_integrals list
251+
/// Offsets for cell, interior facet and exterior facet integrals in
252+
/// form_integrals list
248253
int* form_integral_offsets;
249254

250255
} ufcx_form;

0 commit comments

Comments
 (0)