petsc-3.11.4 2019-09-28
Report Typos and Errors

VecDuplicate

Creates a new vector of the same type as an existing vector.

Synopsis

#include "petscvec.h"   
PetscErrorCode  VecDuplicate(Vec v,Vec *newv)
Collective on Vec

Input Parameters

v -a vector to mimic

Output Parameter

newv -location to put new vector

Notes

VecDuplicate() DOES NOT COPY the vector entries, but rather allocates storage for the new vector. Use VecCopy() to copy a vector.

Use VecDestroy() to free the space. Use VecDuplicateVecs() to get several vectors.

See Also

VecDestroy(), VecDuplicateVecs(), VecCreate(), VecCopy()

Level

beginner

Location

src/vec/vec/interface/vector.c

Examples

src/vec/vec/examples/tutorials/ex1.c.html
src/vec/vec/examples/tutorials/ex9.c.html
src/vec/vec/examples/tutorials/ex16.c.html
src/vec/vec/examples/tutorials/ex18.c.html
src/vec/vec/examples/tutorials/ex1f.F90.html
src/vec/vec/examples/tutorials/ex1f90.F90.html
src/vec/vec/examples/tutorials/ex4f.F.html
src/vec/vec/examples/tutorials/ex4f90.F90.html
src/vec/vec/examples/tutorials/ex9f.F90.html
src/vec/vec/examples/tutorials/ex14f.F90.html
src/vec/vec/examples/tutorials/ex16f.F90.html

Implementations

VecDuplicate_MPI_DA in src/dm/impls/da/dadist.c
VecDuplicate_MPICUDA in src/vec/vec/impls/mpi/mpicuda/mpicuda.cu
VecDuplicate_MPIViennaCL in src/vec/vec/impls/mpi/mpiviennacl/mpiviennacl.cxx
VecDuplicate_MPI in src/vec/vec/impls/mpi/pbvec.c
VecDuplicate_Nest in src/vec/vec/impls/nest/vecnest.c
VecDuplicate_Node in src/vec/vec/impls/node/vecnode.c
VecDuplicate_Seq in src/vec/vec/impls/seq/bvec2.c
VecDuplicate_SeqCUDA in src/vec/vec/impls/seq/seqcuda/veccuda.c
VecDuplicate_SeqViennaCL in src/vec/vec/impls/seq/seqviennacl/vecviennacl.cxx
VecDuplicate_Shared in src/vec/vec/impls/shared/shvec.c

Index of all Vec routines
Table of Contents for all manual pages
Index of all manual pages