예제 #1
0
파일: test_mesh.py 프로젝트: kinnala/sp.fem
    def runTest(self):
        mesh=copy.deepcopy(self.mesh)
        mesh.refine(2)

        # test that f2t is the inverse of t2f at least in some sense
        t2f2t=np.equal(mesh.t2f[:,mesh.f2t[0,:]],np.tile(np.arange(mesh.facets.shape[1]),(3,1))).astype(np.intp)
        self.assertEqual(np.sum(t2f2t),mesh.facets.shape[1])

        # test that repeatedly doing t2f and f2t starting from some
        # triangle reaches the whole mesh eventually
        curts=np.array([4])
        for itr in range(15):
            toaddts=np.array([])
            for jtr in curts:
                if jtr!=-1:
                    fs=mesh.t2f[:,jtr]
                    newts=np.unique(mesh.f2t[:,fs].flatten())
                    toaddts=np.append(toaddts,newts)
            curts=np.append(curts,toaddts)
            curts=np.unique(curts)
        self.assertEqual(curts.shape[0]-1,mesh.t.shape[1])
예제 #2
0
    def runTest(self):
        mesh = copy.deepcopy(self.mesh)
        mesh.refine(2)

        # test that f2t is the inverse of t2f at least in some sense
        t2f2t = np.equal(mesh.t2f[:, mesh.f2t[0, :]],
                         np.tile(np.arange(mesh.facets.shape[1]),
                                 (3, 1))).astype(np.intp)
        self.assertEqual(np.sum(t2f2t), mesh.facets.shape[1])

        # test that repeatedly doing t2f and f2t starting from some
        # triangle reaches the whole mesh eventually
        curts = np.array([4])
        for itr in range(15):
            toaddts = np.array([])
            for jtr in curts:
                if jtr != -1:
                    fs = mesh.t2f[:, jtr]
                    newts = np.unique(mesh.f2t[:, fs].flatten())
                    toaddts = np.append(toaddts, newts)
            curts = np.append(curts, toaddts)
            curts = np.unique(curts)
        self.assertEqual(curts.shape[0] - 1, mesh.t.shape[1])
예제 #3
0
    def runTest(self):
        mesh = copy.deepcopy(self.mesh)
        mesh.refine(4)

        # check that maximum vertex index in mesh.t exists in mesh.p
        self.assertEqual(np.max(mesh.t), mesh.p.shape[1] - 1)
예제 #4
0
파일: test_mesh.py 프로젝트: kinnala/sp.fem
    def runTest(self):
        mesh=copy.deepcopy(self.mesh)
        mesh.refine(4)

        # check that maximum vertex index in mesh.t exists in mesh.p
        self.assertEqual(np.max(mesh.t),mesh.p.shape[1]-1)