-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathpolygen.py
More file actions
34 lines (27 loc) · 790 Bytes
/
polygen.py
File metadata and controls
34 lines (27 loc) · 790 Bytes
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
import polysim_pb2
import sys
import os
import numpy as np
outfile = open('gen.dat',"wb")
sim = polysim_pb2.SSim()
sim.settings.sk = 100
sim.settings.pk = 100
sim.settings.stiffk = 10
sim.settings.oseenk = .1
sim.settings.shiftk = 1
sim.settings.numpin = 1
sys = sim.system.add()
for i in range(4):
for j in range(4):
poly = sys.poly.add()
current = np.array([i,j,1])
for n in range(20):
poly.x.append(current[0])
poly.y.append(current[1])
poly.z.append(current[2])
temp = np.random.rand(3) - np.array([.5,.5,0])
temp = temp/np.linalg.norm(temp)
current = current + temp
print(sim)
output = sim.SerializeToString()
outfile.write(output)