Initialization and Finalization

You must initialize the SIMULIA Co-Simulation Services prior to calling any services, and it is good practice to finalize the SIMULIA Co-Simulation Services prior to ending the application.

This page discusses:

Initialization

The SIMULIA Co-Simulation Services can operate in serial or parallel mode.

In serial mode, all functions are called from the main process even if the client uses a parallel distributed memory implementation. In this case, the client is responsible for fan-in/out mesh and field data between its compute ranks.

In parallel mode, the functions are called collectively on every compute rank, and the SIMULIA Co-Simulation Services is responsible for distributing the mesh and field data to the appropriate compute ranks. You must provide an implementation for the SIMULIA Co-Simulation Services DMP interface (see Parallel Interface Definition) and register it.

Use the SMACseInitialize function to initialize the SRE. This function takes the following argument:

iDMPDLLPath
This argument is required when embedding the SIMULIA Co-Simulation Services in parallel mode. Set it to the dynamic link library containing your implementation of the distributed memory interface when using parallel mode; otherwise, set it to NULL.

When you embed the SIMULIA Co-Simulation Services in parallel mode, you must call SMACseInitialize on all compute ranks.

Finalization

Finalizing ensures that any memory allocated by the SRE is deallocated. This is especially important for an interactive application that might run multiple simulations.

Use the SMACseFinalize function to finalize the co-simulation services session. TheSMACseFinalize function has no arguments.

When you embed the SIMULIA Co-Simulation Services in parallel mode, you must call SMACseFinalize on all compute ranks.

Example

The following example illustrates how to initialize and finalize the co-simulation services session:

// CSS Header files
#include <SMACseApi.h>
#include <SMACseApiEnums.h>

int main(int argc, char *argv[])
{
                :
// Initialize the SIMULIA CO-SIMULATION SERVICES
#if defined (_WINDOWS_SOURCE)
    SMACseInitialize("myDmpModule.dll");
#elif defined (_LINUX_SOURCE)
    SMACseInitialize("myDmpModule.so");
#endif
                :

// Finalize the SIMULIA CO-SIMULATION SERVICES
    SMACseFinalize( );
             :
    exit(0);
}