@@ -64,6 +64,35 @@ def test_clipping_vectors_direct(self, webgpu_env):
6464
6565 webgpu_env .assert_matches_baseline (scene , "clipping_vectors_direct.png" )
6666
67+ def test_clipping_vectors_mixed_elements (self , webgpu_env ):
68+ import ngsolve as ngs
69+ import webgpu .jupyter as wj
70+ from netgen .occ import Box , Pnt , OCCGeometry
71+ from netgen .meshing import BoundaryLayerParameters
72+ from ngsolve_webgpu .mesh import MeshData
73+ from ngsolve_webgpu .cf import FunctionData
74+ from ngsolve_webgpu .vectors import ClippingVectors
75+ from webgpu .clipping import Clipping
76+
77+ webgpu_env .ensure_canvas (600 , 600 )
78+ box = Box (Pnt (0 , 0 , 0 ), Pnt (1 , 1 , 1 ))
79+ geo = OCCGeometry (box )
80+ blayer = [
81+ BoundaryLayerParameters (boundary = ".*" , thickness = [0.05 ], domain = ".*" , outside = False )]
82+ ngmesh = geo .GenerateMesh (maxh = 0.3 , boundary_layers = blayer )
83+ mesh = ngs .Mesh (ngmesh )
84+ assert sum (1 for el in mesh .Elements () if el .type == ngs .ET .PRISM ) > 0 , "Mesh should contain prism elements"
85+ mesh_data = MeshData (mesh )
86+ cf = ngs .CF ((ngs .x , ngs .y , ngs .z ))
87+ function_data = FunctionData (mesh_data , cf , order = 2 )
88+ clipping = Clipping ()
89+ clipping .mode = clipping .Mode .PLANE
90+ clipping .center = [0.5 , 0.5 , 0.5 ]
91+ renderer = ClippingVectors (function_data , grid_size = 200 , clipping = clipping )
92+ scene = wj .Draw ([renderer ], 600 , 600 )
93+
94+ webgpu_env .assert_matches_baseline (scene , "clipping_vectors_mixed_elements.png" )
95+
6796 def test_fieldlines (self , webgpu_env ):
6897 import ngsolve as ngs
6998 import webgpu .jupyter as wj
0 commit comments