[petsc-users] How to VecScatter from global to local vector, and then, VecGather back ?

Franck Houssen franck.houssen at inria.fr
Tue Jun 6 11:45:48 CDT 2017


How to VecScatter from global to local vector, and then, VecGather back ? 

This is a very simple use case: I need to split a global vector in local (possibly overlapping) pieces, then I need to modify each local piece (x2), and finally I need to assemble (+=) back local parts into a global vector. 
Read the doc and went through examples... But still can't make this work: can I get some help on this ? 

Note: running petsc-3.7.6 on debian with gcc-6.3 

Thanks, 

Franck 

~> head -n 12 vecScatterGather.cpp 
// How to VecScatter from global to local vector, and then, VecGather back ? 
// 
// global vector: 3x1 2 overlapping local vector: 2x1 global vector: 3x1 
// 
// x2 
// |1 -> |2 
// |1 scatter |1 |2 gather |2 
// |1 -> -> |4 
// |1 |1 -> |2 |2 
// |1 |2 
// 
// ~> g++ -o vecScatterGather.exe vecScatterGather.cpp -lpetsc -lm; mpirun -n 2 vecScatterGather.exe 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170606/fe85fb84/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vecScatterGather.cpp
Type: text/x-c++src
Size: 2437 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170606/fe85fb84/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vecScatterGather.log
Type: text/x-log
Size: 381 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170606/fe85fb84/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: vecScatterGather.log.expected
Type: application/octet-stream
Size: 374 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20170606/fe85fb84/attachment.obj>


More information about the petsc-users mailing list