Skip to content

Commit

Permalink
finat.element_factory
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrubeck committed Dec 19, 2024
1 parent 45e16db commit 30df42e
Show file tree
Hide file tree
Showing 24 changed files with 29 additions and 331 deletions.
2 changes: 1 addition & 1 deletion docs/source/element_list.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from finat.ufl.elementlist import ufl_elements
# ~ from ufl.finiteelement.elementlist import ufl_elements
from tsfc.finatinterface import supported_elements
from finat.element_factory import supported_elements
import csv

shape_names = {
Expand Down
2 changes: 1 addition & 1 deletion firedrake/assemble.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
import numpy
from pyadjoint.tape import annotate_tape
from tsfc import kernel_args
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from tsfc.ufl_utils import extract_firedrake_constants
import ufl
import finat.ufl
Expand Down
2 changes: 1 addition & 1 deletion firedrake/cython/dmcommon.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ from mpi4py import MPI
from firedrake.utils import IntType, ScalarType
from libc.string cimport memset
from libc.stdlib cimport qsort
from tsfc.finatinterface import as_fiat_cell
from finat.element_factory import as_fiat_cell

cimport numpy as np
cimport mpi4py.MPI as MPI
Expand Down
2 changes: 1 addition & 1 deletion firedrake/cython/extrusion_numbering.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ from mpi4py.libmpi cimport (MPI_Op_create, MPI_OP_NULL, MPI_Op_free,
MPI_User_function)
from pyop2 import op2
from firedrake.utils import IntType
from tsfc.finatinterface import as_fiat_cell
from finat.element_factory import as_fiat_cell

cimport numpy
cimport mpi4py.MPI as MPI
Expand Down
2 changes: 1 addition & 1 deletion firedrake/extrusion_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from pyop2.caching import serial_cache
from firedrake.petsc import PETSc
from firedrake.utils import IntType, RealType, ScalarType
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
import loopy as lp
from loopy.version import LOOPY_USE_LANGUAGE_VERSION_2018_2 # noqa: F401
from firedrake.parameters import target
Expand Down
2 changes: 1 addition & 1 deletion firedrake/functionspacedata.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from decorator import decorator
from functools import partial

from tsfc.finatinterface import create_element as _create_element
from finat.element_factory import create_element as _create_element

from pyop2 import op2
from firedrake.utils import IntType
Expand Down
2 changes: 1 addition & 1 deletion firedrake/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from pyop2 import op2
from pyop2.caching import memory_and_disk_cache

from tsfc.finatinterface import create_element, as_fiat_cell
from finat.element_factory import create_element, as_fiat_cell
from tsfc import compile_expression_dual_evaluation
from tsfc.ufl_utils import extract_firedrake_constants

Expand Down
2 changes: 1 addition & 1 deletion firedrake/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
ngsPETSc = None
# Only for docstring
import mpi4py # noqa: F401
from tsfc.finatinterface import as_fiat_cell
from finat.element_factory import as_fiat_cell


__all__ = [
Expand Down
4 changes: 2 additions & 2 deletions firedrake/mg/kernels.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
from tsfc.driver import TSFCIntegralDataInfo
from tsfc.kernel_interface.common import lower_integral_type
from tsfc.parameters import default_parameters
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from finat.quadrature import make_quadrature
from firedrake.pointquery_utils import dX_norm_square, X_isub_dX, init_X, inside_check, is_affine, celldist_l1_c_expr
from firedrake.pointquery_utils import to_reference_coords_newton_step as to_reference_coords_newton_step_body
Expand All @@ -45,7 +45,7 @@ def to_reference_coordinates(ufl_coordinate_element, parameters=None):
parameters = _

# Create FInAT element
element = tsfc.finatinterface.create_element(ufl_coordinate_element)
element = finat.element_factory.create_element(ufl_coordinate_element)
gdim, = ufl_coordinate_element.reference_value_shape
cell = ufl_coordinate_element.cell

Expand Down
2 changes: 1 addition & 1 deletion firedrake/output/paraview_reordering.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from tsfc.finatinterface import create_base_element
from finat.element_factory import create_base_element
import numpy as np
from pyop2.utils import as_tuple

Expand Down
2 changes: 1 addition & 1 deletion firedrake/pointquery_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def compile_coordinate_element(mesh: MeshGeometry, contains_eps: float, paramete

ufl_coordinate_element = mesh.ufl_coordinate_element()
# Create FInAT element
element = tsfc.finatinterface.create_element(ufl_coordinate_element)
element = finat.element_factory.create_element(ufl_coordinate_element)

code = {
"geometric_dimension": mesh.geometric_dimension(),
Expand Down
2 changes: 1 addition & 1 deletion firedrake/preconditioners/fdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from firedrake_citations import Citations
from ufl.algorithms.ad import expand_derivatives
from ufl.algorithms.expand_indices import expand_indices
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from pyop2.compilation import load
from pyop2.mpi import COMM_SELF
from pyop2.sparsity import get_preallocation
Expand Down
2 changes: 1 addition & 1 deletion firedrake/preconditioners/pmg.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from firedrake.solving_utils import _SNESContext
from firedrake.tsfc_interface import extract_numbered_coefficients
from firedrake.utils import ScalarType_c, IntType_c, cached_property
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from tsfc import compile_expression_dual_evaluation
from pyop2 import op2
from pyop2.caching import serial_cache
Expand Down
2 changes: 1 addition & 1 deletion firedrake/slate/slac/kernel_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from firedrake.slate.slac.tsfc_driver import compile_terminal_form

from tsfc import kernel_args
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from tsfc.loopy import create_domains, assign_dtypes

from pytools import UniqueNameGenerator
Expand Down
4 changes: 2 additions & 2 deletions tests/firedrake/regression/test_interpolate_p3intmoments.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from FIAT.quadrature import make_quadrature
from FIAT.polynomial_set import ONPolynomialSet
from finat.fiat_elements import ScalarFiatElement
from tsfc.finatinterface import convert, as_fiat_cell
from finat.element_factory import convert, as_fiat_cell
import finat.ufl

ufcint = UFCInterval()
Expand Down Expand Up @@ -89,7 +89,7 @@ def __init__(self, cell, degree):
super().__init__(P3IntMoments(cell, degree))


# Replace the old tsfc.finatinterface.convert dispatch with a new one that
# Replace the old finat.element_factory.convert dispatch with a new one that
# gives the the new FInAT element for P3 on an interval with variant
# "interior-moment"
old_convert = convert.dispatch(finat.ufl.FiniteElement)
Expand Down
2 changes: 1 addition & 1 deletion tests/tsfc/test_create_fiat_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import ufl
import finat.ufl
from tsfc.finatinterface import create_element as _create_element
from finat.element_factory import create_element as _create_element


supported_elements = {
Expand Down
2 changes: 1 addition & 1 deletion tests/tsfc/test_create_finat_element.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import ufl
import finat.ufl
import finat
from tsfc.finatinterface import create_element, supported_elements
from finat.element_factory import create_element, supported_elements


@pytest.fixture(params=["BDM",
Expand Down
2 changes: 1 addition & 1 deletion tests/tsfc/test_dual_evaluation.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest
import ufl
import finat.ufl
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from tsfc import compile_expression_dual_evaluation


Expand Down
2 changes: 1 addition & 1 deletion tests/tsfc/test_interpolation_factorisation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from finat.ufl import FiniteElement, VectorElement, TensorElement

from tsfc import compile_expression_dual_evaluation
from tsfc.finatinterface import create_element
from finat.element_factory import create_element


@pytest.fixture(params=[interval, quadrilateral, hexahedron],
Expand Down
2 changes: 1 addition & 1 deletion tests/tsfc/test_tsfc_274.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import numpy
from finat.point_set import PointSet
from gem.interpreter import evaluate
from tsfc.finatinterface import create_element
from finat.element_factory import create_element
from ufl import quadrilateral
from finat.ufl import FiniteElement, RestrictedElement

Expand Down
8 changes: 4 additions & 4 deletions tsfc/fem.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
PhysicalGeometry)
from finat.point_set import PointSet, PointSingleton
from finat.quadrature import make_quadrature
from finat.element_factory import as_fiat_cell, create_element
from gem.node import traversal
from gem.optimise import constant_fold_zero, ffc_rounding
from gem.unconcatenate import unconcatenate
Expand All @@ -32,7 +33,6 @@
from ufl.domain import extract_unique_domain

from tsfc import ufl2gem
from tsfc.finatinterface import as_fiat_cell, create_element
from tsfc.kernel_interface import ProxyKernelInterface
from tsfc.modified_terminals import (analyse_modified_terminal,
construct_modified_terminal)
Expand Down Expand Up @@ -270,9 +270,10 @@ def get_quadrature_rule(fiat_cell, integration_dim, quadrature_degree, scheme):


def make_basis_evaluation_key(ctx, finat_element, mt, entity_id):
ufl_element = mt.terminal.ufl_element()
domain = extract_unique_domain(mt.terminal)
coordinate_element = domain.ufl_coordinate_element()
return (finat_element, mt.local_derivatives, ctx.point_set, ctx.integration_dim, entity_id, coordinate_element, mt.restriction)
return (ufl_element, mt.local_derivatives, ctx.point_set, ctx.integration_dim, entity_id, coordinate_element, mt.restriction)


class PointSetContext(ContextBase):
Expand Down Expand Up @@ -697,8 +698,7 @@ def take_singleton(xs):
for alpha, tables in per_derivative.items()}

# Coefficient evaluation
ctx.index_cache.setdefault(terminal.ufl_element(), element.get_indices())
beta = ctx.index_cache[terminal.ufl_element()]
beta = ctx.index_cache.setdefault(terminal.ufl_element(), element.get_indices())
zeta = element.get_value_indices()
vec_beta, = gem.optimise.remove_componenttensors([gem.Indexed(vec, beta)])
value_dict = {}
Expand Down
Loading

0 comments on commit 30df42e

Please sign in to comment.