Initializing the values of b (and u)
145: PetscOptionsHasName(PETSC_NULL,"–random_exact_sol",&flg);
for (I=Istart; I<Iend; I++) {
v = 0; i = I/n; j = I – i*n; h = 1/(m+1);
if (i==0) v = v + /* u(-1,j): */ h * 0;
if (i==m-1) v = v + /* u(m,j): */ h * (m+1);
if (j==0) v = v + /* u(i,-1): */ h * (i+1);
if (j==n-1) v = v + /* u(i, n): */ h * (i+1);
if (v != 0) ; VecSetValues(b,1,&I,&v,INSERT_VALUES);
v = /* u(i, j): */ h * (i+1); VecSetValues(u,1,&I,&v,INSERT_VALUES);
VecAssemblyBegin(b); VecAssemblyEnd(b);
VecAssemblyBegin(u); VecAssemblyEnd(u);
PetscRandomCreate(PETSC_COMM_WORLD,RANDOM_DEFAULT,&rctx);
VecSetRandom(rctx,u); PetscRandomDestroy(rctx);
167: /* View the exact solution vector if desired */
169: PetscOptionsHasName(PETSC_NULL,"–view_exact_sol",&flg);
170: if (flg) {VecView(u,PETSC_VIEWER_STDOUT_WORLD);}