Skip to content

Commit

Permalink
Remove deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
nbouziani committed Sep 10, 2023
1 parent 7e510dd commit 45903ef
Show file tree
Hide file tree
Showing 7 changed files with 2 additions and 46 deletions.
2 changes: 0 additions & 2 deletions ufl/algorithms/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"expand_derivatives",
"extract_coefficients",
"extract_base_form_operators",
"extract_external_operators",
"strip_variables",
"strip_terminal_data",
"replace_terminal_data",
Expand Down Expand Up @@ -73,7 +72,6 @@
extract_arguments,
extract_coefficients,
# extract_arguments_and_coefficients,
extract_external_operators,
extract_base_form_operators,
extract_elements,
extract_unique_elements,
Expand Down
6 changes: 0 additions & 6 deletions ufl/algorithms/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,12 +144,6 @@ def extract_coefficients(a):
return sorted_by_count(extract_type(a, BaseCoefficient))


def extract_external_operators(a):
"""Build a sorted list of all external operators in a,
which can be a Form, Integral or Expr."""
return sorted_by_count(extract_type(a, ExternalOperator))


def extract_constants(a):
"""Build a sorted list of all constants in a"""
return sorted_by_count(extract_type(a, Constant))
Expand Down
5 changes: 0 additions & 5 deletions ufl/algorithms/apply_function_pullbacks.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,11 +158,6 @@ def __init__(self):
def terminal(self, t):
return t

def external_operator(self, e):
c = e.result_coefficient(unpack_reference=False)
result_coefficient = apply_single_function_pullbacks(c, e.ufl_element())
return e._ufl_expr_reconstruct_(*e.ufl_operands, result_coefficient=result_coefficient)

@memoized_handler
def form_argument(self, o):
# Represent 0-derivatives of form arguments on reference
Expand Down
4 changes: 0 additions & 4 deletions ufl/algorithms/check_arities.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ def nonlinear_operator(self, o):

expr = nonlinear_operator

def external_operator(self, o):
# FIXME: Uses map_expr_dag instead of self.arguments because of the Conj case
return tuple(map_expr_dag(self, arg, compress=False)[0] for arg in o.argument_slots(outer_form=True))

def sum(self, o, a, b):
if a != b:
raise ArityMismatch(f"Adding expressions with non-matching form arguments {_afmt(a)} vs {_afmt(b)}.")
Expand Down
3 changes: 0 additions & 3 deletions ufl/algorithms/estimate_degrees.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,6 @@ def coefficient(self, v):
d = self.default_degree
return d

def external_operator(self, v):
return self.coefficient(v.result_coefficient())

def _reduce_degree(self, v, f):
"""Reduces the estimated degree by one; used when derivatives
are taken. Does not reduce the degree when TensorProduct elements
Expand Down
26 changes: 1 addition & 25 deletions ufl/algorithms/replace.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
#
# Modified by Anders Logg, 2009-2010

from ufl.core.external_operator import ExternalOperator
from ufl.classes import CoefficientDerivative, Interp, Form
from ufl.classes import CoefficientDerivative, Interp, ExternalOperator, Form
from ufl.constantvalue import as_ufl
from ufl.corealg.multifunction import MultiFunction
from ufl.algorithms.map_integrands import map_integrand_dags
Expand All @@ -37,29 +36,6 @@ def ufl_type(self, o, *args):
except KeyError:
return self.reuse_if_untouched(o, *args)

"""
def external_operator(self, o):
try:
o = self.mapping[o]
coeff = o.result_coefficient(unpack_reference=False)
except KeyError:
coeff = replace(o.result_coefficient(unpack_reference=False), self.mapping)
except AttributeError:
# ExternalOperator is replaced by something that is not an ExternalOperator
return o
new_ops = tuple(replace(op, self.mapping) for op in o.ufl_operands)
# Fix this
if type(new_ops[0]).__name__ == 'Coefficient' and type(o.ufl_operands[0]).__name__ == 'Function':
new_ops = o.ufl_operands
# Does not need to use replace on the 0-slot argument of external operators (v*) since
# this can only be a Coargument or a Cofunction, so we directly check into the mapping.
# Also, replace is built to apply on Expr, Coargument is not an Expr.
new_args = tuple(replace(arg, self.mapping) if not isinstance(arg, Coargument) else self.mapping.get(arg, arg)
for arg in o.argument_slots())
return o._ufl_expr_reconstruct_(*new_ops, result_coefficient=coeff, argument_slots=new_args)
"""

def external_operator(self, o):
o = self.mapping.get(o) or o
if isinstance(o, ExternalOperator):
Expand Down
2 changes: 1 addition & 1 deletion ufl/form.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
# Modified by Anders Logg, 2009-2011.
# Modified by Massimiliano Leoni, 2016.
# Modified by Cecile Daversin-Catty, 2018.
# Modified by Nacime Bouziani, 2020.

import warnings
from collections import defaultdict
Expand Down Expand Up @@ -194,6 +193,7 @@ def __call__(self, *args, **kwargs):
Replaces form.arguments() with given positional arguments in
same number and ordering. Number of positional arguments must
be 0 or equal to the number of Arguments in the form.
The optional keyword argument coefficients can be set to a dict
to replace Coefficients with expressions of matching shapes.
Expand Down

0 comments on commit 45903ef

Please sign in to comment.