petsc-3.8.4 2018-03-24
Report Typos and Errors


Allows one to replace the array in a vector with an array provided by the user. This is useful to avoid copying an array into a vector.


#include "petscvec.h"   
PetscErrorCode  VecReplaceArray(Vec vec,const PetscScalar array[])
Not Collective

Input Parameters

vec - the vector
array - the array


This permanently replaces the array and frees the memory associated with the old array.

The memory passed in MUST be obtained with PetscMalloc() and CANNOT be freed by the user. It will be freed when the vector is destroy.

Not supported from Fortran

See Also

VecGetArray(), VecRestoreArray(), VecPlaceArray(), VecResetArray()

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