Actual source code: ex2.c
petsc-3.9.4 2018-09-11
2: static char help[] = "Demonstrates use of color map\n";
5: #include <petscsys.h>
6: #include <petscdraw.h>
8: int main(int argc,char **argv)
9: {
10: PetscDraw draw;
11: PetscMPIInt size,rank;
13: int x = 0,y = 0,width = 256,height = 256,i;
15: PetscInitialize(&argc,&argv,NULL,help);
16: PetscDrawCreate(PETSC_COMM_WORLD,0,"Title",x,y,width,height,&draw);
17: PetscDrawSetFromOptions(draw);
18: MPI_Comm_size(PETSC_COMM_WORLD,&size);
19: MPI_Comm_rank(PETSC_COMM_WORLD,&rank);
20: for (i=rank; i<height; i+=size) {
21: PetscReal y = ((PetscReal)i)/(height-1);
22: PetscDrawLine(draw,0.0,y,1.0,y,i%256);
23: }
24: PetscDrawFlush(draw);
25: PetscDrawPause(draw);
26: PetscDrawSave(draw);
27: PetscDrawDestroy(&draw);
28: PetscFinalize();
29: return ierr;
30: }
34: /*TEST
36: build:
37: requires: x
39: test:
40: output_file: output/ex1_1.out
42: TEST*/