Actual source code: ex1.c

  1: /*$Id: ex1.c,v 1.13 2001/08/07 03:02:26 balay Exp $*/

  3: static char help[] = "Tests repeated VecSetType().nn";

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

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

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

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

 24:   VecSet(&one,x);
 25:   VecSet(&two,y);

 27:   VecDestroy(x);
 28:   VecDestroy(y);

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