Initialization of u, b, x
– We form 1 vector from scratch and then duplicate as needed.
– When using VecCreate(), VecSetSizes and VecSetFromOptions()
in this example, we specify only the
vector's global dimension; the parallel partitioning is determined at runtime.
– When solving a linear system, the vectors and matrices MUST
be partitioned accordingly. PETSc automatically generates
appropriately partitioned matrices and vectors when MatCreate()
and VecCreate() are used with the same communicator.
– The user can alternatively specify the local vector and matrix
dimensions when more sophisticated partitioning is needed
(replacing the PETSC_DECIDE argument in the VecSetSizes() statement
126: VecCreate(PETSC_COMM_WORLD,&u);
127: VecSetSizes(u,PETSC_DECIDE,m*n);
128: VecSetFromOptions(u);