Skip to content

Commit

Permalink
Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisrichardson committed May 4, 2022
1 parent d27b4cd commit 04caebc
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 21 deletions.
4 changes: 2 additions & 2 deletions ffcx/codegeneration/basix_custom_element_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
ufcx_basix_custom_finite_element {factory_name} =
{{
.cell_type = {cell_type},
.degree = {degree},
.value_shape_length = {value_shape_length},
.value_shape = {value_shape},
.wcoeffs_rows = {wcoeffs_rows},
Expand All @@ -25,8 +26,7 @@
.M = {M},
.map_type = {map_type},
.discontinuous = {discontinuous},
.highest_complete_degree = {highest_complete_degree},
.highest_degree = {highest_degree}
.highest_complete_degree = {highest_complete_degree}
}};
// End of code for custom element {factory_name}
Expand Down
2 changes: 1 addition & 1 deletion ffcx/codegeneration/finite_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ def generate_custom_element(name, ir):
d["factory_name"] = name
d["cell_type"] = int(ir.cell_type)
d["map_type"] = int(ir.map_type)
d["degree"] = ir.degree
d["highest_complete_degree"] = ir.highest_complete_degree
d["highest_degree"] = ir.highest_degree
d["discontinuous"] = "true" if ir.discontinuous else "false"

import ffcx.codegeneration.C.cnodes as L
Expand Down
33 changes: 19 additions & 14 deletions ffcx/codegeneration/ufcx.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,8 @@ extern "C"

/// Forward declarations
typedef struct ufcx_finite_element ufcx_finite_element;
typedef struct ufcx_basix_custom_finite_element ufcx_basix_custom_finite_element;
typedef struct ufcx_basix_custom_finite_element
ufcx_basix_custom_finite_element;
typedef struct ufcx_dofmap ufcx_dofmap;
typedef struct ufcx_function_space ufcx_function_space;

Expand Down Expand Up @@ -129,7 +130,8 @@ extern "C"
/// Basix identifier of the cell shape
int basix_cell;

/// Indicates whether or not this is the discontinuous version of the element
/// Indicates whether or not this is the discontinuous version of the
/// element
bool discontinuous;

/// The Lagrange variant to be passed to Basix's create_element function
Expand All @@ -154,6 +156,9 @@ extern "C"
/// Basix identifier of the cell shape
int cell_type;

/// The degree of the element
int degree;

/// Dimension of the value space for axis i
int value_shape_length;

Expand Down Expand Up @@ -182,14 +187,12 @@ extern "C"
/// The map type for the element
int map_type;

/// Indicates whether or not this is the discontinuous version of the element
/// Indicates whether or not this is the discontinuous version of the
/// element
bool discontinuous;

/// The highest degree full polynomial space contained in this element
int highest_complete_degree;

/// The highest degree of a polynomial in the element
int highest_degree;
} ufcx_basix_custom_finite_element;

typedef struct ufcx_dofmap
Expand All @@ -209,15 +212,17 @@ extern "C"
int block_size;

/// Number of dofs associated with each cell entity of dimension d
int *num_entity_dofs;
int* num_entity_dofs;

/// Tabulate the local-to-local mapping of dofs on entity (d, i)
void (*tabulate_entity_dofs)(int* restrict dofs, int d, int i);

/// Number of dofs associated with the closure of each cell entity of dimension d
int *num_entity_closure_dofs;
/// Number of dofs associated with the closure of each cell entity of
/// dimension d
int* num_entity_closure_dofs;

/// Tabulate the local-to-local mapping of dofs on the closure of entity (d, i)
/// Tabulate the local-to-local mapping of dofs on the closure of entity (d,
/// i)
void (*tabulate_entity_closure_dofs)(int* restrict dofs, int d, int i);

/// Number of sub dofmaps (for a mixed element)
Expand Down Expand Up @@ -261,8 +266,8 @@ extern "C"
/// null pointer can be passed. For interior facets the array will have size 2
/// (one permutation for each cell adjacent to the facet).
typedef void(ufcx_tabulate_tensor_float32)(
float* restrict A, const float* restrict w,
const float* restrict c, const double* restrict coordinate_dofs,
float* restrict A, const float* restrict w, const float* restrict c,
const double* restrict coordinate_dofs,
const int* restrict entity_local_index,
const uint8_t* restrict quadrature_permutation);

Expand All @@ -271,8 +276,8 @@ extern "C"
///
/// @see ufcx_tabulate_tensor_single
typedef void(ufcx_tabulate_tensor_float64)(
double* restrict A, const double* restrict w,
const double* restrict c, const double* restrict coordinate_dofs,
double* restrict A, const double* restrict w, const double* restrict c,
const double* restrict coordinate_dofs,
const int* restrict entity_local_index,
const uint8_t* restrict quadrature_permutation);

Expand Down
8 changes: 4 additions & 4 deletions ffcx/ir/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@
'original_coefficient_positions', 'points', 'coefficient_names', 'constant_names', 'needs_facet_permutations',
'function_spaces', 'name_from_uflfile'])
ir_custom_element = namedtuple('ir_custom_element', [
'cell_type', 'value_shape', 'wcoeffs', 'x', 'M', 'map_type',
'discontinuous', 'highest_complete_degree', 'highest_degree'])
'cell_type', 'degree', 'value_shape', 'wcoeffs', 'x', 'M', 'map_type',
'discontinuous', 'highest_complete_degree'])

ir_data = namedtuple('ir_data', ['elements', 'dofmaps', 'integrals', 'forms', 'expressions'])

Expand Down Expand Up @@ -171,14 +171,14 @@ def _compute_custom_element_ir(basix_element):
"""Compute intermediate representation of a custom Basix element."""
ir = {}
ir["cell_type"] = basix_element.cell_type
ir["degree"] = basix_element.degree
ir["value_shape"] = basix_element.value_shape
ir["wcoeffs"] = basix_element.wcoeffs
ir["x"] = basix_element.x
ir["M"] = basix_element.M
ir["map_type"] = basix_element.map_type
ir["discontinuous"] = basix_element.discontinuous
ir["highest_complete_degree"] = basix_element.highest_complete_degree
ir["highest_degree"] = basix_element.highest_degree
ir["highest_complete_degree"] = basix_element.degree_bounds[0]

return ir_custom_element(**ir)

Expand Down

0 comments on commit 04caebc

Please sign in to comment.