VecSetValue(ignore last one)

Yixun Liu enjoywm at cs.wm.edu
Fri Feb 27 20:00:43 CST 2009


Hi,
I made a mistake in previous email. Please ignore the last one.

  VecCreate(PETSC_COMM_WORLD,&solutionDisplacementVector);

  VecSetSizes(solutionDisplacementVector, 3*numOfVerticesOfOneProcessor,
systemSize); //in this case 3*numOfVerticesOfOneProcessor==systemSize
  VecSetFromOptions(solutionDisplacementVector);


 VecDuplicate(solutionDisplacementVector, &weightedDisplacementVector);


for(k=0; k<systemSize;k++)
{


i = func();

output weightedRealDisplacement[i] to file//with this code the values in weightedDisplacementVector are correct.

...
VecSetValue(weightedDisplacementVector, i, weightedRealDisplacement[i], ADD_VALUES);// in different iteration i maybe same.
...

}

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 are some errors.


Thanks.

Yixun




More information about the petsc-users mailing list