예제 #1
0
파일: test_MeshIO.py 프로젝트: KyuboNoh/HY
 def setUp(self):
     h = np.ones(16)
     mesh = TreeMesh([h,2*h,3*h])
     mesh.refine(3)
     mesh._refineCell([0,0,0,3])
     mesh._refineCell([0,2,0,3])
     self.mesh = mesh
예제 #2
0
 def setUp(self):
     h = np.ones(16)
     mesh = TreeMesh([h, 2 * h, 3 * h])
     mesh.refine(3)
     mesh._refineCell([0, 0, 0, 3])
     mesh._refineCell([0, 2, 0, 3])
     self.mesh = mesh
예제 #3
0
    def test_UBCfiles(self):

        mesh = self.mesh
        # Make a vector
        vec = np.arange(mesh.nC)
        # Write and read
        mesh.writeUBC('temp.msh', {'arange.txt': vec})
        meshUBC = TreeMesh.readUBC('temp.msh')
        vecUBC = meshUBC.readModelUBC('arange.txt')

        # The mesh
        assert mesh.__str__() == meshUBC.__str__()
        assert np.sum(mesh.gridCC - meshUBC.gridCC) == 0
        assert np.sum(vec - vecUBC) == 0
        assert np.all(np.array(mesh.h) - np.array(meshUBC.h) == 0)
        print 'IO of UBC octree files is working'
        os.remove('temp.msh')
        os.remove('arange.txt')
예제 #4
0
파일: test_MeshIO.py 프로젝트: KyuboNoh/HY
    def test_UBCfiles(self):

        mesh = self.mesh
        # Make a vector
        vec = np.arange(mesh.nC)
        # Write and read
        mesh.writeUBC('temp.msh', {'arange.txt':vec})
        meshUBC = TreeMesh.readUBC('temp.msh')
        vecUBC  = meshUBC.readModelUBC('arange.txt')

        # The mesh
        assert mesh.__str__() == meshUBC.__str__()
        assert np.sum(mesh.gridCC - meshUBC.gridCC) == 0
        assert np.sum(vec - vecUBC) == 0
        assert np.all(np.array(mesh.h) - np.array(meshUBC.h) == 0)
        print 'IO of UBC octree files is working'
        os.remove('temp.msh')
        os.remove('arange.txt')