next up previous contents
Next: The GVTManager class Up: Methods of the LogicalProcess Previous: Methods of the LogicalProcess

simulate

The LogicalProcess method simulate actually contains the main loop that ``drives'' a simulation. This loop performs the following actions each simulation cycle:

The declaration for the LogicalProcess class follows:

class LogicalProcess {
  friend class BasicTimeWarp;
public:
  LogicalProcess(int,int,int);    // pass in the total number of objects,
                                  // pthe number of objects this 
                                  // LP is dealing with, and number of LPs
  ~LogicalProcess() {
    delete [] simArray;
#ifdef LPDEBUG
    outFile.close();
#endif
  };

  int getNumObjects();            
  bool simulationFinished;

  void simulate(VTime simUntil = PINFINITY );  // Simulate until time

  ObjectRecord* simArray;
  
  void allRegistered( void ); // called by application to tell the kernel 
                              // when all of the simulation objects in this
                              // LP have registered
  void registerObject( BasicTimeWarp* handle );

  // Method for simulation objects to call when an error has occured, and
  // the simulation needs to end...
  void terminateSimulation( char *errorMsg ){
    cerr << "LP" << id << " terminating because " << errorMsg << endl;
    TerminateMsg die;
    die.error[0] = '\0';
    comm.recvMsg( &die );
  }

private:
  bool initialized;     // flag that gets set if we've been initialized
  
  int numRegistered;
  int numObjects;       // number of objects on this LP
  int totalObjects;     // total number of sim objects
  int numLPs;           // the number of LPs
  int id;               // my LP id

  CommManager comm;     // our walkie talkie to the other LPs

  SCHEDULER scheduler;  
  FOSSIL_MANAGER gVT;   // basically our GVT manager

};



Philip A. Wilsey
1/26/1998