[petsc-users] Error in VecAssemeblyBegin after VecView

Johannes.Huber at unibas.ch Johannes.Huber at unibas.ch
Tue Jan 3 04:11:23 CST 2012


Hi all,
I have the following code snippet:

     {
       static int iCall(0);
       Vec v = m_State->vec();  // Get the Petsc vector from a libmesh  
PetscVector
       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

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?
Thanks in advance,
     Hannes

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.




More information about the petsc-users mailing list