[petsc-dev] preallocation checks

Satish Balay balay at mcs.anl.gov
Fri Jan 20 10:36:01 CST 2012


On Fri, 20 Jan 2012, Matthew Knepley wrote:

> On Fri, Jan 20, 2012 at 10:25 AM, Stefano Zampini <stefano.zampini at gmail.com
> > wrote:
> 
> > I pulled the latest tip and recompiling my application I got this error
> > when converting from SEQDENSE to SEQAIJ
> >
> > [0]PETSC ERROR:
> > ------------------------------------------------------------------------
> > [0]PETSC ERROR: MatSetValues_SeqAIJ() line 331 in
> > src/mat/impls/aij/seq/aij.c
> > [0]PETSC ERROR: MatSetValues() line 1119 in src/mat/interface/matrix.c
> > [0]PETSC ERROR: MatConvert_Basic() line 37 in src/mat/utils/convert.c
> > [0]PETSC ERROR: MatConvert() line 3859 in src/mat/interface/matrix.c
> >
> > Is there a way to disable from command line new nonzeros errors?
> 
> 
> This is not the whole error. It looks like this is a problem with

that was for MatView().

Try the attached patch - and if it works - I'll push to petsc-dev

cd petsc-dev
patch -Np1 < matconvert.patch

Satish
-------------- next part --------------
diff --git a/src/mat/interface/matrix.c b/src/mat/interface/matrix.c
--- a/src/mat/interface/matrix.c
+++ b/src/mat/interface/matrix.c
@@ -3781,6 +3781,7 @@
   if (!mat->assembled) SETERRQ(((PetscObject)mat)->comm,PETSC_ERR_ARG_WRONGSTATE,"Not for unassembled matrix");
   if (mat->factortype) SETERRQ(((PetscObject)mat)->comm,PETSC_ERR_ARG_WRONGSTATE,"Not for factored matrix"); 
   ierr = MatPreallocated(mat);CHKERRQ(ierr);
+  ierr = MatSetOption(mat,MAT_NEW_NONZERO_LOCATION_ERR,PETSC_FALSE);CHKERRQ(ierr);
 
   ierr = PetscOptionsGetString(((PetscObject)mat)->prefix,"-matconvert_type",mtype,256,&flg);CHKERRQ(ierr);
   if (flg) {


More information about the petsc-dev mailing list