I use VecSetValue in a loop and if I add some codes such as IO before the VecSetValue the output of the vector is correct. However if I remove the IO the output is wrong. It seems that the values are cached and need some time to be set.
Matthew Knepley wrote: > I cannot understand your question. > > Matt > > On Fri, Feb 27, 2009 at 6:45 PM, Yixun Liu <enjoywm at cs.wm.edu > <mailto:enjoywm at cs.wm.edu>> wrote: > > 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 > > > > > -- > What most experimenters take for granted before they begin their > experiments is infinitely more interesting than any results to which > their experiments lead. > -- Norbert Wiener
