Commit 85cdebbf authored by Jérome Perrin's avatar Jérome Perrin

keep a reference to outbound edges on core objects

parent c3165bf9
...@@ -53,7 +53,11 @@ class CoreObject(Process): ...@@ -53,7 +53,11 @@ class CoreObject(Process):
self.resetOnPreemption=False self.resetOnPreemption=False
self.interruptCause=None self.interruptCause=None
self.gatherWipStat=False self.gatherWipStat=False
# destination id -> (edge_id, edge_data)
# will be populated later (in setTopology)
self.edges_by_destination = {}
def initialize(self): def initialize(self):
# XXX why call super.__init__ outside of __init__ ? # XXX why call super.__init__ outside of __init__ ?
Process.__init__(self) Process.__init__(self)
......
...@@ -812,7 +812,7 @@ def createObjects(): ...@@ -812,7 +812,7 @@ def createObjects():
# =========================================================================== # ===========================================================================
# defines the topology (predecessors and successors for all the objects) # defines the topology (predecessors and successors for all the objects)
# =========================================================================== # ===========================================================================
def setTopology(): def setTopology(model):
#loop through all the objects #loop through all the objects
for element in G.ObjList: for element in G.ObjList:
next=[] next=[]
...@@ -825,8 +825,14 @@ def setTopology(): ...@@ -825,8 +825,14 @@ def setTopology():
for j in range(len(element.nextIds)): for j in range(len(element.nextIds)):
for q in range(len(G.ObjList)): for q in range(len(G.ObjList)):
if G.ObjList[q].id==element.nextIds[j]: if G.ObjList[q].id==element.nextIds[j]:
next.append(G.ObjList[q]) next.append(G.ObjList[q])
# XXX we need a class for topology ...
for edge_id, (source_id, destination_id, edge_data) in model['edges'].items():
if element.id == source_id:
element.edges_by_destination.setdefault(destination_id, []
).append((edge_id, edge_data))
if element.type=="Source": if element.type=="Source":
element.defineRouting(next) element.defineRouting(next)
elif element.type=="Exit": elif element.type=="Exit":
...@@ -1247,8 +1253,8 @@ def main(argv=[], input_data=None): ...@@ -1247,8 +1253,8 @@ def main(argv=[], input_data=None):
readGeneralInput() readGeneralInput()
createObjects() createObjects()
createObjectInterruptions() createObjectInterruptions()
setTopology() setTopology(G.JSONData)
#run the experiment (replications) #run the experiment (replications)
for i in xrange(G.numberOfReplications): for i in xrange(G.numberOfReplications):
#logger.info("start run number "+str(i+1)) #logger.info("start run number "+str(i+1))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment