Strip Chart

VisIt's Simulation Window provides controls for displaying strip charts, which are curves created from sample points that are sent to VisIt as the simulation runs. Strip charts display a time history for the variables in question. Strip charts are only available when using VisIt with Libsim via an interactive connection with the VisIt GUI.

Simulation Window Strip Chart.png
Strip Charts in VisIt's Simulations Window

The Libsim programming API does not have dedicated functions for managing the strip chart functionality. Consequently, sending strip chart data to VisIt is awkward and uses the VisItUI functions in Libsim. Actually, the strip chart functionality encodes commands that tell the Simulation window to modify strip chart attributes, instead of setting actual widget values.

Current Drawbacks:

  • Lack of dedicated API, which makes this hard to use.
  • Encoding commands as strings and overloading use of VisItUI_setValueS() function to pass commands.
  • Parsing of the commands in the Simulation window does not deal well with spaces in names. Use underscores for now.
  • Passing invalid numeric values such as "inf" causes the VisIt GUI to hang.
  • It is very important to separate compound arguments in the encoded string using " | ".

Eventually, Libsim could be extended to provide dedicated strip chart management functions to make things better/easier.

Sending Strip Chart Data

Strip chart data are sent to VisIt using a series of calls to the VisItUI_setValueS() function to pass string data to VisIt's Simulation Window. This function is normally used to send a new string value to a named widget in a custom user interface. In this case, commands are encoded in the string data. This code should be called after

VisItTimeStepChanged();

// A convenient spot to send strip chart data is after you call the
// VisItTimeStepChanged() function.
if(VisItIsConnected())
{
    // Label a tab in the strip chart area. The 0 in this case is a tab 
    // index in the window. Allowable values are 0,1,2,3,4.
    VisItUI_setValueS("STRIP_CHART_SET_NAME", "0 | name", 1);

    // Add menu items. These are names of curves that can be selected.
    // The names may not contain spaces.
    VisItUI_setValueS("STRIP_CHART_ADD_MENU_ITEM", "x", 1);
    VisItUI_setValueS("STRIP_CHART_ADD_MENU_ITEM", "x^2", 1);
    VisItUI_setValueS("STRIP_CHART_ADD_MENU_ITEM", "x^3", 1);

    // Select some curves that are selected for plotting in the window.
    // The first number corresponds to the strip chart tab (0,1,2,3,4)
    // The second number corresponds to the curve id of the strip chart curve.
    //   - There are 5 slots for curves in the window (values 0,1,2,3,4)
    VisItUI_setValueS("STRIP_CHART_SET_CURVE_NAME", "0 | 0 | x", 1);   // curveid=0
    VisItUI_setValueS("STRIP_CHART_SET_CURVE_NAME", "0 | 1 | x^2", 1); // curveid=1

    // Adding sample points for the curves.
    char tmp[100];
    int tab = 0;
    int curveid = 1; // Set the value for x^2
    int x = cycle;   // simulation cyle
    double y = x*x; 
    sprintf(tmp, "%d | %d | %d | %g", i, 0, x, y);
    VisItUI_setValueS("STRIP_CHART_ADD_POINT", tmp, 1);

    // NOTE: you will need to add sample points for all of the strip chart
    //       variables that you want to update on a per cycle basis.
}