Examples of PSDFNodeWeight


Examples of mapss.dif.psdf.PSDFNodeWeight

                .getSubgraph(node);

        try {
            // Atomic node
            if (childGraph == null) {
                PSDFNodeWeight weight = (PSDFNodeWeight) node.getWeight();
                SymbolicFiring firing = new SymbolicFiring((Actor) weight
                        .getComputation(), "1");
                return firing;

                // Super node
            } else {
                // FIXME: why call new Schedule here?
                /*Schedule schedule = */new Schedule();

                // Expand the super node with adjacent nodes contained
                // within it.
                Edge edge = (Edge) childGraph.edges().iterator().next();
                ptolemy.graph.Node source = edge.source();
                ptolemy.graph.Node sink = edge.sink();
                SymbolicScheduleElement first = _expandAPGAN(childGraph,
                        source, strategy);
                SymbolicScheduleElement second = _expandAPGAN(childGraph, sink,
                        strategy);

                // Determine the iteration counts of the source and
                // sink clusters.
                String producedExpression = strategy.producedExpression(edge);
                String consumedExpression = strategy.consumedExpression(edge);

                // These errors should not occur.
                if (producedExpression == null) {
                    throw new RuntimeException("Internal error: null "
                            + "production rate expression. The offending edge "
                            + "follows.\n" + edge);
                } else if (consumedExpression == null) {
                    throw new RuntimeException(
                            "Internal error: null "
                                    + "consumption rate expression. The offending edge "
                                    + "follows.\n" + edge);
                }

                String denominator = PSDFGraphs.gcdExpression(
                        producedExpression, consumedExpression);
                String firstIterations = "(" + consumedExpression + ") / ("
                        + denominator + ")";
                String secondIterations = "(" + producedExpression + ") / ("
                        + denominator + ")";

                first.setIterationCount(firstIterations);
                second.setIterationCount(secondIterations);

                SymbolicSchedule symbolicSchedule = new SymbolicSchedule("1");
                symbolicSchedule.add((ScheduleElement) first);
                symbolicSchedule.add((ScheduleElement) second);

                // Compute buffer sizes and associate them with the
                // corresponding relations.
                Iterator edges = childGraph.edges().iterator();

                while (edges.hasNext()) {
                    Edge nextEdge = (Edge) edges.next();
                    PSDFEdgeWeight weight = (PSDFEdgeWeight) nextEdge
                            .getWeight();
                    IOPort sourcePort = weight.getSourcePort();
                    List relationList = sourcePort.linkedRelationList();

                    if (relationList.size() != 1) {
                        // FIXME: Need to generalize this?
                        throw new RuntimeException("Cannot handle relation "
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.