From 4874b86c398b10a6178735d6e0e482d74cce646c Mon Sep 17 00:00:00 2001 From: Jack Betteridge Date: Fri, 4 Oct 2024 14:30:30 +0100 Subject: [PATCH] Remove slow cdist as scipy is now a hard dependency --- ngsPETSc/utils/firedrake/meshes.py | 19 +------------------ 1 file changed, 1 insertion(+), 18 deletions(-) diff --git a/ngsPETSc/utils/firedrake/meshes.py b/ngsPETSc/utils/firedrake/meshes.py index c6cb755..4fc10a9 100644 --- a/ngsPETSc/utils/firedrake/meshes.py +++ b/ngsPETSc/utils/firedrake/meshes.py @@ -11,12 +11,7 @@ import numpy as np from petsc4py import PETSc - -try: - from scipy.spatial.distance import cdist - HAVE_SCIPY = True -except ImportError: - HAVE_SCIPY = False +from scipy.spatial.distance import cdist import netgen import netgen.meshing as ngm @@ -77,18 +72,6 @@ def refineMarkedElements(self, mark): raise NotImplementedError("No implementation for dimension other than 2 and 3.") -def _slow_cdist(XA, XB): - dist = np.zeros([len(XA), len(XB)]) - for ii, a in enumerate(XA): - for jj, b in enumerate(XB): - dist[ii, jj] = np.linalg.norm(b - a) - return dist - - -if not HAVE_SCIPY: - cdist = PETSc.Log.EventDecorator()(_slow_cdist) - - @PETSc.Log.EventDecorator() def find_permutation(points_a, points_b, tol=1e-5): """ Find all permutations between a list of two sets of points.