ffc.uflacs.backends.ufc package

Submodules

ffc.uflacs.backends.ufc.apply_mappings module

ffc.uflacs.backends.ufc.coordinate_mapping module

ffc.uflacs.backends.ufc.coordinate_mapping.adj_expr_2x2(A)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.adj_expr_3x3(A)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.codet_nn(A, rows, cols)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.cross_expr(a, b)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.det_22(B, i, j, k, l)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.det_nn(A, n)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.generate_assign_inverse(L, K, J, detJ, gdim, tdim)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.generate_compute_ATA(L, ATA, A, m, n, index_prefix='')[source]

Generate code to declare and compute ATA[i,j] = sum_k A[k,i]*A[k,j] with given A shaped (m,n).

ffc.uflacs.backends.ufc.coordinate_mapping.generate_cross_decl(c, a, b)[source]
ffc.uflacs.backends.ufc.coordinate_mapping.pdet_m1(L, A, m)[source]
class ffc.uflacs.backends.ufc.coordinate_mapping.ufc_coordinate_mapping[source]

Bases: ffc.uflacs.backends.ufc.generator.ufc_generator

Each function maps to a keyword in the template. See documentation of ufc_generator.

cell_shape(L, ir)[source]
compute_geometry(L, ir)[source]
compute_jacobian_determinants(L, ir)[source]
compute_jacobian_inverses(L, ir)[source]
compute_jacobians(L, ir)[source]
compute_midpoint_geometry(L, ir)[source]
compute_physical_coordinates(L, ir)[source]
compute_reference_coordinates(L, ir)[source]
compute_reference_geometry(L, ir)[source]
create_coordinate_dofmap(L, ir)[source]
create_coordinate_finite_element(L, ir)[source]
geometric_dimension(L, geometric_dimension)[source]
topological_dimension(L, topological_dimension)[source]

ffc.uflacs.backends.ufc.dofmap module

class ffc.uflacs.backends.ufc.dofmap.ufc_dofmap[source]

Bases: ffc.uflacs.backends.ufc.generator.ufc_generator

Each function maps to a keyword in the template. See documentation of ufc_generator.

create_sub_dofmap(L, ir)[source]
global_dimension(L, ir)[source]
needs_mesh_entities(L, needs_mesh_entities)[source]

needs_mesh_entities is a list of num dofs per entity.

num_element_dofs(L, num_element_dofs)[source]
num_element_support_dofs(L, num_element_support_dofs)[source]
num_entity_closure_dofs(L, num_entity_closure_dofs)[source]
num_entity_dofs(L, num_entity_dofs)[source]
num_facet_dofs(L, num_facet_dofs)[source]
num_global_support_dofs(L, num_global_support_dofs)[source]
num_sub_dofmaps(L, num_sub_dofmaps)[source]
tabulate_dofs(L, ir)[source]
tabulate_entity_closure_dofs(L, ir)[source]
tabulate_entity_dofs(L, ir)[source]
tabulate_facet_dofs(L, ir)[source]
topological_dimension(L, topological_dimension)[source]

ffc.uflacs.backends.ufc.evalderivs module

Work in progress translation of FFC evaluatebasis code to uflacs CNodes format.

ffc.uflacs.backends.ufc.evalderivs.generate_evaluate_reference_basis_derivatives(L, data, parameters)[source]
ffc.uflacs.backends.ufc.evalderivs.generate_tabulate_dmats(L, dofs_data)[source]

Tabulate the derivatives of the polynomial base

ffc.uflacs.backends.ufc.evaluatebasis module

Work in progress translation of FFC evaluatebasis code to uflacs CNodes format.

ffc.uflacs.backends.ufc.evaluatebasis.generate_compute_basisvalues(L, dofs_data, element_cellname, tdim, X, ip)[source]
ffc.uflacs.backends.ufc.evaluatebasis.generate_evaluate_reference_basis(L, data, parameters)[source]

Generate code to evaluate element basisfunctions at an arbitrary point on the reference element.

