示例#1
0
 def create_data():
     E = reference_element.DefaultTriangle()
     k = 3
     pts = reference_element.make_lattice(E.get_vertices(), k)
     Phis = expansions.get_expansion_set(E)
     phis = Phis.tabulate(k, pts)
     dphis = Phis.tabulate_derivatives(k, pts)
     return phis, dphis
示例#2
0
 def __init__(self, ref_el):
     if ref_el.get_spatial_dimension() != 2:
         raise Exception("Must have a triangle")
     self.ref_el = ref_el
     self.base_ref_el = reference_element.DefaultTriangle()
     v1 = ref_el.get_vertices()
     v2 = self.base_ref_el.get_vertices()
     self.A, self.b = reference_element.make_affine_mapping(v1, v2)
     self.mapping = lambda x: numpy.dot(self.A, x) + self.b
示例#3
0
文件: quadrature.py 项目: tj-sun/fiat
    def __init__(self, ref_el, m):
        ptx, wx = compute_gauss_jacobi_rule(0., 0., m)
        pty, wy = compute_gauss_jacobi_rule(1., 0., m)

        # map ptx , pty
        pts_ref = [expansions.xi_triangle((x, y)) for x in ptx for y in pty]

        Ref1 = reference_element.DefaultTriangle()
        A, b = reference_element.make_affine_mapping(Ref1.get_vertices(),
                                                     ref_el.get_vertices())
        mapping = lambda x: numpy.dot(A, x) + b

        scale = numpy.linalg.det(A)

        pts = tuple([tuple(mapping(x)) for x in pts_ref])

        wts = [0.5 * scale * w1 * w2 for w1 in wx for w2 in wy]

        QuadratureRule.__init__(self, ref_el, tuple(pts), tuple(wts))