[petsc-users] Error message after call VecSet(R_, zero)

NAN ZHAO zhaonanavril at gmail.com
Tue Sep 7 17:56:59 CDT 2010


Dear all,

I got a strange petsc error when I am running my code with petsc as a linear
sover:
[0]PETSC ERROR: --------------------- Error Message
------------------------------------
[0]PETSC ERROR: Object is in wrong state!
[0]PETSC ERROR: You cannot call this after you have called VecSetValues()
but
 before you have called VecAssemblyBegin/End()!
[0]PETSC ERROR:
------------------------------------------------------------------------
[0]PETSC ERROR: Petsc Release Version 2.3.3, Patch 15, Tue Sep 23 10:02:49
CDT 2008 HG revision: 31306062cd1a6f6a2496fccb4878f485c9b91760
[0]PETSC ERROR: See docs/changes/index.html for recent updates.
[0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
[0]PETSC ERROR: See docs/index.html for manual pages.
I* think this error is happening when I want to reset the vector and matrix
to zero before solving the Ax=b,*
*this is my code:*
*PetscScalar zero = 0.;*
*
*
*  // Reset J, R and Y*
*  cout<<"reset jacobian to zero"<<endl;*
*  MatZeroEntries(J_);*
*  cout<<"reset R to zero"<<endl;*
*  VecSet(R_, zero);*
*  cout<<"reset Y to zero"<<endl;*
*  VecSet(Y_, zero);*
*
*
*Is anyone have some clue to solve this problem.*
*
*
*Thanks,*
*
*
*Nan*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20100907/c20a1d08/attachment.htm>


More information about the petsc-users mailing list