MCPcopy Create free account
hub / github.com/NGSolve/ngsolve / SegMesh

Function SegMesh

python/TensorProductTools.py:18–30  ·  view source on GitHub ↗
(n,x0,x1,periodic=False)

Source from the content-addressed store, hash-verified

16 mesh.Add (Element1D(elpids,index=1))
17
18def SegMesh(n,x0,x1,periodic=False):
19 mesh = Mesh(dim=1)
20 pids = []
21 for i in range(n+1):
22 pids.append (mesh.Add (MeshPoint(Pnt(x0+(x1-x0)*i/n, 0, 0))))
23 AddEdgeEls(0,1,1,n,pids,mesh)
24 mesh.Add (Element0D( pids[0], index=1))
25 mesh.Add (Element0D( pids[n], index=2))
26 mesh.SetBCName(0,"left")
27 mesh.SetBCName(1,"right")
28 if periodic == True:
29 mesh.AddPointIdentification(pids[0],pids[n],1,2)
30 return mesh
31
32# create a hexagonal mesh with corner points on the unit circle
33def MakeHexagonalMesh2D(maxh=0.1):

Callers 3

tp_dg_1d_1d.pyFile · 0.85
tp_dg_2d_1d.pyFile · 0.85
tp_dg_1d_2d.pyFile · 0.85

Calls 3

MeshPointClass · 0.85
AddEdgeElsFunction · 0.85
AddMethod · 0.80

Tested by

no test coverage detected