[petsc-users] Error in VecAssemeblyBegin after VecView
Jed Brown
jedbrown at mcs.anl.gov
Tue Jan 3 06:34:30 CST 2012
On Tue, Jan 3, 2012 at 04:11, <Johannes.Huber at unibas.ch> wrote:
> I have the following code snippet:
>
> {
> static int iCall(0);
> Vec v = m_State->vec(); // Get the Petsc vector from a libmesh
> PetscVector
>
The problem is earlier, where you call VecSetValues() with ADD_VALUES in
one place and with INSERT_VALUES in another place, perhaps through
overloaded operators.
> VecAssemblyBegin(v);
> VecAssemblyEnd(v);
> // Assembly works fine
> PetscViewer File;
> PetscViewerCreate(MPI_COMM_**WORLD,&File);
> char Filename[32];
> sprintf(Filename,"State_%03d.**m",iCall++);
> PetscViewerASCIIOpen(MPI_COMM_**WORLD,Filename,&File);
> PetscViewerSetFormat(File,**PETSC_VIEWER_ASCII_MATLAB);
> VecView(v,File);
> PetscViewerDestroy(&File);
> // File is created and looks good
> VecAssemblyBegin(v); // Here it crashes
> VecAssemblyEnd(v);
> }
>
> When running this code on two processes, I receive the error message:
> [1]PETSC ERROR: VecAssemblyBegin_MPI() line 1010 in
> src/vec/vec/impls/mpi/pdvec.c
> [1]PETSC ERROR: VecAssemblyBegin() line 219 in
> src/vec/vec/interface/vector.c
>
Is this the *whole* error message? It should have printed quite a bit more
than just this.
>
> Taking a look in the mentioned file there is the following code:
> ierr = MPI_Allreduce(&xin->stash.**insertmode,&addv,1,MPI_INT,**
> MPI_BOR,comm);CHKERRQ(ierr);
> if (addv == (ADD_VALUES|INSERT_VALUES)) SETERRQ(PETSC_COMM_SELF,PETSC_**ERR_ARG_NOTSAMETYPE,"Some
> processors inserted values while others added");
>
> What am I doing wrong?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20120103/a31c656c/attachment.htm>
More information about the petsc-users
mailing list