Example #1
0
def test_morley():
    ref_cell = FIAT.ufc_simplex(2)
    ref_element = finat.Morley(ref_cell, 2)
    ref_pts = finat.point_set.PointSet(ref_cell.make_points(2, 0, 4))

    phys_cell = FIAT.ufc_simplex(2)
    phys_cell.vertices = ((0.0, 0.1), (1.17, -0.09), (0.15, 1.84))

    mapping = MyMapping(ref_cell, phys_cell)
    z = (0, 0)
    finat_vals_gem = ref_element.basis_evaluation(0, ref_pts, coordinate_mapping=mapping)[z]
    finat_vals = evaluate([finat_vals_gem])[0].arr

    phys_cell_FIAT = FIAT.Morley(phys_cell)
    phys_points = phys_cell.make_points(2, 0, 4)
    phys_vals = phys_cell_FIAT.tabulate(0, phys_points)[z]

    assert np.allclose(finat_vals, phys_vals.T)
Example #2
0
 def __init__(self, cell, degree):
     if degree != 2:
         raise ValueError("Degree must be 2 for Morley element")
     if Citations is not None:
         Citations().register("Morley1971")
     super().__init__(FIAT.Morley(cell))