diff --git a/docs/example2.py b/docs/example2.py index cd6594e..f7d98a4 100755 --- a/docs/example2.py +++ b/docs/example2.py @@ -130,7 +130,7 @@ solver(b, u) - u_global = dmConst.augmentWithBoundaryData(u, g_interp) + u_global = u.augmentWithBoundaryData(g_interp) plt.figure().gca().set_title('Numerical solution, constant kernel') u_global.plot() diff --git a/drivers/runNonlocal.py b/drivers/runNonlocal.py index d585dbf..b507df6 100755 --- a/drivers/runNonlocal.py +++ b/drivers/runNonlocal.py @@ -7,7 +7,6 @@ ################################################################################### from mpi4py import MPI -import numpy as np from PyNucleus import driver, DIRICHLET, NEUMANN from PyNucleus.nl import (nonlocalPoissonProblem, discretizedNonlocalProblem) diff --git a/fem/PyNucleus_fem/factories.py b/fem/PyNucleus_fem/factories.py index bafaf25..8fa0f9b 100644 --- a/fem/PyNucleus_fem/factories.py +++ b/fem/PyNucleus_fem/factories.py @@ -9,9 +9,7 @@ from PyNucleus_base.factory import factory from . functions import (simpleAnisotropy, simpleAnisotropy2, inclusions, inclusionsHong, motorPermeability) -from . functions import (function, - vectorFunction, - _rhsFunSin1D, _solSin1D, _rhsFunSin2D, _cos1D, _cos2D, _rhsCos2D, _grad_cos2d_n, +from . functions import (_rhsFunSin1D, _solSin1D, _rhsFunSin2D, _cos1D, _cos2D, _rhsCos2D, _grad_cos2d_n, _rhsFunSin3D, _solSin2D, _solSin3D, Lambda, constant, monomial, complexLambda, diff --git a/fem/PyNucleus_fem/mesh.py b/fem/PyNucleus_fem/mesh.py index 46765db..44bf718 100644 --- a/fem/PyNucleus_fem/mesh.py +++ b/fem/PyNucleus_fem/mesh.py @@ -17,7 +17,6 @@ from . meshCy import (meshBase, boundaryVertices, boundaryEdges, - boundaryFaces, boundaryFacesWithOrientation, boundaryVerticesFromBoundaryEdges, boundaryEdgesFromBoundaryFaces, diff --git a/multilevelSolver/PyNucleus_multilevelSolver/__init__.py b/multilevelSolver/PyNucleus_multilevelSolver/__init__.py index ffdd9b2..1c522fd 100644 --- a/multilevelSolver/PyNucleus_multilevelSolver/__init__.py +++ b/multilevelSolver/PyNucleus_multilevelSolver/__init__.py @@ -16,4 +16,3 @@ solverFactory.register('mg', multigrid, isMultilevelSolver=True) solverFactory.register('complex_mg', Complexmultigrid, isMultilevelSolver=True) - diff --git a/multilevelSolver/PyNucleus_multilevelSolver/connectors.py b/multilevelSolver/PyNucleus_multilevelSolver/connectors.py index ff00e69..db677b2 100644 --- a/multilevelSolver/PyNucleus_multilevelSolver/connectors.py +++ b/multilevelSolver/PyNucleus_multilevelSolver/connectors.py @@ -11,7 +11,6 @@ from mpi4py import MPI import logging import numpy as np -from copy import deepcopy from PyNucleus_base.myTypes import REAL, INDEX, TAG from PyNucleus_base import uninitialized from . levels import meshLevel, algebraicLevel diff --git a/multilevelSolver/PyNucleus_multilevelSolver/geometricMG.py b/multilevelSolver/PyNucleus_multilevelSolver/geometricMG.py index 41dc1b7..5d8796e 100644 --- a/multilevelSolver/PyNucleus_multilevelSolver/geometricMG.py +++ b/multilevelSolver/PyNucleus_multilevelSolver/geometricMG.py @@ -8,7 +8,6 @@ from __future__ import division import logging import numpy as np -from PyNucleus_base.ip_norm import norm_serial as norm from PyNucleus_base.utilsFem import getLoggingTimer from PyNucleus_base import REAL, INDEX, uninitialized from PyNucleus_fem import P1_DoFMap diff --git a/nl/PyNucleus_nl/discretizedProblems.py b/nl/PyNucleus_nl/discretizedProblems.py index 2e6bd28..a5c1daf 100644 --- a/nl/PyNucleus_nl/discretizedProblems.py +++ b/nl/PyNucleus_nl/discretizedProblems.py @@ -22,7 +22,6 @@ from PyNucleus_multilevelSolver import hierarchyManager from copy import copy from . helpers import paramsForFractionalHierarchy -from . fractionalOrders import singleVariableUnsymmetricFractionalOrder from . kernelsCy import FRACTIONAL from . nonlocalProblems import (DIRICHLET, NEUMANN, HOMOGENEOUS_NEUMANN, diff --git a/nl/PyNucleus_nl/nonlocalLaplacianBase.pyx b/nl/PyNucleus_nl/nonlocalLaplacianBase.pyx index 3750257..873a729 100644 --- a/nl/PyNucleus_nl/nonlocalLaplacianBase.pyx +++ b/nl/PyNucleus_nl/nonlocalLaplacianBase.pyx @@ -11,6 +11,7 @@ from libc.math cimport (sin, cos, sinh, cosh, tanh, sqrt, atan2, log, ceil, fabs as abs, M_PI as pi, pow, tgamma as gamma) +from scipy.special import factorial from PyNucleus_base.myTypes import INDEX, REAL, COMPLEX, ENCODE, BOOL from PyNucleus_base import uninitialized from PyNucleus_base.blas cimport mydot @@ -58,7 +59,7 @@ cdef class PermutationIndexer: self.factorials = np.zeros((N), dtype=INDEX) for i in range(N): - self.factorials[i] = np.math.factorial(N-1-i) + self.factorials[i] = factorial(N-1-i, True) self.lehmer = np.zeros(N, dtype=INDEX) cdef INDEX_t rank(self, INDEX_t[::1] perm): diff --git a/nl/PyNucleus_nl/nonlocalLaplacianBase_{SCALAR}.pxi b/nl/PyNucleus_nl/nonlocalLaplacianBase_{SCALAR}.pxi index 765b7f4..01ce11a 100644 --- a/nl/PyNucleus_nl/nonlocalLaplacianBase_{SCALAR}.pxi +++ b/nl/PyNucleus_nl/nonlocalLaplacianBase_{SCALAR}.pxi @@ -72,8 +72,8 @@ cdef class {SCALAR_label}double_local_matrix_t: REAL_t eps = 1e-10 INDEX_t dim = self.DoFMap.mesh.manifold_dim - perms = uninitialized((np.math.factorial(dim+1), dim+1), dtype=INDEX) - surface_perms = uninitialized((np.math.factorial(dim), dim), dtype=INDEX) + perms = uninitialized((factorial(dim+1, True), dim+1), dtype=INDEX) + surface_perms = uninitialized((factorial(dim, True), dim), dtype=INDEX) from itertools import permutations diff --git a/tests/test_kernels.py b/tests/test_kernels.py index 36507dd..f490362 100644 --- a/tests/test_kernels.py +++ b/tests/test_kernels.py @@ -142,6 +142,7 @@ def idfuncFractional(param): mesh1d = meshFactory('interval', a=-1, b=1, hTarget=1e-2) dm1d = dofmapFactory('P1', mesh1d, -1) + @pytest.fixture(scope='module', params=[ # 1d kernels (1, fractionalOrderFactory('const', 0.25), np.inf, True, None, 0),