Date: 2022-03-31T04:46:20+00:00

Actual source code: vecs.c

      2: #include <petscvec.h>

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

     11: PetscErrorCode VecsCreateSeq(MPI_Comm comm,PetscInt p,PetscInt m,Vecs *x)
     12: {
     13:   PetscNew(x);
     14:   VecCreateSeq(comm,p*m,&(*x)->v);
     15:   (*x)->n = m;
     16:   return 0;
     17: }

     19: PetscErrorCode VecsCreateSeqWithArray(MPI_Comm comm,PetscInt p,PetscInt m,PetscScalar *a,Vecs *x)
     20: {
     21:   PetscNew(x);
     22:   VecCreateSeqWithArray(comm,1,p*m,a,&(*x)->v);
     23:   (*x)->n = m;
     24:   return 0;
     25: }

     27: PetscErrorCode VecsDuplicate(Vecs x,Vecs *y)
     28: {
     29:   PetscNew(y);
     30:   VecDuplicate(x->v,&(*y)->v);
     31:   (*y)->n = x->n;
     32:   return 0;
     33: }