Package mapss.dif.psdf

Examples of mapss.dif.psdf.PSDFGraph


                    + "was \"" + vectorizationName
                    + "\". Try changing the name of " + "director.");
        }

        PSDFGraphReader graphReader = new PSDFGraphReader();
        PSDFGraph graph = (PSDFGraph) graphReader.convert(model);
        _debug("PSDF graph = \n" + graph.toString());

        if (_debugFlag) {
            graph.printEdgeRateExpressions();
        }

        PSDFAPGANStrategy strategy = new PSDFAPGANStrategy(graph);
        ptolemy.graph.sched.Schedule graphSchedule = strategy.schedule();
        _debug("P-APGAN schedule = \n" + graphSchedule.toString());
View Full Code Here


    // @param node The super node to expand.
    // @param apgan The scheduler that was used to build the cluster hierarchy.
    // @return The schedule saving the expansion result.
    private SymbolicScheduleElement _expandAPGAN(PSDFGraph graph,
            ptolemy.graph.Node node, PSDFAPGANStrategy strategy) {
        PSDFGraph childGraph = (PSDFGraph) strategy.getClusterManager()
                .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();
View Full Code Here

TOP

Related Classes of mapss.dif.psdf.PSDFGraph

Copyright © 2018 www.massapicom. 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.