itkwidgets
itkwidgets copied to clipboard
Support for high-order Lagrange elements
Hello,
Hope it is the right place to ask. I am trying to visualize ugrids with high-order elements, e.g.,
order = 2
n_points = (order + 1) * (order + 2) // 2
cell = vtk.vtkLagrangeTriangle()
cell.GetPointIds().SetNumberOfIds(n_points)
cell.GetPoints().SetNumberOfPoints(n_points)
cell.Initialize()
point = [0., 0., 0.]
barycentric_index = [0, 0, 0]
for k_point in range(n_points):
cell.GetPointIds().SetId(k_point, k_point)
cell.ToBarycentricIndex(k_point, barycentric_index)
for k_dim in range(2):
point[k_dim] = (barycentric_index[k_dim] / order)**2
cell.GetPoints().SetPoint(k_point, point[0], point[1], point[2])
cell_array = vtk.vtkCellArray()
cell_array.InsertNextCell(cell)
ugrid = vtk.vtkUnstructuredGrid()
ugrid.SetPoints(cell.GetPoints())
ugrid.SetCells(cell.GetCellType(), cell_array)
itkwidgets.view(geometries=[ugrid])
(inspired from https://blog.kitware.com/modeling-arbitrary-order-lagrange-finite-elements-in-the-visualization-toolkit), to no avail. Is there any support for high-order elements? If not, is it planned? Thanks!
Martin
Hello Martin,
This depends on vtk Python package support for these features, which @tjcorona is working on.
Be well, Matt
Awesome. Thanks!
This seems to be supported by other packages using VTK, such as pyvista, (ref minimal example in https://github.com/pyvista/pyvista/issues/947). Is there anything in particular missing in itkwidgets for this?
Any update on this? Thanks a lot!