[petsc-users] When to perform PETSc.Vec assembly with petsc4py

Jose E. Roman jroman at dsic.upv.es
Tue Jul 15 05:20:32 CDT 2025


Assembly is needed after a call to x.setValues() or any of its variants.
https://urldefense.us/v3/__https://petsc.org/main/petsc4py/reference/petsc4py.PETSc.Vec.html*petsc4py.PETSc.Vec.setValue__;Iw!!G_uCfscf7eWS!cvSh6J_ggyBtDLAEXjAIxkYQUbKkTTiA-QPyYNKZh3E_iJjftgP4afSVeUnPwdIE84eDB6to38b3rFjJg9yRB1QL$ 
Take into account that in python the notation x[i] = ...  with call x.setValues() under the hood.

Jose


> El 15 jul 2025, a las 12:02, SCOTTO Alexandre via petsc-users <petsc-users at mcs.anl.gov> escribió:
> 
> Dear PETSc community,
>  As a beginner in the MPI world and with the PETSc library, I come with a possibly very naive question.
> I know from the documentation that assembling vectors must be done, but it is not clear to me when to perform this operation.
> Is there a simple way to know when a vector need be assembled and when it is not?
>  Thanks in advance.
> Regards,
> Alexandre. 



More information about the petsc-users mailing list