Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from KyPy/master
Browse files Browse the repository at this point in the history
Faster Reading of calculix input file
  • Loading branch information
spacether committed Jun 10, 2015
2 parents 3c81f1b + 984801d commit ac5ee3c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pycalculix/feamodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1407,6 +1407,8 @@ def __read_inp(self, fname):
F = [] # store faces
sets = {'E':{}, 'N':{}} # store sets
etype = ''
Dict_NodeIDs={}
Dict_ElemIDs={}

# read in input file
for line in f:
Expand All @@ -1417,6 +1419,7 @@ def __read_inp(self, fname):
(nnum, x, y, z) = (int(L[0]), float(L[1]), float(L[2]), float(L[3]))
node = mesh.Node(nnum, x, y, z)
N.append(node)
Dict_NodeIDs[nnum]=node
elif mode == 'emake':
L = line.split(',')
L = [int(a.strip()) for a in L]
Expand All @@ -1425,6 +1428,7 @@ def __read_inp(self, fname):
e = mesh.Element(enum, etype, nlist)
faces = e.faces
E.append(e)
Dict_ElemIDs[enum]=e
F += faces
sets[set_type][set_name].append(e)
elif mode == 'set':
Expand All @@ -1433,9 +1437,9 @@ def __read_inp(self, fname):
L = [int(a) for a in L if a != '']
items = []
if set_type == 'E':
items = [E.idget(a) for a in L]
items = [Dict_ElemIDs[a] for a in L if a in Dict_ElemIDs.keys()]
elif set_type == 'N':
items = [N.idget(a) for a in L]
items = [Dict_NodeIDs[a] for a in L]
if items == [None]*len(items):
pass # the elements were not found
else:
Expand Down

0 comments on commit ac5ee3c

Please sign in to comment.