File: TestCellGrid.py

package info (click to toggle)
vtk9 9.5.2%2Bdfsg3-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 205,984 kB
  • sloc: cpp: 2,336,570; ansic: 327,116; python: 111,200; yacc: 4,104; java: 3,977; sh: 3,032; xml: 2,771; perl: 2,189; lex: 1,787; makefile: 181; javascript: 165; objc: 153; tcl: 59
file content (38 lines) | stat: -rw-r--r-- 1,276 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
from vtkmodules import vtkCommonCore as cc
from vtkmodules import vtkCommonDataModel as dm
from vtkmodules import vtkCommonExecutionModel as em
from vtkmodules import vtkImagingCore as ic
from vtkmodules import vtkIOCellGrid as io
from vtkmodules.util.vtkAlgorithm import VTKPythonAlgorithmBase

from vtkmodules.test import Testing
import os

class TestCellGrid(Testing.vtkTest):

    def test(self):
        print('foo')

    def testConstruction(self):
        g = dm.vtkCellGrid()
        self.assertEqual(g.GetNumberOfCells(), 0)
        self.assertEqual(g.GetShapeAttribute(), None)
        bds = [0, 0, 0, 0, 0, 0]
        g.GetBounds(bds)
        self.assertEqual(bds, [1., -1., 1., -1., 1., -1.])

    def testReader(self):
        r = io.vtkCellGridReader()
        r.SetFileName(os.path.join(Testing.VTK_DATA_ROOT, 'Data', 'dgHexahedra.dg'))
        r.Update()
        g = r.GetOutput()
        self.assertEqual(g.GetNumberOfCells(), 2)
        s = g.GetShapeAttribute()
        self.assertEqual(s.GetNumberOfComponents(), 3)
        bds = [0, 0, 0, 0, 0, 0]
        g.GetBounds(bds)
        self.assertEqual(bds, [0.0, 2.0, 0.0, 1.25, 0.0, 1.0])
        # TODO: Fetch cell types, cell metadata

if __name__ == "__main__":
    Testing.main([(TestCellGrid, 'test')])