The value(s) of the basisfunction is/are computed as in FIAT as the dot product of the coefficients (computed at compile time) and basisvalues which are dependent on the coordinate and thus have to be computed at run time.

The function should work for all elements supported by FIAT, but it remains untested for tensor valued elements.

This code is adapted from code in FFC which computed the basis from physical coordinates, and also to use UFLACS utilities.

The FFC code has a comment “From FIAT_NEW.polynomial_set.tabulate()”.

ffc.uflacs.backends.ufc.evaluatebasis.generate_expansion_coefficients(L, dofs_data)[source]
ffc.uflacs.backends.ufc.evaluatebasis.tabulate_coefficients(L, dof_data)[source]

This function tabulates the element coefficients that are generated by FIAT at compile time.

ffc.uflacs.backends.ufc.evaluatebasisderivatives module

Work in progress translation of FFC evaluatebasisderivatives code to uflacs CNodes format.

ffc.uflacs.backends.ufc.evaluatebasisderivatives.generate_evaluate_basis_derivatives(L, data)[source]

Evaluate the derivatives of an element basisfunction at a point. The values are computed as in FIAT as the matrix product of the coefficients (computed at compile time), basisvalues which are dependent on the coordinate and thus have to be computed at run time and combinations (depending on the order of derivative) of dmats tables which hold the derivatives of the expansion coefficients.

ffc.uflacs.backends.ufc.evaluatebasisderivatives.generate_evaluate_basis_derivatives_all(L, data)[source]

Like evaluate_basis, but return the values of all basis functions (dofs).

ffc.uflacs.backends.ufc.evaluatedof module

ffc.uflacs.backends.ufc.evaluatedof.generate_evaluate_dof(L, ir)[source]

Generate code for evaluate_dof.

ffc.uflacs.backends.ufc.evaluatedof.generate_evaluate_dofs(L, ir)[source]

Generate code for evaluate_dofs.

ffc.uflacs.backends.ufc.evaluatedof.reference_to_physical_map(cellname)[source]

Returns a map from reference coordinates to physical element coordinates

ffc.uflacs.backends.ufc.finite_element module

ffc.uflacs.backends.ufc.finite_element.compute_basis_values(L, data, dof_data)[source]
ffc.uflacs.backends.ufc.finite_element.compute_values(L, data, dof_data)[source]

This function computes the value of the basisfunction as the dot product of the coefficients and basisvalues.

ffc.uflacs.backends.ufc.finite_element.generate_element_mapping(mapping, i, num_reference_components, tdim, gdim, J, detJ, K)[source]
class ffc.uflacs.backends.ufc.finite_element.ufc_finite_element[source]

Bases: ffc.uflacs.backends.ufc.generator.ufc_generator

Each function maps to a keyword in the template. See documentation of ufc_generator.

cell_shape(L, cell_shape)[source]
create_sub_element(L, ir)[source]
degree(L, degree)[source]
evaluate_basis(L, ir, parameters)[source]
evaluate_basis_all(L, ir, parameters)[source]
evaluate_basis_derivatives(L, ir, parameters)[source]
evaluate_basis_derivatives_all(L, ir, parameters)[source]
evaluate_dof(L, ir, parameters)[source]
evaluate_dofs(L, ir, parameters)[source]

Generate code for evaluate_dofs.

evaluate_reference_basis(L, ir, parameters)[source]
evaluate_reference_basis_derivatives(L, ir, parameters)[source]
family(L, family)[source]
geometric_dimension(L, geometric_dimension)[source]
interpolate_vertex_values(L, ir, parameters)[source]
num_sub_elements(L, num_sub_elements)[source]
reference_value_dimension(L, reference_value_shape)[source]
reference_value_rank(L, reference_value_shape)[source]
reference_value_size(L, reference_value_shape)[source]
space_dimension(L, space_dimension)[source]
tabulate_dof_coordinates(L, ir, parameters)[source]
tabulate_reference_dof_coordinates(L, ir, parameters)[source]
topological_dimension(L, topological_dimension)[source]
transform_reference_basis_derivatives(L, ir, parameters)[source]
value_dimension(L, value_shape)[source]
value_rank(L, value_shape)[source]
value_size(L, value_shape)[source]

