nodes in 3D cell

This commit is contained in:
rowanc1
2014-02-11 13:35:05 -08:00
parent 38fbc0cfac
commit 87a8890133
2 changed files with 16 additions and 0 deletions
+1
View File
@@ -440,6 +440,7 @@ class TreeCell(TreeObject):
self.faces = {"fXm":fXm, "fXp":fXp, "fYm":fYm, "fYp":fYp, "fZm":fZm, "fZp":fZp}
self.edges = {"eX0":eX0, "eX1":eX1, "eX2":eX2, "eX3":eX3, "eY0":eY0, "eY1":eY1, "eY2":eY2, "eY3":eY3, "eZ0":eZ0, "eZ1":eZ1, "eZ2":eZ2, "eZ3":eZ3}
self.nodes = {"n0": fZm.nodes['n0'], "n1": fZm.nodes['n1'], "n2": fZm.nodes['n2'], "n3": fZm.nodes['n3'], "n4": fZp.nodes['n0'], "n5": fZp.nodes['n1'], "n6": fZp.nodes['n2'], "n7": fZp.nodes['n3']}
mesh.cells.add(self)
+15
View File
@@ -25,6 +25,7 @@ class TestOcTreeObjects(unittest.TestCase):
if s[2] == 'f' and len(s) == 5: return c.faces[s[2:]]
if s[2] == 'f': return c.faces[s[2:5]].edges[s[5:]]
if s[2] == 'e': return c.edges[s[2:]]
if s[2] == 'n': return c.nodes[s[2:]]
self.q = q
@@ -135,6 +136,20 @@ class TestOcTreeObjects(unittest.TestCase):
self.assertTrue(c1fYp.edges['e2'] is c0fXp.edges['e3'])
def test_nodePointers(self):
q = self.q
c0 = self.Mr.sortedCells[0]
c0n0 = c0.nodes['n0']
self.assertTrue(c0n0 is q('c0n0'))
self.assertTrue(np.all(q('c0n0').center == np.r_[0,0,0.]))
self.assertTrue(q('c0n0').num == 0)
self.assertTrue(q('c0n1').num == 1)
self.assertTrue(q('c0n2').num == 4)
self.assertTrue(q('c0n3').num == 5)
self.assertTrue(q('c0n4').num == 11)
self.assertTrue(q('c0n5').num == 12)
self.assertTrue(q('c0n6').num == 14)
self.assertTrue(q('c0n7').num == 15)
def test_pointersMr(self):
q = self.q