Ejemplo n.º 1
0
def test_projection_matrix_bilinear():
    knots = [[0, 0, 1, 2, 3, 3], [0, 0, 1, 2, 3, 3]]
    d = [1, 1]
    dim = 2
    T = HierarchicalSpace(knots, d, dim)
    cells = {0: [1]}
    T = refine(T, cells)
    C = T.compute_full_projection_matrix(0)
    assert C.shape == (49, 16)
Ejemplo n.º 2
0
def test_projection_matrix_linear():
    knots = [[0, 0, 1, 2, 3, 3]]
    d = [1]
    dim = 1
    T = HierarchicalSpace(knots, d, dim)
    cells = {0: [1]}
    T = refine(T, cells)

    C = T.compute_full_projection_matrix(0)

    assert C.shape == (7, 4)
    np.testing.assert_allclose(
        C.toarray(),
        np.array([[1, 0, 0, 0], [0.5, 0.5, 0, 0], [0, 1, 0,
                                                   0], [0, 0.5, 0.5, 0],
                  [0, 0, 1, 0], [0, 0, 0.5, 0.5], [0, 0, 0, 1]]))