forked from gacevedobolton/myVTKPythonLibrary
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathreadAbaqusDeformationGradientsFromDAT.py
More file actions
55 lines (39 loc) · 2.13 KB
/
Copy pathreadAbaqusDeformationGradientsFromDAT.py
File metadata and controls
55 lines (39 loc) · 2.13 KB
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
#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 myVTKPythonLibrary as myVTK
########################################################################
def readAbaqusDeformationGradientsFromDAT(
data_filename,
verbose=1):
myVTK.myPrint(verbose, "*** readAbaqusDeformationGradientsFromDAT: "+data_filename+" ***")
farray_F = myVTK.createFloatArray("F", 9)
data_file = open(data_filename, 'r')
context = ""
k_cell = 0
for line in data_file:
if (context == "reading deformation gradients"):
#print line
if ("MAXIMUM" in line):
context = ""
continue
if ("OR" in line):
splitted_line = line.split()
assert (int(splitted_line[0]) == k_cell+1), "Wrong element number. Aborting."
F_list = [float(splitted_line[ 3]), float(splitted_line[ 6]), float(splitted_line[7]),
float(splitted_line[ 9]), float(splitted_line[ 4]), float(splitted_line[8]),
float(splitted_line[10]), float(splitted_line[11]), float(splitted_line[5])]
farray_F.InsertNextTuple(F_list)
k_cell += 1
if (line == " ELEMENT PT FOOT- DG11 DG22 DG33 DG12 DG13 DG23 DG21 DG31 DG32 \n"):
context = "reading deformation gradients"
data_file.close()
myVTK.myPrint(verbose-1, "n_tuples = "+str(farray_F.GetNumberOfTuples()))
return farray_F