note | Keep the following in mind when reviewing this section: The commands described in this section are only available for PV‑WAVE running on UNIX systems. The commands described in this section cannot be used with PV‑WAVE in runtime mode. These routines allow one-way (unidirectional) communication only. That is, PV‑WAVE cannot pass data back to the calling program. If you require data to be passed back to the calling program (bidirectional transfer), then choose another method of interapplication communication. |
waveinit("");
waveinit("wave.out");
CALL WAVEINIT('');
CALL WAVEINIT('wave.out');
wavecmd("plot, [1,2,3,4,5]");
CALL WAVECMD('PLOT, [1,2,3,4,5]')
waveterm();
CALL WAVETERM();
$WAVE_DIR/demo/interapp/wavecmdc/wavecmdc.c
#include <stdio.h>
#include <string.h>
#define MAXSIZE 128
main()
{
/*
* Variables for array passing
*/
char buf[MAXSIZE];
char temp[MAXSIZE];
/*
* Variables for calculations
*/
int i,x[5];
/*
*Perform some calculations
*/
for (i=0; i< 5; i++) x[i] = i * 4;
/*
* Start PV‑WAVE sending the alphanumeric
* output to 'wave.save'.
*/
waveinit("wave.save");
/*
* Send the commands to PV-WAVE. First, we
* need to send the array to PV-WAVE.
*/
sprintf(buf,"a=[%d", x[0]);
for (i=1; i< 5; i++) {
sprintf(temp,",%d", x[i]);
strcat(buf, temp);
}
strcat(buf, "]");
wavecmd(buf);
/*
* Next, we perform a matrix multiplication.
* Then we print the newly formed
* two-dimensional array, as well as display
* it as a surface.
*/
wavecmd("b = a # a");
wavecmd("print, b");
wavecmd("surface, b");
/*
* The following WAIT is needed so that the
* surface will not be deleted as soon as it
* has been drawn.
*/
wavecmd("wait, 3.0");
/*
* Since we are done sending commands to
* PV-WAVE, we must call waveterm.
*/
waveterm();
}
$WAVE_DIR/demo/interapp/wavecmdfor/wavecmdfor.f
PROGRAM TEST
C
C Start PV-WAVE and send the alphanumeric
C output to 'wavefor.save'.
C
CALL WAVEINIT('wavefor.save')
C
C Send my commands to PV-WAVE. First, we
C define a 5-element array. Next, we perform
C a matrix multiplication. Then we print the
C newly formed two-dimensional array and
C display it as a surface.
C
CALL WAVECMD('A =[110,90,27,48,60]')
CALL WAVECMD('B =A # A')
CALL WAVECMD('PRINT, B')
CALL WAVECMD('SURFACE, B')
C The following WAIT is needed so that the
C surface will not be deleted as soon as it
C has been drawn.
C
CALL WAVECMD('WAIT, 3.0')
C
C Since we are done sending commands to
C PV-WAVE, we must call waveterm.
C
CALL WAVETERM()
END