Ejemplo n.º 1
0
int
main(
     int argc,
     char *argv[])
{
    char *p;

    /*
     * Set up the default locale to be standard "C" locale so parsing is
     * performed correctly.
     */

    setlocale(LC_ALL, "C");

    /*
     * Forward slashes substituted for backslashes.
     */

    for (p = argv[0]; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);

    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 2
0
int
main(
    int argc,
    char *argv[])
{
    /*
     * The following #if block allows you to change the AppInit function by
     * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire
     * file. The #if checks for that #define and uses Tcl_AppInit if it
     * doesn't exist.
     */

#ifndef TCL_LOCAL_APPINIT
#define TCL_LOCAL_APPINIT Tcl_AppInit
#endif
    extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));

    /*
     * The following #if block allows you to change how Tcl finds the startup
     * script, prime the library or encoding paths, fiddle with the argv,
     * etc., without needing to rewrite Tcl_Main()
     */

#ifdef TCL_LOCAL_MAIN_HOOK
    extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
#endif

    char *p;

    /*
     * Set up the default locale to be standard "C" locale so parsing is
     * performed correctly.
     */

#if defined(__GNUC__)
    setargv( &argc, &argv );
#endif
    setlocale(LC_ALL, "C");

    /*
     * Forward slashes substituted for backslashes.
     */

    for (p = argv[0]; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);

    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 3
