Hi Alfredo Take a look at VecStrideGather and VecStrideScatter….maybe these are what you want?
https://petsc.org/release/docs/manualpages/Vec/VecStrideGather.html <https://petsc.org/release/docs/manualpages/Vec/VecStrideGather.html> https://petsc.org/release/docs/manualpages/Vec/VecStrideScatter.html <https://petsc.org/release/docs/manualpages/Vec/VecStrideScatter.html> Randy M. > On Aug 11, 2021, at 12:33 PM, Alfredo J Duarte Gomez <aduar...@utexas.edu> > wrote: > > Good morning, > > I am currently handling a structured dmda object with more than one field. > > In some intermediate operations, I have to create and handle vectors of a > size that corresponds to the same dmda with one field only. > > After that, it would be very useful to concatenate these vectors and then use > them with matrices of the size of the original dmda (more than one field), I > hope the vectors keep their i,j structure from the dmda. > > I tried using VecConcatenate but it seems to be scrambling the vector without > the i,j arrangement, and the only other way I can think of is using a for > loop over every grid point which seems cumbersome. > > Any suggestions for this problem? > > -Alfredo > > -- > Alfredo Duarte > Graduate Research Assistant > The University of Texas at Austin