* external ports are not correct.
*/
protected Schedule _getSchedule() throws NotSchedulableException,
IllegalActionException {
PSDFDirector director = (PSDFDirector) getContainer();
CompositeActor model = (CompositeActor) director.getContainer();
// Get the vectorization factor.
String vectorizationFactorExpression = "1";
String vectorizationName = director.vectorizationFactor.getName(model);
vectorizationFactorExpression = vectorizationName.replaceAll("\\.",
"::");
if (vectorizationFactorExpression.indexOf(" ") != -1) {
throw new InternalErrorException("The vectorizationFactor "
+ "PSDFDirector parameter must "
+ "not have spaces in its value. The original value "
+ "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());
SymbolicScheduleElement resultSchedule = _expandAPGAN(graph, strategy
.getClusterManager().getRootNode(), strategy);
resultSchedule.setIterationCount(vectorizationFactorExpression);
_debug("Final schedule = \n" + resultSchedule.toString());
if (_debugging) {
_debug("The buffer size map:\n");
Iterator relations = _bufferSizeMap.keySet().iterator();
while (relations.hasNext()) {
Relation relation = (Relation) relations.next();
_debug(relation.getName() + ": " + _bufferSizeMap.get(relation)
+ "\n");
}
}
_saveBufferSizes(_bufferSizeMap);
// Crazy hack to infer firing counts for each actor.
try {
_inferFiringCounts(resultSchedule, null);
} catch (NameDuplicationException ex) {
throw new NotSchedulableException(null, ex,
"Error recording firing counts");
}
// Crazy hack to Infer port production: FIXME: This should be
// done as part of the APGAN expansion where the rates of
// external ports are unknown The reason is that it will make
// rate information propagate from an actor input port to
// another actors input port that are connected on the inside
// to the same external input port. See
// BaseSDFScheduler.setContainerRates.
Iterator ports = model.portList().iterator();
while (ports.hasNext()) {
IOPort port = (IOPort) ports.next();
if (_debugging && VERBOSE) {