/* Called to handle case 3 from VisItDetectInput where we have console * input that needs to be processed in order to accomplish an action. */ void ProcessConsoleCommand(simulation_data *sim) { /* Read A Command */ char cmd[1000]; if (sim->par_rank == 0) { if(VisItReadConsole(1000, cmd) == VISIT_ERROR) { sprintf(cmd, "quit"); printf("quit\n"); } } #ifdef PARALLEL /* Broadcast the command to all processors. */ MPI_Bcast(cmd, 1000, MPI_CHAR, 0, sim->par_comm); #endif if(strcmp(cmd, "quit") == 0) sim->done = 1; else if(strcmp(cmd, "halt") == 0) sim->runMode = SIM_STOPPED; else if(strcmp(cmd, "step") == 0) simulate_one_timestep(sim); else if(strcmp(cmd, "run") == 0) sim->runMode = SIM_RUNNING; }
/* Called to handle case 3 from VisItDetectInput where we have console * input that needs to be processed in order to accomplish an action. */ void ProcessConsoleCommand(simulation_data *sim) { /* Read A Command */ char cmd[1000]; if (sim->par_rank == 0) { if(VisItReadConsole(1000, cmd) == VISIT_ERROR) { sprintf(cmd, "quit"); printf("quit\n"); } } #ifdef PARALLEL /* Broadcast the command to all processors. */ MPI_Bcast(cmd, 1000, MPI_CHAR, 0, sim->par_comm); #endif if(strcmp(cmd, "quit") == 0) sim->done = 1; else if(strcmp(cmd, "halt") == 0) sim->runMode = SIM_STOPPED; else if(strcmp(cmd, "step") == 0) simulate_one_timestep(sim); else if(strcmp(cmd, "run") == 0) sim->runMode = SIM_RUNNING; else if(strcmp(cmd, "update") == 0) { VisItTimeStepChanged(); VisItUpdatePlots(); } if (sim->echo && sim->par_rank == 0) { fprintf(stderr, "Command '%s' completed.\n", cmd); fflush(stderr); } }
/* Called to handle case 3 from VisItDetectInput where we have console * input that needs to be processed in order to accomplish an action. */ void mainloop_interactive_console_command(simulation_data *sim) { /* Read A Command */ char cmd[1000]; if (sim->par_rank == 0) { if(VisItReadConsole(1000, cmd) == VISIT_ERROR) { sprintf(cmd, "quit"); printf("quit\n"); } } #ifdef PARALLEL /* Broadcast the command to all processors. */ MPI_Bcast(cmd, 1000, MPI_CHAR, 0, sim->par_comm); #endif SimControlCommandCallback(cmd, NULL, sim); }