def test_gmshTags(self): dom = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH, "tagtest.msh"), 2) tags = dom.showTagNames().split(', ') self.assertEqual(tags, ['tag1', 'tag2', 'tag3'], 'error with tags') self.assertEqual(dom.getTag('tag1'), 1, 'error with tag1') self.assertEqual(dom.getTag('tag2'), 2, 'error with tag2') self.assertEqual(dom.getTag('tag3'), 3, 'error with tag3') self.assertRaises(ValueError, dom.getTag, 'tag4')
def test_readgmsh_format(self): print("\n reading format 2..... ") mydomain1 = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH, "Kalgoorlie.2.msh"), numDim=3) print(" reading format 2.2..... ") mydomain2 = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH, "Kalgoorlie.22.msh"), numDim=3) print(" reading format 4.0..... ") mydomain3 = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH, "Kalgoorlie.40.msh"), numDim=3) print(" reading format 4.1..... ") mydomain4 = ReadGmsh(os.path.join(DUDLEY_TEST_MESH_PATH, "Kalgoorlie.41.msh"), numDim=3) print(" comparing ..... ") self.assertTrue(self.domainsEqual(mydomain1, mydomain2), "Failed to read MSH format 2 or 22") self.assertTrue(self.domainsEqual(mydomain1, mydomain3), "Failed to read MSH format 4.0") self.assertTrue(self.domainsEqual(mydomain1, mydomain4), "Failed to read MSH format 4.1")