ffc.uflacs.backends.ufc.form module

ffc.uflacs.backends.ufc.form.add_ufc_form_integral_methods(cls)[source]

This function generates methods on the class it decorates, for each integral name template and for each integral type.

This allows implementing e.g. create_###_integrals once in the decorated class as ‘_create_foo_integrals’, and this function will expand that implementation into ‘create_cell_integrals’, ‘create_exterior_facet_integrals’, etc.

Name templates are taken from ‘integral_name_templates’ and ‘ufc_integral_types’.

ffc.uflacs.backends.ufc.form.create_delegate(integral_type, declname, impl)[source]
class ffc.uflacs.backends.ufc.form.ufc_form[source]

Bases: ffc.uflacs.backends.ufc.generator.ufc_generator

Each function maps to a keyword in the template. See documentation of ufc_generator.

The exceptions are functions on the form
def _*_foo_*(self, L, ir, parameters, integral_type, declname)

which add_ufc_form_integral_methods will duplicate for foo = each integral type.

create_cell_integral(L, ir, parameters)

Return implementation of ufc::form::create_cell_integral().

create_coordinate_dofmap(L, ir)[source]
create_coordinate_finite_element(L, ir)[source]
create_coordinate_mapping(L, ir)[source]
create_custom_integral(L, ir, parameters)

Return implementation of ufc::form::create_custom_integral().

create_cutcell_integral(L, ir, parameters)

Return implementation of ufc::form::create_cutcell_integral().

create_default_cell_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_cell_integral().

create_default_custom_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_custom_integral().

create_default_cutcell_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_cutcell_integral().

create_default_exterior_facet_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_exterior_facet_integral().

create_default_interface_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_interface_integral().

create_default_interior_facet_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_interior_facet_integral().

create_default_overlap_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_overlap_integral().

create_default_vertex_integral(L, ir, parameters)

Return implementation of ufc::form::create_default_vertex_integral().

create_dofmap(L, ir)[source]
create_exterior_facet_integral(L, ir, parameters)

Return implementation of ufc::form::create_exterior_facet_integral().

create_finite_element(L, ir)[source]
create_interface_integral(L, ir, parameters)

Return implementation of ufc::form::create_interface_integral().

create_interior_facet_integral(L, ir, parameters)

Return implementation of ufc::form::create_interior_facet_integral().

create_overlap_integral(L, ir, parameters)

Return implementation of ufc::form::create_overlap_integral().

create_vertex_integral(L, ir, parameters)

Return implementation of ufc::form::create_vertex_integral().

has_cell_integrals(L, ir, parameters)

Return implementation of ufc::form::has_cell_integrals().

has_custom_integrals(L, ir, parameters)

Return implementation of ufc::form::has_custom_integrals().

has_cutcell_integrals(L, ir, parameters)

Return implementation of ufc::form::has_cutcell_integrals().

has_exterior_facet_integrals(L, ir, parameters)

Return implementation of ufc::form::has_exterior_facet_integrals().

has_interface_integrals(L, ir, parameters)

Return implementation of ufc::form::has_interface_integrals().

has_interior_facet_integrals(L, ir, parameters)

Return implementation of ufc::form::has_interior_facet_integrals().

has_overlap_integrals(L, ir, parameters)

Return implementation of ufc::form::has_overlap_integrals().

has_vertex_integrals(L, ir, parameters)

Return implementation of ufc::form::has_vertex_integrals().

max_cell_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_cell_subdomain_id().

max_custom_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_custom_subdomain_id().

max_cutcell_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_cutcell_subdomain_id().

max_exterior_facet_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_exterior_facet_subdomain_id().

max_interface_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_interface_subdomain_id().

max_interior_facet_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_interior_facet_subdomain_id().

max_overlap_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_overlap_subdomain_id().

max_vertex_subdomain_id(L, ir, parameters)

Return implementation of ufc::form::max_vertex_subdomain_id().

