Actual source code: ex1.c
petsc-3.4.2 2013-07-02

      2: static char help[] = "Tests repeated VecSetType().\n\n";

      4: #include <petscvec.h>

      8: int main(int argc,char **argv)
      9: {
     11:   PetscInt       n   = 5;
     12:   PetscScalar    one = 1.0,two = 2.0;
     13:   Vec            x,y;

     15:   PetscInitialize(&argc,&argv,(char*)0,help);

     17:   /* create vector */
     18:   VecCreate(PETSC_COMM_SELF,&x);
     19:   VecSetSizes(x,n,PETSC_DECIDE);
     20:   VecSetType(x,"mpi");
     21:   VecSetType(x,"seq");
     22:   VecDuplicate(x,&y);
     23:   VecSetType(x,"mpi");

     25:   VecSet(x,one);
     26:   VecSet(y,two);

     28:   VecDestroy(&x);
     29:   VecDestroy(&y);

     31:   PetscFinalize();
     32:   return 0;
     33: }