Domaincan use the various classes mentioned above as they exist in the Ptolemy kernel or it can redefine them as needed. For example, in the SDF domain, the classes
SDFWormholehave all been defined. Most of those classes inherit much of their functionality from the corresponding kernel classes but the
Domaincreator is free to make major changes as well. The kernel
Particleclasses are used without modification, but other domains such as the CG domain have derived a subclass from
Domaincreator needs to decide whether or not existing Ptolemy classes can be used without change, therefore it is a good idea to understand what functionality the kernel classes provide.
The following is a brief description of the various classes that either need to be defined or are used by a
Domain. Note that we only provide a functional description of some of the major methods of each class and not a complete description of all methods.
Targetis an object that manages the execution of the
run()Called to execute a schedule.
wrapup()Called at the end of an execution to clean up.
initialize()(which is inherited from the
Blockclass, which is a common base class for many of Ptolemy's classes). Sets each
Starto point to this
Targetand sets up the
galA pointer to the
schedA pointer to the Scheduler that is being used.
Targets, see some of the existing domains.
Domain, like which type of
Star, etc. is used by the
WormHoleof the appropriate type for this
EventHorizon(an object that is used to interface to other
Domains, used with
WormHoles) that translates data from a Universal format to a
EventHorizonthat translates data from a
Domainspecific format to a Universal one.
Geodesicof the appropriate type for this
Staris an object derived from class
Blockthat implements an atomic function.
run()What to do to run the star.
DataFlowStarclass (a parent class to many of the dataflow domain stars such as
DDFStar) defines this function to make each input
Geodesic, execute the
go()method of each
Star, and then have each output
PortHoles are data members of
Stars and are where streams of
Particles enter or leave the
Particles of one type, so two connected
PortHoles need to decide which data type they will use if they are not the same. There is a base class called
GenericPortwhich provides some basic methods that derived classes should redefine as well as some data members commonly needed by all
PortHoleclass is an input type.
PortHoleclass is an output type.
PortHoleclass is a
Geodesic(create one if needed) and tell that
Geodesicto connect itself to both this
PortHoleand the destination
PortHole. Also provides the number of delays on this connection.
PortHole. In the case of output
PortHoles, this function will usually initialize the connected
Geodesicas well. Resolve the type of
Particles with the
PortHoleit is connected to.
receiveData()What to do to receive data from the
sendData()What to do to send data to the
putParticle()Put a particle from the buffer into the
getParticle()Get a particle from the
Geodesicand put it into the buffer.
numberTokens, the number of
Particles transferred per execution.
numTokens()Returns the number of
Particles inside the
numInitDelays()Returns the number of initial delay on the
geo()Returns a pointer to the
PortHoleis connected to.
setDelay()Set the delay on the
myTypeData type of particles in this porthole.
PortHoleis connected to
myPlasmaA pointer to the
Plasmaused to request new
CircularBufferused to store incoming or outgoing
PortHolethat we are connected to.
bufferSizeThe size of the
numberTokensThe number of
Particles consumed or generated each time we access the
PortHoles are generally separated into input
PortHoles and output
PortHoles. They aren't designed to handle bidirectional traffic.
PortHoles. Major methods:
setSourcePort()Set the source
PortHoleand the delay on this connection. A delay is usually implemented as an initial
Geodesic's buffer, but this can be changed depending on the desired functionality.
setDestPort()Set the destination
disconnect()Disconnect from the given
setDelay()Set the number of delays on this connection.
initialize()Initialize the buffer in this
Geodesic. This means either clear it or insert the number of initial
Particles needed to match the number of delays on this connection (these
Particles are taken from the source
Particleinto the buffer
Particlefrom the buffer.
decCount()are used by a
Schedulerto simulate an execution.
numInit() Return the number of initial particles.
originatingPortA pointer to the source
destinationPortA pointer to the destination
pstackThe buffer, implemented as a
szThe number of
Particles in the buffer.
Particles. There is one global instance of a Plasma for each type of
Particledefined in the kernel. This class is usually only used by the
Domains and not changed by the authors of new
put()Return an unused
get()Get an unused
Particle(or create one if needed).
Particletypes supported by Ptolemy. Currently, the types are
Particleis used to carry
Envelopes) which can be almost anything. For example, the
Matrixclass is transferred using
Particles. These classes are also only used as-is by the
Domains and not redefined for new domains.
Galaxywill fire. Execution is performed using two main methods --
Schedulerscan be timed or untimed, depending on the
Domain's model of execution. This class will usually be different for each domain, although some domains reuse the
Schedulerof another domain, if the
Scheduleris appropriate for the new domain's model of computation.
Stars in the
Galaxy, initializes them, and creates a schedule.
run()Run the schedule computed in setup()
myGalaxyThe pointer to the
Galaxythat the Scheduler is working on.
myTargetThe pointer to the
Targetwhich is controlling the execution.