Exemple #1
0
    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]))
Exemple #2
0
    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]))
Exemple #3
0
 def test_empty_face(self):
     matrix = np.array([[0, 1], [999, 0]])
     with self.assertRaises(ValueError):
         utils.connectivity_matrix_as_array(matrix, 999)
Exemple #4
0
 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]))
Exemple #5
0
 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]))
Exemple #6
0
 def test_empty_face(self):
     matrix = np.array([[0, 1], [999, 0]])
     with self.assertRaises(ValueError):
         utils.connectivity_matrix_as_array(matrix, 999)
Exemple #7
0
 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]))
Exemple #8
0
 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]))