Exemple #1
0
def test_moebius3(num_twists, num_points, num_cells, ref1, ref2):
    points, cells = meshzoo.moebius(num_twists, 100, 10, mode="classical")
    assert len(points) == num_points
    assert len(cells) == num_cells
    assert _near_equal(numpy.sum(points, axis=0), ref1, tol=1.0e-10)
    sum_points2 = numpy.sum(points**2, axis=0)
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
Exemple #2
0
def test_moebius2(num_twists, num_points, num_cells, ref1, ref2):
    points, cells = meshzoo.moebius(nl=190, nw=30, num_twists=num_twists, mode="smooth")
    assert len(points) == num_points
    assert len(cells) == num_cells
    assert _near_equal(numpy.sum(points, axis=0), ref1, tol=1.0e-10)
    sum_points2 = numpy.sum(points ** 2, axis=0)
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
Exemple #3
0
def test_moebius():
    points, cells = meshzoo.moebius()
    assert len(points) == 5890
    assert _near_equal(
            numpy.sum(points, axis=0),
            [-4.10009804e-11, -8.85214124e-12, -1.43687579e-13]
            )
    assert len(cells) == 11400

    points, cells = meshzoo.moebius(moebius_index=2)
    assert len(points) == 5890
    assert _near_equal(
            numpy.sum(points, axis=0),
            [4.72333284e-12, 4.80460116e-12, 1.88295560e-14]
            )
    assert len(cells) == 11400
    return
Exemple #4
0
def test_moebius3(num_twists, num_points, num_cells, ref1, ref2):
    points, cells = meshzoo.moebius(num_twists, 100, 10, mode="classical")
    assert len(points) == num_points
    assert len(cells) == num_cells
    assert _near_equal(numpy.sum(points, axis=0), ref1, tol=1.0e-10)
    sum_points2 = numpy.sum(points ** 2, axis=0)
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
    return
Exemple #5
0
def test_moebius2(num_twists, num_points, num_cells, ref1, ref2):
    points, cells = meshzoo.moebius(nl=190, nw=30, num_twists=num_twists, mode="smooth")
    assert len(points) == num_points
    assert len(cells) == num_cells
    assert _near_equal(numpy.sum(points, axis=0), ref1, tol=1.0e-10)
    sum_points2 = numpy.sum(points ** 2, axis=0)
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
    return
Exemple #6
0
def test_pseudomoebius():
    points, cells = meshzoo.moebius(nl=190, nw=31, mode="pseudo")
    assert len(points) == 5890
    assert len(cells) == 11400
    assert _near_equal(numpy.sum(points, axis=0), [0, 0, 0], tol=1.0e-10)
    sum_points2 = numpy.sum(points**2, axis=0)
    ref2 = [2753575 / 9.0, 2724125 / 9.0, 58900 / 3.0]
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
Exemple #7
0
def test_pseudomoebius():
    points, cells = meshzoo.moebius(nl=190, nw=31, mode="pseudo")
    assert len(points) == 5890
    assert len(cells) == 11400
    assert _near_equal(numpy.sum(points, axis=0), [0, 0, 0], tol=1.0e-10)
    sum_points2 = numpy.sum(points ** 2, axis=0)
    ref2 = [2753575 / 9.0, 2724125 / 9.0, 58900 / 3.0]
    assert numpy.allclose(sum_points2, ref2, rtol=1.0e-12, atol=0.0)
    return
Exemple #8
0
def test_euler_characteristic():
    points = [[0.0, 0.0], [1.0, 0.0], [0.0, 1.0]]
    cells = [[0, 1, 2]]
    mesh = meshplex.MeshTri(points, cells)
    assert mesh.euler_characteristic == 1
    assert mesh.genus == 0

    points, cells = meshzoo.icosa_sphere(5)
    mesh = meshplex.MeshTri(points, cells)
    assert mesh.euler_characteristic == 2
    assert mesh.genus == 0

    points, cells = meshzoo.moebius(num_twists=1, nl=21, nw=6)
    mesh = meshplex.MeshTri(points, cells)
    assert mesh.euler_characteristic == 0
    with pytest.raises(RuntimeError):
        mesh.genus