Skip to content

Commit 02a22a8

Browse files
authored
Merge pull request #267 from mfem/custom_bessel
Custom bessel
2 parents 69f5d1d + 4e3083c commit 02a22a8

File tree

6 files changed

+357
-13
lines changed

6 files changed

+357
-13
lines changed

.github/workflows/build-and-test-callable.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,9 @@ jobs:
8989
# Download/install dependencies
9090
# -------------------------------------------------------------------------------------------------
9191
- name: Install core dependencies via requirements.txt
92-
run: pip install -r requirements.txt --verbose
92+
run: |
93+
pip install setuptools
94+
pip install -r requirements.txt --verbose
9395
9496
- name: Install MPI
9597
if: inputs.parallel

.github/workflows/build-and-test-dispatch.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
fail-fast: false
3131
matrix:
3232
mfem-branch: [master, default] # 'default' uses a specific commit hash defined in setup.py:repos_sha
33-
python-version: ['3.8', '3.9', '3.10', '3.11'] # 3.12 is not supported by scipy
33+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] # 3.12 is not supported by scipy
3434
parallel: [false]
3535
name: test-linux | ${{ matrix.mfem-branch }} | ${{ matrix.python-version }} | ${{ matrix.parallel && 'parallel' || 'serial' }}
3636
uses: ./.github/workflows/build-and-test-callable.yml
@@ -46,7 +46,7 @@ jobs:
4646
fail-fast: false
4747
matrix:
4848
mfem-branch: [master, default] # 'default' uses a specific commit hash defined in setup.py:repos_sha
49-
python-version: ['3.9', '3.10', '3.11'] # 3.12 is not supported by scipy
49+
python-version: ['3.9', '3.10', '3.11', '3.12'] # 3.12 is not supported by scipy
5050
parallel: [true]
5151
name: test-linux | ${{ matrix.mfem-branch }} | ${{ matrix.python-version }} | ${{ matrix.parallel && 'parallel' || 'serial' }}
5252
uses: ./.github/workflows/build-and-test-callable.yml

examples/ex25.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,14 @@
1919
from os.path import expanduser, join, dirname
2020
import numpy as np
2121
from numpy import sin, cos, exp, sqrt, pi
22-
import scipy.special
2322

23+
try:
24+
import numba
25+
except ImportError:
26+
assert False, "Numba is required"
27+
28+
from mfem.common.bessel import jv as jn
29+
from mfem.common.bessel import yv as yn
2430

2531
prob = ''
2632

@@ -526,8 +532,6 @@ def source(x, out):
526532

527533

528534
def maxwell_solution(x, E, sdim):
529-
jn = scipy.special.jv
530-
yn = scipy.special.yn
531535
# Initialize
532536
for i in range(sdim):
533537
E[i] = 0.0
@@ -683,7 +687,7 @@ def detJ_JT_J_inv_Im_f(x, D):
683687
det *= dxs[i]
684688
for i in range(dim):
685689
D[i] = (det / (dxs[i]**2)).imag
686-
#print("imag", D)
690+
# print("imag", D)
687691

688692

689693
def detJ_JT_J_inv_abs_f(x, D):

examples/ex25p.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,22 @@
1212
* calling JITed function from JITed coefficient
1313
1414
'''
15+
from mpi4py import MPI
16+
from mfem.common.bessel import yv as yn
17+
from mfem.common.bessel import jv as jn
1518
from numba import jit, types, carray
1619
import os
1720
import mfem.par as mfem
1821
from mfem.par import intArray
1922
from os.path import expanduser, join, dirname
2023
import numpy as np
2124
from numpy import sin, cos, exp, sqrt, pi
22-
import scipy.special
23-
from mpi4py import MPI
25+
26+
try:
27+
import numba
28+
except ImportError:
29+
assert False, "Numba is required"
30+
2431

2532
num_procs = MPI.COMM_WORLD.size
2633
myid = MPI.COMM_WORLD.rank
@@ -546,9 +553,6 @@ def source(x):
546553

547554
def maxwell_solution(x):
548555

549-
jn = scipy.special.jv
550-
yn = scipy.special.yn
551-
552556
# Initialize
553557
E = np.zeros(dim, dtype=np.complex128)
554558

0 commit comments

Comments
 (0)