[petsc-users] create a new large vector via combining existing small vectors

Barry Smith bsmith at mcs.anl.gov
Wed Apr 27 16:09:28 CDT 2011


On Apr 27, 2011, at 3:35 PM, Xiangdong Liang wrote:

> Hello everyone,
> 
> I have a problem with creating a new large vector via combining existing small vectors. Suppose I have two vectors v1 and v2 (size n-by-1) already. I want to have a new vector vout (size 2n-by-1) with vout(1:n) = v1 and vout(n+1:2*n) = v2. Is there any quick way to create vout with Petsc's built in functions? Thanks.

   No. 

   You can use VecCreate() and then a couple of VecScatters to get the entries from the two small vectors to the large one.

   Barry



> 
> Best,
> Xiangdong



More information about the petsc-users mailing list