Skip to content

Commit

Permalink
rename to with_defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
kinnala committed Jun 17, 2024
1 parent 1b7a678 commit baf82f2
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ with respect to documented and/or tested features.
point integration rule
- Changed: Default tags ('left', 'right', 'top', ...) are no more
added automatically during mesh initialization, as a workaround you
can add them explicitly by calling `mesh = mesh.with_default_tags()`
can add them explicitly by calling `mesh = mesh.with_defaults()`

### [9.1.1] - 2024-04-23

Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ex02.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
m = (MeshTri
.init_symmetric()
.refined(3)
.with_default_tags())
.with_defaults())
basis = Basis(m, ElementTriMorley())

d = 0.1
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ex03.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

m1 = MeshLine(np.linspace(0, 5, 50))
m2 = MeshLine(np.linspace(0, 1, 10))
m = (m1 * m2).with_default_tags()
m = (m1 * m2).with_defaults()

e1 = ElementQuad1()
e = ElementVector(e1)
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/ex11.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
from skfem.models.elasticity import lame_parameters


m = MeshHex().refined(3).with_default_tags()
m = MeshHex().refined(3).with_defaults()
e = ElementVector(ElementHex1())
basis = Basis(m, e, intorder=3)

Expand Down
4 changes: 2 additions & 2 deletions docs/howto.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ the boundary. Currently the main tool for finding DOFs is
.. doctest::

>>> from skfem import MeshTri, Basis, ElementTriP2
>>> m = MeshTri().refined(2).with_default_tags()
>>> m = MeshTri().refined(2).with_defaults()
>>> basis = Basis(m, ElementTriP2())

.. plot::
Expand Down Expand Up @@ -118,7 +118,7 @@ as follows:

from skfem import *
from skfem.visuals.matplotlib import *
m = MeshTri().refined(2).with_default_tags()
m = MeshTri().refined(2).with_defaults()
basis = Basis(m, ElementTriP2())
dofs = basis.get_dofs('left')
ax = draw(m)
Expand Down
2 changes: 1 addition & 1 deletion skfem/mesh/mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def boundary_edges(self) -> ndarray:
))[0]
return edge_candidates[ix]

def with_default_tags(self):
def with_defaults(self):
"""Return a copy with the default tags ('left', 'right', ...)."""
return self.with_boundaries(self._build_default_tags())

Expand Down
20 changes: 10 additions & 10 deletions tests/test_assembly.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,13 +598,13 @@ def proj(v, _):
@pytest.mark.parametrize(
"basis",
[
Basis(MeshTri().refined(6).with_default_tags(),
Basis(MeshTri().refined(6).with_defaults(),
ElementTriRT1()),
Basis(MeshTri().refined(4).with_default_tags(),
Basis(MeshTri().refined(4).with_defaults(),
ElementTriRT2()),
Basis(MeshTri().refined(5).with_default_tags(),
Basis(MeshTri().refined(5).with_defaults(),
ElementTriBDM1()),
Basis(MeshQuad().refined(4).with_default_tags(),
Basis(MeshQuad().refined(4).with_defaults(),
ElementQuadRT1()),
]
)
Expand All @@ -630,9 +630,9 @@ def test2(w):
@pytest.mark.parametrize(
"basis",
[
Basis(MeshTet().refined(4).with_default_tags(),
Basis(MeshTet().refined(4).with_defaults(),
ElementTetRT1()),
Basis(MeshHex().refined(4).with_default_tags(),
Basis(MeshHex().refined(4).with_defaults(),
ElementHexRT1()),
]
)
Expand All @@ -657,11 +657,11 @@ def test2(w):
@pytest.mark.parametrize(
"basis",
[
Basis(MeshTri().refined(4).with_default_tags(),
Basis(MeshTri().refined(4).with_defaults(),
ElementTriN1()),
Basis(MeshTri().refined(4).with_default_tags(),
Basis(MeshTri().refined(4).with_defaults(),
ElementTriN2()),
Basis(MeshQuad().refined(3).with_default_tags(),
Basis(MeshQuad().refined(3).with_defaults(),
ElementQuadN1()),
]
)
Expand All @@ -686,7 +686,7 @@ def test2(w):
@pytest.mark.parametrize(
"basis",
[
Basis(MeshTet().refined(2).with_default_tags(),
Basis(MeshTet().refined(2).with_defaults(),
ElementTetN1()),
]
)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_autodiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def poisson(u, v, w):

def test_navier_stokes():

m = MeshTri.init_sqsymmetric().refined(2).with_default_tags()
m = MeshTri.init_sqsymmetric().refined(2).with_defaults()
basis = Basis(m, ElementVector(ElementTriP2()) * ElementTriP1())
x = basis.zeros()

Expand Down Expand Up @@ -101,7 +101,7 @@ def test_nonlin_elast():
.init_tensor(np.linspace(0, 5, 20),
np.linspace(0, 0.5, 5))
.to_meshtri(style='x')
.with_default_tags())
.with_defaults())
e = ElementVector(ElementTriP1())
basis = Basis(m, e)
x = basis.zeros()
Expand Down
2 changes: 1 addition & 1 deletion tests/test_basis.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ class TestCompositeFacetAssembly(TestCase):

def runTest(self):

m = MeshTri().with_default_tags()
m = MeshTri().with_defaults()

fbasis1 = FacetBasis(m, ElementTriP1() * ElementTriP1(),
facets=m.facets_satisfying(lambda x: x[0] == 0))
Expand Down
2 changes: 1 addition & 1 deletion tests/test_mesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ def test_incidence(mesh):

def test_restrict_tags_boundary():

m = MeshTri().refined(3).with_default_tags()
m = MeshTri().refined(3).with_defaults()
m = m.with_subdomains({
'left': lambda x: x[0] <= 0.5,
'bottom': lambda x: x[1] <= 0.5,
Expand Down
6 changes: 3 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def test_simple_cg_solver():

def test_mpc_periodic():

m = MeshQuad().refined(3).with_default_tags()
m = MeshQuad().refined(3).with_defaults()
basis = Basis(m, ElementQuad1())
A = laplace.assemble(basis)
b = unit_load.assemble(basis)
Expand All @@ -93,7 +93,7 @@ def test_mpc_periodic():

def test_mpc_2x_periodic():

m = MeshTri.init_sqsymmetric().refined(4).with_default_tags()
m = MeshTri.init_sqsymmetric().refined(4).with_defaults()
e = ElementTriP2()

basis = Basis(m, e)
Expand All @@ -118,7 +118,7 @@ def test_mpc_2x_periodic():

def test_mpc_doubly_periodic():

m = MeshTri.init_sqsymmetric().refined(5).with_default_tags()
m = MeshTri.init_sqsymmetric().refined(5).with_defaults()
e = ElementTriP1()

basis = Basis(m, e)
Expand Down

0 comments on commit baf82f2

Please sign in to comment.