Actual source code: ex1.c

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

 4:  #include petscvec.h
 5:  #include petscsys.h

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

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

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

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

 29:   VecDestroy(x);
 30:   VecDestroy(y);

 32:   PetscFinalize();
 33:   return 0;
 34: }
 35: