Skip to content

Commit

Permalink
FEniCS backend: Import ufl_legacy, if available
Browse files Browse the repository at this point in the history
  • Loading branch information
jrmaddison committed Oct 16, 2023
1 parent 1061c50 commit a5f11ff
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 13 deletions.
5 changes: 4 additions & 1 deletion tests/fenics/test_block_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@
import mpi4py.MPI as MPI # noqa: N817
import numpy as np
import pytest
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

pytestmark = pytest.mark.skipif(
MPI.COMM_WORLD.size not in {1, 4},
Expand Down
5 changes: 4 additions & 1 deletion tests/fenics/test_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

import numpy as np
import pytest
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

pytestmark = pytest.mark.skipif(
DEFAULT_COMM.size not in {1, 4},
Expand Down
5 changes: 4 additions & 1 deletion tests/fenics/test_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@
import numpy as np
import os
import pytest
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

pytestmark = pytest.mark.skipif(
DEFAULT_COMM.size not in {1, 4},
Expand Down
5 changes: 4 additions & 1 deletion tests/fenics/test_gauss_newton.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@

import numpy as np
import pytest
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

pytestmark = pytest.mark.skipif(
DEFAULT_COMM.size not in {1, 4},
Expand Down
5 changes: 4 additions & 1 deletion tests/fenics/test_hessian_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

import numpy as np
import pytest
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

pytestmark = pytest.mark.skipif(
DEFAULT_COMM.size not in {1, 4},
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/backend_code_generator_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
from collections.abc import Sequence
import ffc
import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

__all__ = \
[
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/backend_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@

import functools
import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

__all__ = \
[
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/backend_overrides.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@
from .functions import Constant, define_var_alias

import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl
import warnings
import weakref

Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/block_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,10 @@


import petsc4py.PETSc as PETSc
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

from abc import ABC, abstractmethod
from collections import deque
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@
replaced_form)

from collections import defaultdict
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

__all__ = \
[
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@
derivative, eliminate_zeros, extract_coefficients)

import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

__all__ = \
[
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/fenics_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
import functools
import mpi4py.MPI as MPI
import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl

__all__ = \
[
Expand Down
5 changes: 4 additions & 1 deletion tlm_adjoint/fenics/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@
from ..overloaded_float import SymbolicFloat

import numpy as np
import ufl
try:
import ufl_legacy as ufl
except ImportError:
import ufl
import weakref

__all__ = \
Expand Down

0 comments on commit a5f11ff

Please sign in to comment.