Esempio n. 1
0
        def test_model_appender(self):
            """`OcTreeAppender` 2D: Data array name"""
            # Creat a tree mesh to append
            reader = OcTreeReader()
            reader.set_mesh_filename(self.meshFileName)
            reader.add_model_file_name(self.modelFileNames[0])
            reader.set_data_name('Initial Data')
            reader.Update()
            tree = reader.GetOutput()
            self.assertIsNotNone(tree)
            self.assertEqual(tree.GetNumberOfCells(), 29)
            self.assertEqual(tree.GetNumberOfPoints(), 84)

            # Now use the model appender
            f = OcTreeAppender()
            f.SetInputDataObject(tree)
            f.add_model_file_name(self.modelFileNames[1::])
            f.set_data_name('Appended Data')
            f.Update()

            output = f.GetOutput()
            # remember that 2 arrays is added by the reader
            self.assertEqual(output.GetCellData().GetNumberOfArrays(), 4)
            self.assertEqual(output.GetCellData().GetArrayName(3), os.path.basename(self.modelFileNames[1])) # use file as name
            self.assertEqual(len(f.get_time_step_values()), self.nt-1)
            return
Esempio n. 2
0
        def test_simple_octree(self):
            """`OcTreeReader`: simple octree mesh file"""
            reader = OcTreeReader()
            reader.set_mesh_filename(self.meshFileName)

            reader.Update()

            tree = reader.GetOutput()
            self.assertIsNotNone(tree)
            self.assertEqual(tree.GetNumberOfCells(), 29)
            self.assertEqual(tree.GetNumberOfPoints(), 84)