[petsc-dev] Access Non-Local Data in Function routine and Jacobian routine

Hesameddin Ilatikhameneh hilatikh at purdue.edu
Thu Jan 10 13:58:16 CST 2013


I'm trying to use Petsc Non-linear solver such that in Function routine I have access to the variables on the other cpus.
As far as I know, the Function and Jacobian routine gives the solution vectors as input "Locally". So when I use:

  /* Get pointers to vector data */
  ierr = VecGetArray(X,&x); CHKERRQ(ierr);
  ierr = VecGetArray(G,&g); CHKERRQ(ierr)

I will have just access to local data. 

I tried to create a ghost vector using my local data container (VecCreateGhostWithArray(...,&Local_Data)) and hoped that Petsc would change the data in data container and each time that Function routine or Hessian routine be called I can use my ghost vector to access the non-local data. However, it seems that Local_Data container do not update despite I used "WithArray" and assemble each time. 


More information about the petsc-dev mailing list