3.8 Interacting with a POSE Module and the POSE System

POSE modules consist of <>.ci, <>.h and <>.C files that are translated via etrans.pl into <>_sim.ci, <>_sim.h and <>_sim.C files. To interface these with a main program module, say in files pgm.ci, pgm.h and pgm.C, the pgm.ci file must declare the POSE module as extern in the mainmodule Pgm block. For example:

 
mainmodule Pgm {
extern module <>;
readonly CkChareID mainhandle;

mainchare main {
entry main();
};
};

The pgm.C file should include pose.h and <>_sim.h along with its own headers, declarations and whatever else it needs.

Somewhere in the main function, POSE_init() should be called. This initializes all of POSE's internal data structures. The parameters to POSE_init() specify a termination method. POSE programs can be terminated in two ways: with inactivity detection or with an end time. Inactivity detection terminates after a few iterations of the GVT if no events are being executed and virtual time is not advancing. When an end time is specified, and the GVT passes it, the simulation exits. If no parameters are provided to POSE_init(), then the simulation will use inactivity detection. If a time is provided as the parameter, this time will be used as the end time.

Now POSE is ready for posers. All posers can be created at this point, each with a unique handle. The programmer is responsible for choosing and keeping track of the handles created for posers. Once all posers are created, the simulation can be started:

 
POSE_start();

November 23, 2009
POSE Homepage
Charm Homepage