Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
dream
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
dream
Commits
9f6c2402
Commit
9f6c2402
authored
Feb 16, 2015
by
Georgios Dagkakis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup. addEdge method added to generic InputPreparationPlugin
parent
ecd02eab
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
26 deletions
+16
-26
dream/plugins/AddBatchStations.py
dream/plugins/AddBatchStations.py
+6
-26
dream/plugins/plugin.py
dream/plugins/plugin.py
+10
-0
No files found.
dream/plugins/AddBatchStations.py
View file @
9f6c2402
...
...
@@ -42,19 +42,9 @@ class AddBatchStations(plugin.InputPreparationPlugin):
# remove the edge
data
[
'graph'
][
'edge'
].
pop
(
edge_id
,
None
)
# add an edge from source to batchDecomposition
data
[
'graph'
][
'edge'
][
source
+
'_to_'
+
batchDecompositionId
]
=
{
"source"
:
source
,
"destination"
:
batchDecompositionId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
self
.
addEdge
(
data
,
source
,
batchDecompositionId
)
# add an edge from batchDecomposition machine
data
[
'graph'
][
'edge'
][
batchDecompositionId
+
'_to_'
+
node_id
]
=
{
"source"
:
batchDecompositionId
,
"destination"
:
node_id
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
self
.
addEdge
(
data
,
batchDecompositionId
,
node_id
)
#create a batchReassembly
batchReassemblyId
=
node_id
+
'_R'
data
[
'graph'
][
'node'
][
batchReassemblyId
]
=
{
...
...
@@ -76,20 +66,10 @@ class AddBatchStations(plugin.InputPreparationPlugin):
destination
=
edge
[
'destination'
]
# remove the edge
data
[
'graph'
][
'edge'
].
pop
(
edge_id
,
None
)
# add an edge from node to destination
data
[
'graph'
][
'edge'
][
node_id
+
'_to_'
+
batchReassemblyId
]
=
{
"source"
:
node_id
,
"destination"
:
batchReassemblyId
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# add an edge from batchDecomposition machine
data
[
'graph'
][
'edge'
][
batchReassemblyId
+
'_to_'
+
destination
]
=
{
"source"
:
batchReassemblyId
,
"destination"
:
destination
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
# add an edge from machine to batchReassembly
self
.
addEdge
(
data
,
node_id
,
batchReassemblyId
)
# add an edge from batchReassembly to destination
self
.
addEdge
(
data
,
batchReassemblyId
,
destination
)
# dataString=json.dumps(data['graph']['edge'], indent=5)
# print dataString
return
data
...
...
dream/plugins/plugin.py
View file @
9f6c2402
...
...
@@ -31,6 +31,16 @@ class InputPreparationPlugin(Plugin):
"""
return
data
# adds an edge with the given source and destination
def
addEdge
(
self
,
data
,
source
,
destination
,
nodeData
=
{}):
data
[
'graph'
][
'edge'
][
source
+
'_to_'
+
destination
]
=
{
"source"
:
source
,
"destination"
:
destination
,
"data"
:
{},
"_class"
:
"Dream.Edge"
}
return
data
class
OutputPreparationPlugin
(
Plugin
):
def
postprocess
(
self
,
data
):
"""Postprocess the data after simulation run.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment