VecSetValue
    Yixun Liu 
    enjoywm at cs.wm.edu
       
    Fri Feb 27 18:45:29 CST 2009
    
    
  
Hi,
  VecCreate(PETSC_COMM_WORLD,&solutionDisplacementVector);
  VecSetSizes(solutionDisplacementVector, 3*numOfVerticesOfOneProcessor,
systemSize); //in this case 3*numOfVerticesOfOneProcessor==systemSize
  VecSetFromOptions(solutionDisplacementVector);
 VecDuplicate(solutionDisplacementVector, &weightedDisplacementVector);
for(i = 0; i < systemSize; i++)
{
output weightedRealDisplacement[i] to file//with this code the values in
weightedDisplacementVector are correct.
...
VecSetValue(weightedDisplacementVector, i, weightedRealDisplacement[i],
ADD_VALUES);
...
}
VecAssemblyBegin(weightedDisplacementVector);
 VecAssemblyEnd(weightedDisplacementVector);
output weightedDisplacementVector to file to see its values
For simplicity I only use one processor. As I examine the values in
weightedDisplacementVector and I found if  I add the output code in the
for loop the values in weightedDisplacementVector are correct. Without
it there is error.
Thanks.
Yixun
    
    
More information about the petsc-users
mailing list