0
int
main(
    int argc,			/* Number of command-line arguments. */
    char **argv)		/* Values of command-line arguments. */
{
#ifdef TCL_XT_TEST
    XtToolkitInitialize();
#endif

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 4
0
int
main(
    int argc,			/* Number of command-line arguments. */
    char *dummy[])		/* Not used. */
{
    TCHAR **argv;
#else
int
_tmain(
    int argc,			/* Number of command-line arguments. */
    TCHAR *argv[])		/* Values of command-line arguments. */
{
#endif
    TCHAR *p;

    /*
     * Set up the default locale to be standard "C" locale so parsing is
     * performed correctly.
     */

    setlocale(LC_ALL, "C");

#ifdef TCL_BROKEN_MAINARGS
    /*
     * Get our args from the c-runtime. Ignore command line.
     */

    setargv(&argc, &argv);
#endif

    /*
     * Forward slashes substituted for backslashes.
     */

    for (p = argv[0]; *p != '\0'; p++) {
	if (*p == '\\') {
	    *p = '/';
	}
    }

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 5
0
int
main(
    int argc,
    char *dummy[])
{
    TCHAR **argv;
#else
int
_tmain(
    int argc,
    TCHAR *argv[])
{
#endif
    TCHAR *p;

    /*
     * Set up the default locale to be standard "C" locale so parsing is
     * performed correctly.
     */

    setlocale(LC_ALL, "C");

#ifdef TCL_BROKEN_MAINARGS
    /*
     * Get our args from the c-runtime. Ignore lpszCmdLine.
     */

    setargv(&argc, &argv);
#endif

    /*
     * Forward slashes substituted for backslashes.
     */

    for (p = argv[0]; *p != TEXT('\0'); p++) {
	if (*p == TEXT('\\')) {
	    *p = TEXT('/');
	}
    }

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);
    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 6
0
int
main(
    int argc,			/* Number of command-line arguments. */
    char **argv)		/* Values of command-line arguments. */
{
    /*
     * The following #if block allows you to change the AppInit function by
     * using a #define of TCL_LOCAL_APPINIT instead of rewriting this entire
     * file. The #if checks for that #define and uses Tcl_AppInit if it does
     * not exist.
     */

#ifndef TCL_LOCAL_APPINIT
#define TCL_LOCAL_APPINIT Tcl_AppInit
#endif
    extern int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));

    /*
     * The following #if block allows you to change how Tcl finds the startup
     * script, prime the library or encoding paths, fiddle with the argv,
     * etc., without needing to rewrite Tcl_Main()
     */

#ifdef TCL_LOCAL_MAIN_HOOK
    extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
#endif

#ifdef TCL_XT_TEST
    XtToolkitInitialize();
#endif

#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    Tcl_Main(argc, argv, TCL_LOCAL_APPINIT);

    return 0;			/* Needed only to prevent compiler warning. */
}
Ejemplo n.º 7
0
int
main(int argc, char **argv)
{
  FEM_ObjectBrokerAllClasses theBroker;
  // MPI_MachineBroker theMachine(&theBroker, argc, argv);
  // theMachineBroker = &theMachine;
  theMachineBroker = new MPI_MachineBroker(&theBroker, argc, argv);

  OPS_rank = theMachineBroker->getPID();
  OPS_np = theMachineBroker->getNP();

  //
  // depending on rank we do something
  //
  if (OPS_rank != 0) {

    //
    // on slave processes we spin waiting to create & run actors
    //
    fprintf(stderr, "Slave Process Running %d\n", OPS_rank);
    theMachineBroker->runActors();

  } else {

    //
    // on process 0 we create some ShadowSubdomains & then start the OpenSees interpreter
    //
    fprintf(stderr, "Master Process Running OpenSees Interpreter %d\n", OPS_rank);   

    //
    // set some global parameters
    //
    OPS_OBJECT_BROKER = &theBroker;
    //    OPS_MACHINE = &theMachine;
    OPS_MACHINE = theMachineBroker;
    OPS_PARALLEL_PROCESSING = OPS_np;

	/* only use p0 if even number of partitions
    if (OPS_np%2 == 0) {
      OPS_NUM_SUBDOMAINS = OPS_np;
      OPS_USING_MAIN_DOMAIN = true;
      OPS_MAIN_DOMAIN_PARTITION_ID = 1;
    } else
      OPS_NUM_SUBDOMAINS = OPS_np - 1;
	  */
	// always use p0 even if ODD number of partitions
	  OPS_NUM_SUBDOMAINS = OPS_np;
      OPS_USING_MAIN_DOMAIN = true;
      OPS_MAIN_DOMAIN_PARTITION_ID = 1;

    OPS_PARTITIONED    = false;
    
    //
    // the rest straightr out of regular tclMain to start our interpreter
    //

    /*
     * The following #if block allows you to change the AppInit
     * function by using a #define of TCL_LOCAL_APPINIT instead
     * of rewriting this entire file.  The #if checks for that
     * #define and uses Tcl_AppInit if it doesn't exist.
     */

#ifndef TCL_LOCAL_APPINIT
#define TCL_LOCAL_APPINIT Tcl_AppInit    
#endif
    
    /* fmk - comment out the following block to get to compile 
       extern "C" int TCL_LOCAL_APPINIT _ANSI_ARGS_((Tcl_Interp *interp));
       fmk - end commented block */

    /*
     * The following #if block allows you to change how Tcl finds the startup
     * script, prime the library or encoding paths, fiddle with the argv,
     * etc., without needing to rewrite Tcl_Main()
     */
    
#ifdef TCL_LOCAL_MAIN_HOOK
    extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
#endif
    
#ifdef TCL_XT_TEST
    XtToolkitInitialize();
#endif
    
#ifdef TCL_LOCAL_MAIN_HOOK
    TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

    g3TclMain(argc, argv, TCL_LOCAL_APPINIT, 1, 0);

    // some clean up to shut the remotes down if still running
    theDomain.clearAll();
    
    // shutdown the remote machines
    theMachineBroker->shutdown();
  }
  
  //
  // mpi clean up
  //

  fprintf(stderr, "Process Terminating %d\n", OPS_rank);

  if (theMachineBroker != 0)
    delete theMachineBroker;
  
  return 0;
}
Ejemplo n.º 8
0
int
main(int argc, char **argv)
{
  FEM_ObjectBrokerAllClasses theBroker;
  MPI_MachineBroker theMachine(&theBroker, argc, argv);
  theMachineBroker = &theMachine;
  OPS_MACHINE = &theMachine;

  rank = theMachine.getPID();
  np = theMachine.getNP();

  if (rank == 0) {
    OPS_theChannels = new Channel *[np-1];
    theChannels = OPS_theChannels;
    numChannels = np-1;
  } else {
    OPS_theChannels = new Channel *[1];
    theChannels = OPS_theChannels;
    numChannels = 1;
  }

  //
  // if rank 0 we send all args
  //

  int numArg = 0;
  int sizeArg = 0;
  char **args = 0;
  char *dataArgs = 0;

  if (rank == 0) {

    for (int i=0; i<argc; i++)
      if (argv[i] == NULL) {
	i = argc+1;
      } else {
	numArg ++;
	sizeArg += strlen(argv[i])+1;
      }

    static ID data(2);
    data(0) = numArg;
    data(1) = sizeArg;

    dataArgs = new char[sizeArg];
    int loc = 0;
    for (int i=0; i<numArg; i++) {
      int lengthArg = strlen(argv[i]);
      strncpy(&dataArgs[loc], argv[i],lengthArg+1);
      loc+=lengthArg+1;
    }

    Message msgChar(dataArgs, sizeArg);

    for (int j=0; j<np-1; j++) {
      Channel *otherChannel = theMachine.getRemoteProcess();
      OPS_theChannels[j] = otherChannel;
      otherChannel->sendID(0,0,data);
      otherChannel->sendMsg(0,0,msgChar);
    }
      
  } else {

    static ID data(2);    

    Channel *myChannel = theMachine.getMyChannel();
    OPS_theChannels[0] = myChannel;
    myChannel->recvID(0,0,data);
    numArg = data(0);
    sizeArg = data(1);
    dataArgs = new char[sizeArg];
    Message msgChar(dataArgs, sizeArg);
    
    myChannel->recvMsg(0,0,msgChar);
  }

  args = new char *[numArg];
  args[0] = dataArgs;
  int argCount = 1;
  for (int j=1; j<sizeArg-1; j++)
    if (dataArgs[j] == '\0') {
      args[argCount] = &dataArgs[j+1];
      argCount++;
    }

  OpenSeesParseArgv(argc, argv);  

#ifndef TCL_LOCAL_APPINIT
#define TCL_LOCAL_APPINIT Tcl_AppInit    
#endif

#ifdef TCL_LOCAL_MAIN_HOOK
  extern int TCL_LOCAL_MAIN_HOOK _ANSI_ARGS_((int *argc, char ***argv));
#endif
    
#ifdef TCL_XT_TEST
  XtToolkitInitialize();
#endif
    
#ifdef TCL_LOCAL_MAIN_HOOK
  TCL_LOCAL_MAIN_HOOK(&argc, &argv);
#endif

  g3TclMain(numArg, args, TCL_LOCAL_APPINIT, rank, np);

  // some clean up to shut the remotes down if still running
  //  theDomain.clearAll();
  
  // shutdown the remote machines
  //  theMachine.shutdown();

  //
  // mpi clean up
  //

  fprintf(stderr, "Process Terminating %d\n", rank);
  
  return 0;
}