Example for usage of vtkfig C API.
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
double G(double x,double y, double t)
{
return exp(-(x*x+y*y))*sin(t+x)*cos(y-t);
}
int main(int argc, char *argv[])
{
int nspin=10;
int Nx = 200;
int Ny = 250;
double *x=malloc(Nx*sizeof(double));
double *y=malloc(Ny*sizeof(double));
double *z=malloc(Nx*Ny*sizeof(double));
double x_low = -2.5;
double x_upp = 1.5;
double y_low = -2.5;
double y_upp = 4;
double dx = (x_upp-x_low)/(Nx-1);
double dy = (y_upp-y_low)/(Ny-1);
int i,j;
int ii=0;
double t=0;
double dt=0.1;
for (i=0; i<Nx; i++)
x[i] = x_low+i*dx;
for (i=0; i<Ny; i++)
y[i] = y_low + i*dy;
for (i=0; i<Nx; i++)
for (j=0; j<Ny; j++)
{
z[j*Nx+i] = G(x[i],y[j],0);
}
while (ii<nspin)
{
for (i=0; i<Nx; i++)
for (j=0; j<Ny; j++)
{
z[j*Nx+i] = G(x[i],y[j],t);
}
t+=dt;
ii++;
}
printf("Ist alles weg ?\n");
return 0;
}
void vtkfigSetRectilinearGrid2D(vtkfigDataSet *dataset, double *x, int nx, double *y, int ny)
Enter data of a 2D rectilinear grid.
struct vtkfigFrame_struct vtkfigFrame
Provide a framework wrapping window+interactor+renderers from vtk.
Definition: vtkfigCAPI.h:22
struct vtkfigDataSet_struct vtkfigDataSet
Class to collect all data given on one grid.
Definition: vtkfigCAPI.h:40
struct vtkfigScalarView_struct vtkfigScalarView
Surface and contour plot of 2/3D scalar data.
Definition: vtkfigCAPI.h:53