Actual source code: ex6.c

  1: /*
  2:       Demonstrates the use of the "extra", polymorphic versions of many functions
  3: */
 4:  #include petsc.h
 5:  #include petscmat.h



  9: int main(int argc,char **args)
 10: {
 12:   Vec            x;
 13:   Mat            mat,matb,matsb;

 15: #if defined(__cplusplus)
 16:   PetscInitialize(&argc,&args);
 17: #else
 18:   PetscInitialize(&argc,&args,0,0);
 19: #endif

 21: #if defined(__cplusplus)
 22:   VecCreate(&x);
 23: #else
 24:   VecCreate(PETSC_COMM_SELF,&x);
 25: #endif
 26:   VecSetSizes(x,6,0);
 27:   VecSetFromOptions(x);

 29: #if defined(__cplusplus)
 30:   mat   = MatCreateSeqAIJ(6,6);
 31:   matb  = MatCreateSeqBAIJ(2,6,6,5);
 32:   matsb = MatCreateSeqSBAIJ(2,6,6,5);
 33: #else
 34:   MatCreateSeqAIJ(PETSC_COMM_SELF,6,6,0,0,&mat);
 35:   MatCreateSeqBAIJ(PETSC_COMM_SELF,2,6,6,5,0,&mat);
 36:   MatCreateSeqSBAIJ(PETSC_COMM_SELF,2,6,6,5,0,&mat);
 37: #endif

 39:   MatDestroy(mat);
 40:   MatDestroy(matb);
 41:   MatDestroy(matsb);
 42:   VecDestroy(x);
 43:   PetscFinalize();
 44:   return 0;
 45: }