|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectskeleton.Compute
skeleton.ParCompute
public class ParCompute
This is the class used to provide user defined MDF graphs as (parts of)
skeletons.
ParCompute items can be used where Compute items are. Unlike Compute items,
requiring the user provides the Object compute(Object) method, the ParCompute
items must be created providing a MdfGraph macro data flow graph, with a
single token in input and a single token in output.
The computation of the ParCompute goes through the supplied graph rather than
compiling MDF instructions using the compute method as opcode.
Sample use is as follows:
Manager manager = new Manager();
Compute inc1 = new Splitter();
Dest d1 = new Dest(0, 2,Mdfi.NoGraphId);
Dest d2 = new Dest(0, 3,Mdfi.NoGraphId);
Dest[] dests = new Dest[2];
dests[0] = d1;
dests[1] = d2;
Mdfi i1 = new Mdfi(manager,1,inc1,1,2,dests);
Compute sq1 = new Square();
Dest d3 = new Dest(0, 4, Mdfi.NoGraphId);
Dest[] dests1 = new Dest[1];
dests1[0] = d3;
Mdfi i2 = new Mdfi(manager,2,sq1,1,1,dests1);
Compute sq2 = new Square();
Dest d4 = new Dest(1, 4, Mdfi.NoGraphId);
Dest[] dests2 = new Dest[1];
dests2[0] = d4;
Mdfi i3 = new Mdfi(manager,3,sq1,1,1,dests2);
Compute add = new Comp();
Dest d5 = new Dest(0,Mdfi.NoInstrId, Mdfi.NoGraphId);
Dest[] dests3 = new Dest[1];
dests3[0] = d5;
Mdfi i4 = new Mdfi(manager, 4, add, 1, 1, dests3);
MdfGraph graph = new MdfGraph();
graph.addInstruction(i1);
graph.addInstruction(i2);
graph.addInstruction(i3);
graph.addInstruction(i4);
ParCompute mdfg = new ParCompute(graph);
In this case a graph not expressible with the standard muskel skeletons is built. Farm f = new Farm(mdfg); manager.setProgram(f);or computed as is by telling
manager.setProgram(mdfg);just before issuing the
manager.compute() call.
| Constructor Summary | |
|---|---|
ParCompute(MdfGraph g)
ParCompute nodes are created by passing an MDF graph as the node "program" |
|
| Method Summary | |
|---|---|
java.lang.Object |
compute(java.lang.Object task)
This is the method that has to be computed in order to implement the Compute interface. |
MdfGraph |
getMdfGraph()
this is the method used to fetch the graph when compiling the class as a skeleton parameter |
| Methods inherited from class skeleton.Compute |
|---|
clone |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ParCompute(MdfGraph g)
g - the graph to be computed| Method Detail |
|---|
public java.lang.Object compute(java.lang.Object task)
compute in class Computetask - is the input task value
public MdfGraph getMdfGraph()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||