Example #1
0
def test_meshio_cycle(m):

    M = from_meshio(to_meshio(m))
    assert_array_equal(M.p, m.p)
    assert_array_equal(M.t, m.t)
    assert m.boundaries == M.boundaries
    assert m.subdomains == M.subdomains
Example #2
0
def test_meshio_cycle_subdomains(m):

    m = m.refined(2).with_subdomains(_test_lambda)
    M = from_meshio(to_meshio(m))
    assert_array_equal(M.p, m.p)
    assert_array_equal(M.t, m.t)
    for key in m.subdomains:
        assert_array_equal(M.subdomains[key], m.subdomains[key])
Example #3
0
def test_meshio_cycle_boundaries(boundaries_only, m):

    m = m.with_boundaries(_test_lambda, boundaries_only)
    M = from_meshio(to_meshio(m))
    assert_array_equal(M.p, m.p)
    assert_array_equal(M.t, m.t)
    for key in m.boundaries:
        assert_array_equal(M.boundaries[key].sort(), m.boundaries[key].sort())
Example #4
0
def test_meshio_cycle_boundaries(internal_facets, m):

    m = m.with_boundaries(_test_lambda, internal_facets)
    M = from_meshio(to_meshio(m))
    assert_array_equal(M.p, m.p)
    assert_array_equal(M.t, m.t)
    for key in m.boundaries:
        assert_array_equal(M.boundaries[key].sort(), m.boundaries[key].sort())
Example #5
0
def test_meshio_cycle(m):

    M = from_meshio(to_meshio(m))
    assert_array_equal(M.p, m.p)
    assert_array_equal(M.t, m.t)
    if m.boundaries is not None:
        np.testing.assert_equal(m.boundaries, M.boundaries)
    if m.subdomains is not None:
        np.testing.assert_equal(m.subdomains, M.subdomains)
Example #6
0
def test_oriented_saveload(m: Mesh):

    m = m.refined(4)
    m = m.with_boundaries({"mid": m.facets_around([5]),})
    assert len(m.boundaries["mid"].ori) == m.refdom.nfacets

    M = from_meshio(to_meshio(m))

    assert_array_equal(
        m.boundaries["mid"].ori, M.boundaries["mid"].ori,
    )
Example #7
0
 def mesh(self, geom: Optional[Geometry] = None, **kwargs) -> MeshTet:
     return from_meshio(generate_mesh(geom or self.geom(**kwargs)))