Skip to content

Commit

Permalink
remove all traces of MappingMortar and MortarFacetBasis
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnala committed Dec 11, 2023
1 parent 11d4fb6 commit 8c0a342
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 132 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ flake8
sphinx~=6.1
autograd
pep517
shapely
1 change: 0 additions & 1 deletion skfem/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
__all__ = all_mesh + all_assembly + all_element + [ # noqa
'MappingAffine',
'MappingIsoparametric',
'MappingMortar', # TODO remove due to deprecation
'adaptive_theta',
'build_pc_ilu',
'build_pc_diag',
Expand Down
3 changes: 1 addition & 2 deletions skfem/assembly/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from itertools import product

from .basis import (Basis, CellBasis, FacetBasis, BoundaryFacetBasis,
InteriorFacetBasis, MortarFacetBasis)
InteriorFacetBasis)
from .basis import InteriorBasis, ExteriorFacetBasis # backwards compatibility
from .dofs import Dofs, DofsView
from .form import Form, TrilinearForm, BilinearForm, LinearForm, Functional
Expand Down Expand Up @@ -94,7 +94,6 @@ def asm(form: Form,
"FacetBasis",
"BoundaryFacetBasis",
"InteriorFacetBasis",
"MortarFacetBasis",
"Dofs",
"DofsView",
"TrilinearForm",
Expand Down
1 change: 0 additions & 1 deletion skfem/assembly/basis/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from .cell_basis import CellBasis # noqa
from .facet_basis import FacetBasis # noqa
from .interior_facet_basis import InteriorFacetBasis # noqa
from .mortar_facet_basis import MortarFacetBasis # noqa

# aliases
Basis = CellBasis
Expand Down
1 change: 0 additions & 1 deletion skfem/mapping/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@
from .mapping import Mapping # noqa
from .mapping_affine import MappingAffine # noqa
from .mapping_isoparametric import MappingIsoparametric # noqa
from .mapping_mortar import MappingMortar # noqa
77 changes: 2 additions & 75 deletions tests/test_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
from skfem import BilinearForm, LinearForm, asm, solve, condense, projection
from skfem.mesh import (Mesh, MeshTri, MeshTet, MeshHex,
MeshQuad, MeshLine1, MeshWedge1)
from skfem.assembly import (CellBasis, FacetBasis, Dofs, Functional,
MortarFacetBasis)
from skfem.mapping import MappingIsoparametric, MappingMortar
from skfem.assembly import CellBasis, FacetBasis, Dofs, Functional
from skfem.mapping import MappingIsoparametric
from skfem.element import (ElementVectorH1, ElementTriP2, ElementTriP1,
ElementTetP2, ElementHexS2, ElementHex2,
ElementQuad2, ElementLineP2, ElementTriP0,
Expand Down Expand Up @@ -360,78 +359,6 @@ def test_pickling():
)


@pytest.mark.parametrize(
"m1, m2, lenright",
[
(
MeshTri().refined(3),
MeshTri().translated((1., 0.)).refined(2),
1.,
),
(
MeshTri.init_refdom().refined(3).with_boundaries(
{'right': lambda x: x[0] + x[1] == 1}
),
MeshTri().translated((1., 0.)).refined(2),
np.sqrt(2),
)
]
)
def test_mortar_basis(m1, m2, lenright):
# some sanity checks for MortarBasis
e = ElementTriP1()

mort = MappingMortar.init_2D(m1,
m2,
m1.boundaries['right'],
m2.boundaries['left'],
[0., 1.])

mb = [
MortarFacetBasis(m1, e, mapping=mort, intorder=4, side=0),
MortarFacetBasis(m2, e, mapping=mort, intorder=4, side=1),
]

@Functional
def unity(w):
return 1.

@LinearForm
def load(v, w):
return 1. * v

@BilinearForm
def mass(u, v, w):
return u * v

assert_allclose(mb[0].default_parameters()['h1'],
mb[1].default_parameters()['h1'])

assert_allclose(mb[0].default_parameters()['h2'],
mb[1].default_parameters()['h2'])

assert (mb[0].default_parameters()['h1']
< mb[0].default_parameters()['h2']).all()

assert_almost_equal(unity.assemble(mb[0]), lenright)
assert_almost_equal(unity.assemble(mb[1]), lenright)

assert_almost_equal(load.assemble(mb[0]).dot(m1.p[1]), .5 * lenright)
assert_almost_equal(load.assemble(mb[1]).dot(m2.p[1]), .5 * lenright)

# integral is over the domain of the first argument
assert_almost_equal((mass.assemble(mb[0], mb[1])
.dot(m1.p[0] * 0. + 1.)
.dot(m2.p[0] * 0. + 1.)), lenright)

assert_almost_equal((mass.assemble(mb[1], mb[0])
.dot(m2.p[0] * 0. + 1.)
.dot(m1.p[0] * 0. + 1.)), lenright)

assert_allclose(mass.assemble(mb[0], mb[1]).toarray(),
mass.assemble(mb[1], mb[0]).T.toarray())


@pytest.mark.parametrize(
"m, e, fun",
[
Expand Down
52 changes: 0 additions & 52 deletions tests/test_mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from skfem.mesh import MeshHex, MeshQuad, MeshTri
from skfem.element import ElementHex1, ElementQuad1, ElementHex2
from skfem.assembly import FacetBasis
from skfem.mapping import MappingMortar


class TestIsoparamNormals(unittest.TestCase):
Expand Down Expand Up @@ -88,54 +87,3 @@ class TestInverseMappingHex2(TestInverseMappingHex):
"""This should be equivalent to TestInverseMappingHex."""

element = ElementHex2


class TestMortarPair(unittest.TestCase):
"""Check that mapped points match."""

mesh1_type = MeshTri
mesh2_type = MeshTri
nrefs1 = 2
nrefs2 = 3
translate_y = 0.0

def init_meshes(self):
m1 = self.mesh1_type().refined(self.nrefs1)
m2 = self.mesh2_type().refined(self.nrefs2).translated((1.0, self.translate_y))
return m1, m2

def runTest(self):
m1, m2 = self.init_meshes()
mp = MappingMortar.init_2D(m1, m2,
m1.facets_satisfying(lambda x: x[0] == 1.),
m2.facets_satisfying(lambda x: x[0] == 1.),
np.array([0., 1.]))
test_points = np.array([np.linspace(0., 1., 7)])
self.assertTrue((mp.G(test_points) -
mp.G(test_points) < 1e-10).all())


class TestMortarPairTriQuad(TestMortarPair):

mesh1_type = MeshTri
mesh2_type = MeshQuad


class TestMortarPairQuadQuad(TestMortarPair):

mesh1_type = MeshQuad
mesh2_type = MeshQuad


class TestMortarPairNoMatch1(TestMortarPair):

mesh1_type = MeshQuad
mesh2_type = MeshTri
translate_y = 0.1


class TestMortarPairNoMatch2(TestMortarPair):

mesh1_type = MeshQuad
mesh2_type = MeshTri
translate_y = -np.pi / 10.

0 comments on commit 8c0a342

Please sign in to comment.