Skip to content

Commit 47d7a65

Browse files
committed
Updates for latest tlm_adjoint
1 parent af25e3b commit 47d7a65

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

fenics_ice/solver.py

+16-5
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,12 @@ def interior(x_coords, y_space):
5656

5757

5858
def interpolation_matrix(x_coords, y_space):
59-
from tlm_adjoint.fenics.fenics_equations import greedy_coloring, \
60-
interpolation_matrix, point_owners
59+
try:
60+
from tlm_adjoint.fenics.interpolation import (
61+
greedy_coloring, interpolation_matrix, point_owners)
62+
except ImportError:
63+
from tlm_adjoint.fenics.fenics_equations import (
64+
greedy_coloring, interpolation_matrix, point_owners)
6165

6266
y_cells = point_owners(x_coords, y_space, tolerance=np.inf)
6367
x_local = np.array(y_cells >= 0, dtype=bool)
@@ -964,8 +968,12 @@ def B_M_0(*X):
964968
M
965969
"""
966970

967-
from tlm_adjoint.fenics.backend_code_generator_interface import \
968-
matrix_multiply
971+
try:
972+
from tlm_adjoint.fenics.backend_interface import \
973+
matrix_multiply
974+
except ImportError:
975+
from tlm_adjoint.fenics.backend_code_generator_interface import \
976+
matrix_multiply
969977

970978
B_0_action = []
971979
for i, x in enumerate(X):
@@ -1268,7 +1276,10 @@ def comp_J_inv(self, verbose=False):
12681276
cache_jacobian=False, cache_rhs_assembly=False).solve()
12691277

12701278
if not hasattr(self, "_cached_J_mismatch_data"):
1271-
from tlm_adjoint.fenics.fenics_equations import LocalMatrix
1279+
try:
1280+
from tlm_adjoint.fenics.interpolation import LocalMatrix
1281+
except ImportError:
1282+
from tlm_adjoint.fenics.fenics_equations import LocalMatrix
12721283
from scipy.sparse import spdiags
12731284

12741285
obs_local, P = interpolation_matrix(uv_obs_pts, interp_space)

0 commit comments

Comments
 (0)