VTK Lagrange elements in 3D elements is not rendered correctly
See original GitHub issueMWE using dolfinx:
from mpi4py import MPI
import vedo
import numpy as np
import dolfinx
import dolfinx.io
mesh = dolfinx.UnitCubeMesh(MPI.COMM_WORLD, 1, 1, 1, dolfinx.cpp.mesh.CellType.hexahedron)
geo = mesh.geometry.x
num_cells = mesh.topology.index_map(mesh.topology.dim).size_local
topo = dolfinx.cpp.mesh.entities_to_geometry(mesh, mesh.topology.dim, np.arange(num_cells, dtype=np.int32), False)
perm_vtk = dolfinx.cpp.io.perm_vtk(mesh.topology.cell_type, topo.shape[1])
dolfin_to_vtk = np.zeros(topo.shape[1], dtype=np.int32)
for i in range(topo.shape[1]):
dolfin_to_vtk[perm_vtk[i]] = i
dolfinx.io.VTKFile("mesh.pvd").write(mesh)
topo = topo[:, dolfin_to_vtk]
mesh_vedo = vedo.Mesh([geo, topo])
p = vedo.Plotter(shape=(1, 1), N=1, pos=(0, 0))
p.add(mesh_vedo)
p.show()
p.screenshot("mesh.png")
print(topo,"\n", geo)
yields:
[[1 4 6 2 0 5 7 3]]
[[1. 0. 0.]
[0. 0. 0.]
[0. 1. 0.]
[1. 1. 0.]
[0. 0. 1.]
[1. 0. 1.]
[0. 1. 1.]
[1. 1. 1.]]
and
while the correponding VTU
file contains;
<?xml version="1.0"?>
<VTKFile type="UnstructuredGrid" version="0.1" >
<UnstructuredGrid>
<Piece NumberOfPoints="8" NumberOfCells="1">
<Points>
<DataArray type="Float64" NumberOfComponents="3" format="ascii">1 0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 1 1 1 </DataArray>
</Points>
<Cells>
<DataArray type="Int32" Name="connectivity" format="ascii">1 4 6 2 0 5 7 3 </DataArray>
<DataArray type="Int32" Name="offsets" format="ascii">8 </DataArray>
<DataArray type="Int8" Name="types" format="ascii">72 </DataArray>
</Cells>
</Piece>
</UnstructuredGrid>
</VTKFile>
Which is the same as the vedo mesh has, but yields
Issue Analytics
- State:
- Created 3 years ago
- Comments:30 (14 by maintainers)
Top Results From Across the Web
VTK Lagrange elements in 3D elements is not rendered ...
There are basically two separate issues with the original question. The vedo.Mesh class is meant to only manage polygonal surface meshes so the ......
Read more >Modeling Arbitrary-order Lagrange Finite Elements in the ...
I was able to create a vtk using LagrangeQuadrilaterals for 2D and LagrangeHexahedron for 3D. However, it looks like the interpolation is not...
Read more >vtkCell Class Reference - VTK
vtkCell is an abstract class that specifies the interfaces for data cells. Data cells are simple topological elements like points, lines, polygons, and ......
Read more >Implementation of rational Bézier cells into VTK | Coreform
While Lagrange elements were already implemented into VTK, we added the possibility for some cell types to have anisotropic degree, meaning ...
Read more >Implementation — FEniCSx tutorial - GitHub Pages
The type of element here is “CG”, which implies the standard Lagrange family ... In FEniCSx, we do not specify boundary conditions as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I forgot to add the
PETSC_ARCH
, i.e.Let me know how you get along with things:) i’ve spent the day updating my dolfin-x tutorial after we removed matplotlib. When vedo is ready, Im ready to add it to some of the examples, such as: https://jorgensd.github.io/dolfinx-tutorial/chapter3/em.html or https://jorgensd.github.io/dolfinx-tutorial/chapter2/ns_code1.html Could also add a meshing demo with vedo if you have a good idea for an example application.