Esempio n. 1
0
def make_coordinate_mapping_jit_classname(ufl_element, tag, parameters):
    assert isinstance(ufl_element, ufl.FiniteElementBase)
    sig = classname.compute_signature([ufl_element],
                                      tag,
                                      parameters,
                                      coordinate_mapping=True)
    return classname.make_name("ffc_coordinate_mapping_{}".format(sig),
                               "coordinate_mapping", "main")
Esempio n. 2
0
def _compute_form_ir(form_data, form_id, prefix, element_numbers, classnames,
                     object_names, parameters):
    """Compute intermediate representation of form."""

    # Store id
    ir = {"id": form_id}

    # Storing prefix here for reconstruction of classnames on code
    # generation side
    ir["prefix"] = prefix

    # Compute common data
    ir["classname"] = classname.make_name(prefix, "form", form_id)

    ir["signature"] = form_data.original_form.signature()

    ir["rank"] = len(form_data.original_form.arguments())
    ir["num_coefficients"] = len(form_data.reduced_coefficients)

    ir["coefficient_names"] = [
        object_names.get(id(obj), "w%d" % j)
        for j, obj in enumerate(form_data.reduced_coefficients)
    ]

    ir["original_coefficient_position"] = form_data.original_coefficient_positions

    # TODO: Remove create_coordinate_{finite_element,dofmap} and access
    # through coordinate_mapping instead in dolfin, when that's in place
    ir["create_coordinate_finite_element"] = [
        classnames["finite_element"][e] for e in form_data.coordinate_elements
    ]
    ir["create_coordinate_dofmap"] = [
        classnames["dofmap"][e] for e in form_data.coordinate_elements
    ]
    ir["create_coordinate_mapping"] = [
        classnames["coordinate_mapping"][e]
        for e in form_data.coordinate_elements
    ]
    ir["create_finite_element"] = [
        classnames["finite_element"][e]
        for e in form_data.argument_elements + form_data.coefficient_elements
    ]
    ir["create_dofmap"] = [
        classnames["dofmap"][e]
        for e in form_data.argument_elements + form_data.coefficient_elements
    ]

    # Create integral ids and names using form prefix (integrals are
    # always generated as part of form so don't get their own prefix)
    for integral_type in ufc_integral_types:
        irdata = _create_foo_integral(prefix, form_id, integral_type,
                                      form_data)
        ir["create_{}_integral".format(integral_type)] = irdata
        ir["get_{}_integral_ids".format(integral_type)] = irdata

    return ir_form(**ir)
Esempio n. 3
0
def make_finite_element_jit_classname(ufl_element, tag, parameters):
    assert isinstance(ufl_element, ufl.FiniteElementBase)
    sig = classname.compute_signature([ufl_element], tag, parameters)
    return classname.make_name("ffc_element_{}".format(sig), "finite_element",
                               "main")