-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest2.py
35 lines (31 loc) · 852 Bytes
/
test2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/usr/bin/env python
from dolfin import *
import numpy as np
print "Initialize an empty mesh"
mesh=Mesh()
print "Instantiate a MeshEditor with topo-dim=2 and geom-dim=3 (for timeline)"
editor=MeshEditor()
editor.open(mesh,2,3)
print "Initialize 3 vertices and 2 cells"
editor.init_vertices(3)
editor.init_cells(1)
print "Add 3 vertices"
editor.add_vertex(0,0,0,0)
editor.add_vertex(1,0,1,0)
editor.add_vertex(2,1,1,1)
print "Add 1 cell"
editor.add_cell(0,0,1,2)
print "Close the editor"
editor.close()
print "Write the mesh"
f=File('outmesh_2.xml')
f << mesh
f=None
# print "Make a MeshFunction (timedata)"
# times=MeshFunction("int",mesh,0)
# print "Assign temporal data to time vertices"
# times.array()[:]=np.array([1251325,1251379,1251421],dtype='int')
# print "Write the temporal function (data)"
# f=File('tdata_2.xml')
# f << times
# f=None