Actual source code: vecs.c

petsc-3.9.3 2018-07-02
Report Typos and Errors

  2:  #include <petscvec.h>

  4: PetscErrorCode VecsDestroy(Vecs x)
  5: {
  8:   VecDestroy(&(x)->v);
  9:   PetscFree(x);
 10:   return(0);
 11: }

 13: PetscErrorCode VecsCreateSeq(MPI_Comm comm,PetscInt p,PetscInt m,Vecs *x)
 14: {
 17:   PetscNew(x);
 18:   VecCreateSeq(comm,p*m,&(*x)->v);
 19:   (*x)->n = m;
 20:   return(0);
 21: }

 23: PetscErrorCode VecsCreateSeqWithArray(MPI_Comm comm,PetscInt p,PetscInt m,PetscScalar *a,Vecs *x)
 24: {
 27:   PetscNew(x);
 28:   VecCreateSeqWithArray(comm,1,p*m,a,&(*x)->v);
 29:   (*x)->n = m;
 30:   return(0);
 31: }

 33: PetscErrorCode VecsDuplicate(Vecs x,Vecs *y)
 34: {
 37:   PetscNew(y);
 38:   VecDuplicate(x->v,&(*y)->v);
 39:   (*y)->n = x->n;
 40:   return(0);
 41: }