Exemplo n.º 1
0
    def runTest(self):
        mtype, etype = self.case
        m = mtype().refined(3)
        e = etype()
        ib = InteriorBasis(m, e)

        x = self.initOnes(ib)
        f = ib.interpolator(x)

        X = np.array([np.sin(m.p[0, :]), np.sin(3. * m.p[1, :])])
        self.assertTrue(np.sum(f(X) - 1.0) < 1.0e-10)
Exemplo n.º 2
0
 def runTest(self):
     m = self.mesh_type().refined(self.nrefs)
     basis = InteriorBasis(m, self.element_type())
     x = projection(lambda x: x[0]**2, basis)
     fun = basis.interpolator(x)
     X = np.linspace(0, 1, 10)
     dim = m.dim()
     if dim == 3:
         y = fun(np.array([X, [0.31] * 10, [0.62] * 10]))
     elif dim == 2:
         y = fun(np.array([X, [0.31] * 10]))
     else:
         y = fun(np.array([X]))
     assert_allclose(y, X**2, atol=1e-10)