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.