Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add needs_facet_permutations flag #384

Merged
merged 3 commits into from
Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/dolfin-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
container: fenicsproject/test-env:latest-openmpi

env:
CC: clang-10
CXX: clang++-10
CC: clang-12
CXX: clang++-12

PETSC_ARCH: linux-gnu-complex-32
OMPI_ALLOW_RUN_AS_ROOT: 1
Expand Down
1 change: 1 addition & 0 deletions ffcx/codegeneration/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ def generator(ir, parameters):
d["num_coefficients"] = len(ir.coefficient_numbering)
d["num_points"] = ir.points.shape[0]
d["topological_dimension"] = ir.points.shape[1]
d["needs_facet_permutations"] = 1 if ir.needs_facet_permutations else 0

# Check that no keys are redundant or have been missed
from string import Formatter
Expand Down
1 change: 1 addition & 0 deletions ffcx/codegeneration/expressions_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
.num_coefficients = {num_coefficients},
.num_points = {num_points},
.topological_dimension = {topological_dimension},
.needs_facet_permutations = {needs_facet_permutations},
.points = {points},
.value_shape = {value_shape},
.num_components = {num_components},
Expand Down
3 changes: 2 additions & 1 deletion ffcx/codegeneration/integrals.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ def generator(ir, parameters):
factory_name=factory_name,
enabled_coefficients=code["enabled_coefficients"],
enabled_coefficients_init=code["enabled_coefficients_init"],
tabulate_tensor=code["tabulate_tensor"])
tabulate_tensor=code["tabulate_tensor"],
needs_facet_permutations=1 if ir.needs_facet_permutations else 0)

return declaration, implementation

Expand Down
1 change: 1 addition & 0 deletions ffcx/codegeneration/integrals_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
{{
.enabled_coefficients = {enabled_coefficients},
.tabulate_tensor = tabulate_tensor_{factory_name},
.needs_facet_permutations = {needs_facet_permutations},
}};

// End of code for integral {factory_name}
Expand Down
5 changes: 5 additions & 0 deletions ffcx/codegeneration/ufc.h
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,14 @@ extern "C"
{
const bool* enabled_coefficients;
ufc_tabulate_tensor* tabulate_tensor;
bool needs_facet_permutations;
} ufc_integral;

typedef struct ufc_custom_integral
{
const bool* enabled_coefficients;
ufc_tabulate_tensor_custom* tabulate_tensor;
bool needs_facet_permutations;
} ufc_custom_integral;

typedef struct ufc_expression
Expand Down Expand Up @@ -271,6 +273,9 @@ extern "C"
/// reference cell
int topological_dimension;

/// Indicates whether facet permutations are needed
bool needs_facet_permutations;

/// Coordinates of evaluations points. Dimensions:
/// points[num_points][topological_dimension]
const double* points;
Expand Down
4 changes: 4 additions & 0 deletions ffcx/ir/integral.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,10 @@ def compute_integral_ir(cell, integral_type, entitytype, integrands, argument_sh
ir["integrand"][quadrature_rule] = {"factorization": F,
"modified_arguments": [F.nodes[i]['mt'] for i in argkeys],
"block_contributions": block_contributions}

restrictions = [i.restriction for i in initial_terminals.values()]
ir["needs_facet_permutations"] = "+" in restrictions and "-" in restrictions

return ir


Expand Down
4 changes: 2 additions & 2 deletions ffcx/ir/representation.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@
'num_facets', 'num_vertices', 'enabled_coefficients', 'element_dimensions',
'element_ids', 'tensor_shape', 'coefficient_numbering', 'coefficient_offsets',
'original_constant_offsets', 'params', 'cell_shape', 'unique_tables', 'unique_table_types',
'table_dofmaps', 'integrand', 'name', 'precision'])
'table_dofmaps', 'integrand', 'name', 'precision', 'needs_facet_permutations'])
ir_expression = namedtuple('ir_expression', [
'name', 'element_dimensions', 'params', 'unique_tables', 'unique_table_types', 'integrand',
'table_dofmaps', 'coefficient_numbering', 'coefficient_offsets',
'integral_type', 'entitytype', 'tensor_shape', 'expression_shape', 'original_constant_offsets',
'original_coefficient_positions', 'points'])
'original_coefficient_positions', 'points', 'needs_facet_permutations'])

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

Expand Down