def test_unequal_node_count(self): matrix = np.array([[0, 1, 2, 999], [2, 1, 3, 4]]) (face_nodes, offset) = utils.connectivity_matrix_as_array(matrix, 999) self.assertArrayEqual(face_nodes, np.array([0, 1, 2, 2, 1, 3, 4])) self.assertArrayEqual(offset, np.array([3, 7])) matrix = np.array([[0, 1, 2, -999], [2, 1, -999, -999]]) (face_nodes, offset) = utils.connectivity_matrix_as_array(matrix, -999) self.assertArrayEqual(face_nodes, np.array([0, 1, 2, 2, 1])) self.assertArrayEqual(offset, np.array([3, 5]))
def test_empty_face(self): matrix = np.array([[0, 1], [999, 0]]) with self.assertRaises(ValueError): utils.connectivity_matrix_as_array(matrix, 999)
def test_one_face(self): matrix = np.array([[0, 1, 2, 3]]) (face_nodes, offset) = utils.connectivity_matrix_as_array(matrix, 999) self.assertArrayEqual(face_nodes, np.array([0, 1, 2, 3])) self.assertArrayEqual(offset, np.array([4]))
def test_equal_node_count(self): matrix = np.array([[0, 1, 2, 3], [2, 1, 3, 4]]) (face_nodes, offset) = utils.connectivity_matrix_as_array(matrix, 999) self.assertArrayEqual(face_nodes, np.array([0, 1, 2, 3, 2, 1, 3, 4])) self.assertArrayEqual(offset, np.array([4, 8]))