[petsc-dev] Zero sized VecSetValues

Pierre Jolivet jolivet at ann.jussieu.fr
Fri Dec 12 11:47:58 CST 2014


Hello,
Taking 
http://www.mcs.anl.gov/petsc/petsc-current/src/vec/vec/examples/tutorials/ex2.c.html 
and changing its 56th line from
VecSetValues(x,1,&i,&one,ADD_VALUES);
to
VecSetValues(x,0,NULL,NULL,ADD_VALUES);
yield the following error (at least --with-debug=1):
[0]PETSC ERROR: --------------------- Error Message 
--------------------------------------------------------------
[0]PETSC ERROR: Invalid pointer
[0]PETSC ERROR: Null Pointer: Parameter # 3

What is the rationale behind first checking the pointers, then doing the 
work or lack thereof, instead of, first checking if there is some work 
to do, and only then check the pointers (à la MPI) ?

Thank you for your help,
Pierre



More information about the petsc-dev mailing list