@@ -83,14 +83,17 @@ def test_polyData_VTKHDF(np_rng,tmp_path):
8383 vtkhdf = VTK .load (tmp_path / 'polyData.vtkhdf' )
8484 assert (v .as_ASCII () == vtkhdf .as_ASCII ())
8585
86- @pytest .mark .parametrize ('cell_type,n' ,[
87- ('VTK_hexahedron' ,8 ),
88- ('TETRA' ,4 ),
89- ('quad' ,4 ),
90- ('VTK_TRIANGLE' ,3 )
91- ]
86+ # https://defelement.org/elements/lagrange.html
87+ @pytest .mark .parametrize ('cell_type,n_nodes' ,[
88+ ('VTK_hexahedron' ,lambda k : (k + 1 )** 3 ),
89+ ('TETRA' ,lambda k : ((k + 1 )* (k + 2 )* (k + 3 ))// 6 ),
90+ ('quad' ,lambda k : (k + 1 )** 2 ),
91+ ('VTK_TRIANGLE' ,lambda k : ((k + 1 )* (k + 2 ))// 2 ),
92+ ]
9293 )
93- def test_unstructuredGrid (np_rng ,tmp_path ,cell_type ,n ):
94+ @pytest .mark .parametrize ('order' ,[1 ,2 ,3 ,4 ,5 ])
95+ def test_unstructuredGrid (np_rng ,tmp_path ,cell_type ,n_nodes ,order ):
96+ n = n_nodes (order )
9497 nodes = np_rng .random ((n ,3 ))
9598 connectivity = np_rng .choice (np .arange (n ),n ,False ).reshape (- 1 ,n )
9699 v = VTK .from_unstructured_grid (nodes ,connectivity ,cell_type )
@@ -104,15 +107,17 @@ def test_unstructuredGrid(np_rng,tmp_path,cell_type,n):
104107 assert (string == vtu .as_ASCII () == vtk .as_ASCII ())
105108
106109@pytest .mark .xfail (np .lib .NumpyVersion (vtkVersion .GetVTKVersion ()) < '9.4.0' ,
107- reason = 'not available in VTK < 9.4' )
108- @pytest .mark .parametrize ('cell_type,n ' ,[
109- ( 'VTK_hexahedron' , 8 ),
110- ( 'TETRA' , 4 ),
111- ( 'quad' , 4 ),
112- ( 'VTK_TRIANGLE' , 3 )
113- ]
110+ reason = 'not available in VTK < 9.4' )
111+ @pytest .mark .parametrize ('cell_type,n_nodes ' ,[
112+ ( 'VTK_lagrange_hexa' , lambda k : ( k + 1 ) ** 3 ),
113+ ( 'VTK_LAGRANGE_TETRAHEDRON' , lambda k : (( k + 1 ) * ( k + 2 ) * ( k + 3 )) // 6 ),
114+ ( 'quadrilateral' , lambda k : ( k + 1 ) ** 2 ),
115+ ( 'TRIANGLE' , lambda k : (( k + 1 ) * ( k + 2 )) // 2 ),
116+ ]
114117 )
115- def test_unstructuredGrid_VTKHDF (np_rng ,tmp_path ,cell_type ,n ):
118+ @pytest .mark .parametrize ('order' ,[1 ,2 ,3 ,4 ,5 ])
119+ def test_unstructuredGrid_VTKHDF (np_rng ,tmp_path ,cell_type ,n_nodes ,order ):
120+ n = n_nodes (order )
116121 nodes = np_rng .random ((n ,3 ))
117122 connectivity = np_rng .choice (np .arange (n ),n ,False ).reshape (- 1 ,n )
118123 v = VTK .from_unstructured_grid (nodes ,connectivity ,cell_type )
0 commit comments