move stuff under fdmath

This commit is contained in:
Jan Petykiewicz 2019-11-27 22:59:52 -08:00
commit a956323b94
23 changed files with 304 additions and 272 deletions

View file

@ -5,7 +5,8 @@ import pytest
import numpy
#from numpy.testing import assert_allclose, assert_array_equal
from .. import fdfd, vec, unvec
from .. import fdfd
from ..fdmath import vec, unvec
from .utils import assert_close, assert_fields_close
@ -20,6 +21,10 @@ def test_poynting_planes(sim):
mask = (sim.j != 0).any(axis=0)
if mask.sum() != 2:
pytest.skip(f'test_poynting_planes will only test 2-point sources, got {mask.sum()}')
# for dxg in sim.dxes:
# for dxa in dxg:
# if not (dxa == sim.dxes[0][0][0]).all():
# pytest.skip('test_poynting_planes skips nonuniform dxes')
points = numpy.where(mask)
mask[points[0][0], points[1][0], points[2][0]] = 0
@ -43,7 +48,6 @@ def test_poynting_planes(sim):
assert_close(sum(planes), src_energy.sum())
#####################################
# Test fixtures
#####################################
@ -102,6 +106,15 @@ def sim(request, shape, epsilon, dxes, j_distribution, omega, pec, pmc):
# if is3d:
# pytest.skip('Skipping dt != 0.3 because test is 3D (for speed)')
# # If no edge currents, add pmls
# src_mask = j_distribution.any(axis=0)
# th = 10
# #if src_mask.sum() - src_mask[th:-th, th:-th, th:-th].sum() == 0:
# if src_mask.sum() - src_mask[th:-th, :, :].sum() == 0:
# for axis in (0,):
# for polarity in (-1, 1):
# dxes = fdfd.scpml.stretch_with_scpml(dxes, axis=axis, polarity=polarity,
j_vec = vec(j_distribution)
eps_vec = vec(epsilon)
e_vec = fdfd.solvers.generic(J=j_vec, omega=omega, dxes=dxes, epsilon=eps_vec,

View file

@ -6,7 +6,8 @@ import pytest
import numpy
from numpy.testing import assert_allclose, assert_array_equal
from .. import fdfd, vec, unvec
from .. import fdfd
from ..fdmath import vec, unvec
from .utils import assert_close, assert_fields_close
from .test_fdfd import FDResult