num_coefficients(L, num_coefficients)[source]
original_coefficient_position(L, ir)[source]
rank(L, rank)[source]

ffc.uflacs.backends.ufc.generator module

class ffc.uflacs.backends.ufc.generator.ufc_generator(basename)[source]

Bases: object

Common functionality for code generators producing ufc classes.

The generate function is the driver for generating code for a class. It automatically extracts each template keyword %(foo)s and calls self.foo(…) to define the code snippet for that keyword.

The standard arguments to every self.foo(…) function are: - L (the language module reference) - ir (the full ir dict) - parameters (the parameters dict, can be omitted) If the second argument is not named “ir”, it must be a valid key in ir, and the value of ir[keyname] is passed instead of the full ir dict. Invalid keynames result in attempts at informative errors, meaning errors will often be caught early when making changes.

classname(L, ir)[source]

Return classname.

constructor(L, ir)[source]

Return empty string. Override in classes that need constructor.

constructor_arguments(L, ir)[source]

Return empty string. Override in classes that need constructor.

create(L, ir)[source]

Default implementation of creating a new object of the same type.

destructor(L, ir)[source]

Return empty string. Override in classes that need destructor.

generate(L, ir, parameters=None, snippets=None, jit=False)[source]

Return composition of templates with generated snippets.

generate_snippets(L, ir, parameters)[source]

Generate code snippets for each keyword found in templates.

initializer_list(L, ir)[source]

Return empty string. Override in classes that need constructor.

members(L, ir)[source]

Return empty string. Override in classes that need members.

signature(L, ir)[source]

Default implementation of returning signature string fetched from ir.

ffc.uflacs.backends.ufc.generators module

ffc.uflacs.backends.ufc.integrals module

class ffc.uflacs.backends.ufc.integrals.ufc_cell_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_custom_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

num_cells(L, ir)[source]
class ffc.uflacs.backends.ufc.integrals.ufc_cutcell_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_exterior_facet_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_integral(integral_type)[source]

Bases: ffc.uflacs.backends.ufc.generator.ufc_generator

Each function maps to a keyword in the template. See documentation of ufc_generator.

enabled_coefficients(L, ir)[source]
tabulate_tensor(L, ir)[source]
tabulate_tensor_comment(L, ir)[source]

Generate comment for tabulate_tensor.

class ffc.uflacs.backends.ufc.integrals.ufc_interface_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_interior_facet_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_overlap_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

class ffc.uflacs.backends.ufc.integrals.ufc_vertex_integral[source]

Bases: ffc.uflacs.backends.ufc.integrals.ufc_integral

ffc.uflacs.backends.ufc.jacobian module

ffc.uflacs.backends.ufc.jacobian.fiat_coordinate_mapping(L, cellname, gdim, ref_coord_symbol='Y')[source]
ffc.uflacs.backends.ufc.jacobian.inverse_jacobian(L, gdim, tdim, element_cellname)[source]
ffc.uflacs.backends.ufc.jacobian.jacobian(L, gdim, tdim, element_cellname)[source]
ffc.uflacs.backends.ufc.jacobian.orientation(L)[source]

ffc.uflacs.backends.ufc.templates module

ffc.uflacs.backends.ufc.templates.extract_keywords(template)[source]

ffc.uflacs.backends.ufc.utils module

ffc.uflacs.backends.ufc.utils.generate_error(L, msg, emit_warning)[source]
ffc.uflacs.backends.ufc.utils.generate_return_bool_switch(L, i, values, default)[source]
ffc.uflacs.backends.ufc.utils.generate_return_int_switch(L, i, values, default)[source]
ffc.uflacs.backends.ufc.utils.generate_return_literal_switch(L, i, values, default, literal_type, typename=None)[source]
ffc.uflacs.backends.ufc.utils.generate_return_new(L, classname, factory)[source]
ffc.uflacs.backends.ufc.utils.generate_return_new_switch(L, i, classnames, args=None, factory=False)[source]
ffc.uflacs.backends.ufc.utils.generate_return_sizet_switch(L, i, values, default)[source]

Module contents

Backend for generating UFC code.