steereo:classes:steereowrapper

SteereoWrapper

Description

The wrapper functions for Fortran 90/95 and C are contained in steereoWrapper.cpp and steereoWrapper.h. An example for the use of it can be seen in the Fortran / C section. Here I will list the available functions and their pendants.

Important Functions

SimSteering

You provide the instance you want to use usually as first parameter (ssID).

  •  int simsteer_new_ () 

    constructs a new SimSteering instance and returns a reference to it.

  •  void simsteer_delete_ (int* ssID) 

    destroys the given SimSteering instance.

  •  void simsteer_processqueue_ (int* ssID) 

    wraps SimSteering::processQueue()

  •  void simsteer_setcommunicator_ (int* ssID, int* commID) 

    wraps SimSteering::setCommunicator(SteereoCommunicator*)

  •  void simsteer_startlistening_ (int* ssID) 

    wraps SimSteering::startListening

ClientSteering

You provide the instance you want to use usually as first parameter (csID). The only thing that is a little bit more complicated is the registration of a response handler, as there are problems to pass a Fortran function. Therefore you have to specify a command, from which the execute method will serve as the response handler.

  •  int clientsteering_new_ () 

    constructs a new ClientSteering instance and returns a reference to it.

  •  void clientsteering_delete_ (int* csID)

    destroys the given ClientSteering instance.

  •  void clientsteering_startconnection_ (int* csID, int* commID, char* ip, int* ipLength, char port, int* portLength, int* connNr)

    wraps ClientSteering::startConnection (SteereoCommunicator* commu, std::string ip, std::string port, int connNr)

  •  void clientsteering_startaccepting_ (int* csID, int* connNr) 

    wraps ClientSteering::startAccepting (int connNr)

  •  void clientsteering_makerequest_ (int* csID, char* commandName, int* nameSize, char* params, int* paramSize, int* connNr) 

    wraps ClientSteering::makeRequest (std::string reqName, std::string reqParam, int connNr)

  •  void clientsteering_addcommandaction_ (int* csID, char* commandName, int* nameSize, char* responseCommandName, int* responseCommandSize) 

    wraps ClientSteering::addAction (std::string forCommand, PtrToGenerator gen) and is the only way for Fortran to register a response handler.

SteereoSocketCommunicator

The Wrapper for SteereoSocketCommunicator lets you create and delete instances.

  •  int socketcommunicator_simple_new_ () 

    constructs a new SteereoSocketCommunicator without specifying a port.

  •  int socketcommunicator_new_ (int* port) 

    constructs a new SteereoSocketCommunicator.

  •  void socketcommunicator_delete_ (int* commID) 

    destroys the referenced SteereoSocketCommunicator.

SteereoMPICommunicator

Also available is a communicator using MPI SteereoMPICommunicator, although at the moment only MPICH2 seems to support the used MPI commands (OpenMPI has problem with MPI calls in threads, and Intel MPI hasn't implemented some of the needed commands)

  •  int mpicommunicator_simple_new_ () 

    constructs a new SteereoSocketCommunicator without specifying a port.

  •  int mpicommunicator_new_ (int* port) 

    constructs a new SteereoSocketCommunicator.

  •  void mpicommunicator_delete_ (int* commID) 

    destroys the referenced SteereoSocketCommunicator.

SteereoMPIIntraCommunicator

For internal communication inside a simulation partition a SteereoMPIIntraCommunicator is at the moment the only choice.

  •  int mpiintracommunicator_new_ (); 

    constructs a new SteereoMPIIntraCommunicator

  •  void mpiintracommunicator_delete_ (int* commID); 

    destroy the specified SteereoMPIIntraCommunicator.

  •  void mpiintracommunicator_generateequally_ (int* commID, int* ownRank, int* partNum, int* ownSize); 

    using the given SteereoMPIIntraCommunicator this function (called on every process with the same partNum and ownSize values !) generates partNum partitions out of ownSize processes in total (partNum should also divide ownSize without rest)

  •  int mpiintracommunicator_amiroot_ (int* commID); 

    returns 1, if the current process is the root of its partition

SteereoCommand

Some functions to add data (and its size), that should be passed on to the specified SteereoCommand.

  •  void add_command_data_ (char* commandName, int* nameSize, void* dataPtr) 

    wraps SteereoCommand::addData (void* dataPtr)

  •  void add_command_data_and_size_ (char* commandName, int* nameSize, void* dataPtr, int* size) 

    a combination of the above two functions.

SteerParameterCommand

As there is no template support in Fortran you have to choose the appropriate function yourself, with which you register your parameter to SteerParameterCommand.

  •  void register_scalar_float_parameter_ (char* name, int* nameSize, float* val, float* min, float* max) 
     void register_scalar_double_parameter_ (char* name, int* nameSize, double* val, double* min, double* max) 
     void register_scalar_int_parameter_ (char* name, int* nameSize, int* val, int* min, int* max) 

    wrap SteerParameterCommand::registerScalarParameter (std::string paramName, T* ptrToParam, std::string minVal, std::string maxVal)

  •  void register_array_float_parameter_ (char* name, int* nameSize, float* valArr, int* lgth) 
     void register_array_double_parameter_ (char* name, int* nameSize, double* valArr, int* lgth) 
     void register_array_int_parameter_ (char* name, int* nameSize, int* valArr, int* lgth) 

    wrap SteereoParameterCommand::registerArrayParameter (std::string paramName, T* ptrToParam, int arrayLength)

Other Functions

  •  void load_commands_ (int* simSteerInstance, char* path, int* pathSize) 

    loads the commands which have been compiled as a dynamic library and reside in the given path

  •  void set_logger_level_ (int* lv) 

    sets the logger level, details at SteereoLogger

  •  void sleep_ (int sec) 

    wait for sec seconds

steereo/classes/steereowrapper.txt · Last modified: 2010/08/06 17:20 by hpcdjenz