Mechanics of Defect Evolution Library
Loading...
Searching...
No Matches
readNodes.py
Go to the documentation of this file.
1import sys, string, os
2import numpy as np
3# evl file
4
5class NODES:
6 nodesPos=np.empty([0,0])
7 nodesV=np.empty([0,0])
8 nodesVOld=np.empty([0,0])
9 nodesClimbVScalar=np.empty([0,0])
10 loopsArea=np.empty([0])
11
12def readNODEStxt(filename):
13
14 evlFile = open(filename+'.txt', "r")
15 numNodes=int(evlFile.readline().rstrip())
16 numLoops=int(evlFile.readline().rstrip())
17 numLinks=int(evlFile.readline().rstrip())
18
19 nd=NODES();
20
21 nd.nodesPos=np.empty([numNodes, 3])
22 nd.nodesV=np.empty([numNodes, 3])
23 nd.nodesVOld=np.empty([numNodes, 3])
24 nd.nodesClimbVScalar=np.empty([numNodes, 2])
25 nd.loopsArea=np.empty([numLoops, 1])
26
27 for k in np.arange(numNodes):
28 data=np.fromstring(evlFile.readline().rstrip(), sep=' ')
29 nd.nodesPos[k,:]=data[1:4]
30 nd.nodesV[k,:]=data[4:7]
31 nd.nodesVOld[k,:]=data[7:10]
32 nd.nodesClimbVScalar[k,:]=data[11:13]
33
34 for k in np.arange(numLoops):
35 data=np.fromstring(evlFile.readline().rstrip(), sep=' ')
36 nd.loopsArea[k]=data[-1]
37# nd.burgers[k,0:3]=data[1:4]
38# nd.normal[k,0:3]=data[4:7]
39 return nd
readNODEStxt(filename)
Definition readNodes.py:12