[petsc-users] about VecScatter
likunt at caltech.edu
likunt at caltech.edu
Sat May 10 23:11:22 CDT 2014
Dear Petsc developers,
I have a vector object M, I need all the elements of it in all the
processors.
Here is a part of my code
//////////////////////////////////////////////////////////////
Vec M;
VecScatterCreateToAll(M,&scatter_ctx,&N);
VecScatterBegin(scatter_ctx,M,N,INSERT_VALUES,SCATTER_FORWARD);
VecScatterEnd(scatter_ctx,M,N,INSERT_VALUES,SCATTER_FORWARD);
VecGetArray(N, &aM);
for(i=xs; i<xs+xm; i++)
{
//within the loop, requires all the elements of aM
}
////////////////////////////////////////////////////////////
but this seems not working well. Would you please suggest a more efficient
way? Thank you.
More information about the petsc-users
mailing list