forked from gacevedobolton/myVTKPythonLibrary
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathreadAbaqusFibersFromINP.py
53 lines (39 loc) · 1.66 KB
/
readAbaqusFibersFromINP.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#coding=utf8
########################################################################
### ###
### Created by Martin Genet, 2012-2016 ###
### ###
### University of California at San Francisco (UCSF), USA ###
### Swiss Federal Institute of Technology (ETH), Zurich, Switzerland ###
### École Polytechnique, Palaiseau, France ###
### ###
########################################################################
import numpy
import myVTKPythonLibrary as myVTK
########################################################################
def readAbaqusFibersFromINP(
filename,
verbose=1):
myVTK.myPrint(verbose, "*** readAbaqusFibersFromINP: "+filename+" ***")
eF_array = myVTK.createFloatArray('eF', 3)
eS_array = myVTK.createFloatArray('eS', 3)
eN_array = myVTK.createFloatArray('eN', 3)
file = open(filename, 'r')
file.readline()
for line in file:
line = line.split(', ')
#print line
eF = [float(item) for item in line[1:4]]
eS = [float(item) for item in line[4:7]]
eN = numpy.cross(eF,eS)
#print "eF =", eF
#print "eS =", eS
#print "eN =", eN
eF_array.InsertNextTuple(eF)
eS_array.InsertNextTuple(eS)
eN_array.InsertNextTuple(eN)
file.close()
myVTK.myPrint(verbose-1, "n_tuples = "+str(eF_array.GetNumberOfTuples()))
return (eF_array,
eS_array,
eN_array)