This page was generated from
docs\source\examples/trigridQ4.ipynb.
Triangulate a 2d grid#
[1]:
from sigmaepsilon.mesh.grid import gridQ4 as grid
from sigmaepsilon.mesh import PolyData, PointData, CartesianFrame
from sigmaepsilon.mesh.cells import T3 as CellData
from sigmaepsilon.mesh.utils.topology import Q4_to_T3
# create a grid of 30 x 15 cells, with 2 x 2 nodes per cell
gridparams = {
"size": (1200, 600),
"shape": (30, 15),
}
coords, topo = grid(**gridparams)
coords, topo = Q4_to_T3(coords, topo)
frame = CartesianFrame(dim=3)
pd = PointData(coords=coords, frame=frame)
cd = CellData(topo=topo, frames=frame)
mesh = PolyData(pd, cd)
mesh.plot(notebook=True, jupyter_backend="static", theme="document")