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().\n\n";

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

 10: int main(int argc,char **argv)
 11: {
 12:   int           ierr,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(&one,x);
 27:   VecSet(&two,y);

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

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