Star
s will exchange data and what kind of Scheduler
is needed. You should also understand the existing Ptolemy domains so that you can decide whether your domain can reuse some of the code that already exists. Also, read Chapter 1 so you understand the general classes in the Ptolemy kernel and how the domain methods interact.
mkdom
script at $PTOLEMY/bin/mkdom
can be used to generate template files for a new domain. mkdom
takes one argument, the name of the domain, which case insensitive, mkdom
converts the what ever you pass to it as a domain name to upper and lower case internally. Here, we assume that you have set up a parallel development tree, as documented in chapter
1, or you are working in the directory tree where Ptolemy was untar'd.
mkdom
, create a directory with the name of your domain in the src/domains
directory. In this example, we are creating a domain called yyy
:
mkdom
:
mkdom
will create copies of key files in $PTOLEMY/src/domains/yyy/kernel
and a Nop
star in $PTOLEMY/src/domains/yyy/stars
. The template files have various comments about which methods you need to redefine. The template files also define many function for you automatically. If you aren't clear as to how to define the methods in each class, it is best to try look at the existing Ptolemy domains as examples.
YYY
Domain.cc
This file will be setup for you automatically so that you shouldn't need to modify much. The various methods here return WormHoles
and EventHorizons
which should be defined in YYY
Wormhole
. A node is usually a type of Geodesic
that allows multiple connections, such as AutoForkNode
. You can define your own YYY
Geodesic
or simply use the kernel's AutoForkNode
if that is suitable (this is what SDF does).
YYY
Wormhole.{h,cc}
YYY
Geodesic.{h,cc}
Currently we set the Geodesic
to be the kernel's AutoForkNode
. If the kernel's Geodesic
class offers all the functionality you need, then this doesn't need to be changed. Otherwise try looking at some of the pre-existing domains for examples.
YYY
PortHole.{h,cc}
PortHole
s and output PortHole
s, as well as MultiPortHole
s, specific to your domain. The only required methods are generated for you, but you'll likely want to define many more support methods. Look at the kernel PortHole
, DFPortHole
, and SDFPortHole
for examples.
YYY
Star.{h,cc}
Domain
-specific class definition. Again, all the required methods have been defined but you'll want to add much more. Refer to Star
, DataFlowStar
, and SDFStar
as examples.
YYY
Scheduler.{h,cc}
setup()
, run()
, and setStopTime()
.
$PTOLEMY/obj.$PTARCH
directories. Currently, there are two ways to build the $PTOLEMY/obj.$PTARCH
directory tree: MAKEARCH
and mkPtolemyTree
. To build object files for your new domain in $PTOLEMY/obj.$PTARCH
, you will have to set up either or both of these ways. Typically, you first use MAKEARCH
because it can operate on an existing Ptolemy tree, and once everything works, then you and other users run mkPtolemyTree
to setup parallel development trees on the new domain.
$PTOLEMY/MAKEARCH
is a /bin/csh
script that creates or updates the object tree in an already existing Ptolemy tree. To add a domain to MAKEARCH
, edit the file and look for a similar domain, and add appropriately. A little trial and error may be necessary, but the basic idea is simple: MAKEARCH
traverses directories and creates subdirectories as it sees fit. Note that if MAKEARCH
is under version control, you may need to do chmod a+x MAKEARCH
when you check it back out, or it won't be executable.Continuing with our example:
MAKEARCH
and add your domain yyy to the list of experimental domains:
stars
and kernel
directory to be created in $PTOLEMY/obj.$PTARCH/domains/yyy
when MAKEARCH
is run.
MAKEARCH
:
obj.$PTARCH
tree, as MAKEARCH
has probably traversed down a parallel tree created by mkPtolemyTree
and come up in a directory that you do not own.
$PTOLEMY/bin/mkPtolemyTree
is a tclsh
script that creates a new parallel Ptolemy tree. Note that mkPtolemyTree
cannot be run in an already existing Ptolemy development tree. The file $PTOLEMY/mk/stars.mk
controls what directories mkPtolemyTree
creates, you need not actually edit the mkPtolemyTree
script. To create pigiRpc
binaries with your new domain in it, you will need to modify stars.mk
, so adding support for mkPtolemyTree
is fairly trivial.
MDSDF=1
definition for example.
mkPtolemyTree
uses the CUSTOM_DIRS
makefile variable to determine what directories to create, so be sure to add your directories here.
$PTOLEMY/mk/stars.mk
and add your entry:
$PTOLEMY/mk/ptbin.mk
, add your domain to the FULL
definition. This causes your domain to be built in whenever a full pigiRpc
binary is created.
pigiRpc
with your domain, first build and install your domain's kernel and star libraries:
cd $PTOLEMY; make install
, though this could take 3 hours. An alternative would be to create a parallel directory tree using mkPtolemyTree
.
mkPtolemyTree
, you may also need to do:
pigiRpc
. You can either build a full pigiRpc
with all of the domains, or you can create a override.mk
in $PTOLEMY/obj.$PTARCH/pigiRpc
which will pull in only the domains you want.
$PTOLEMY/obj.$PTARCH/pigiRpc/override.mk
could contain:
pigi
with the -console
option: