PetscErrorCode PCSetUp(PC pc) { PetscErrorCode ierr; const char *def;
PetscFunctionBegin; PetscValidHeaderSpecific(pc,PC_CLASSID,1); if (!pc->mat) SETERRQ(((PetscObject)pc)->comm,PETSC_ERR_ARG_WRONGSTATE,"Matrix must be set first"); How can it be in there without a Mat? The Mat must be set before PCSetUp(). Barry On May 6, 2012, at 12:29 PM, Jed Brown wrote: > With the now-recommended approach of SNESSetDM(), a matrix is no longer > available for PCGetDefaultType_Private(), so stuff like this fails: > > ~/petsc/src/snes/examples/tutorials$ ./ex5 -dm_mat_type sbaij > [0]PETSC ERROR: --------------------- Error Message > ------------------------------------ > [0]PETSC ERROR: No support for this operation for this object type! > [0]PETSC ERROR: Factor type not supported! > [0]PETSC ERROR: > ------------------------------------------------------------------------ > [0]PETSC ERROR: Petsc Development HG revision: > fb0b659c7d3475598a50a3736d056cce163b2de9 HG Date: Sun Apr 15 00:02:43 2012 > +0000 > [0]PETSC ERROR: See docs/changes/index.html for recent updates. > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting. > [0]PETSC ERROR: See docs/index.html for manual pages. > [0]PETSC ERROR: > ------------------------------------------------------------------------ > [0]PETSC ERROR: ./ex5 on a mpich named batura by jed Sun May 6 11:25:55 2012 > [0]PETSC ERROR: Libraries linked from /home/jed/petsc/mpich/lib > [0]PETSC ERROR: Configure run at Tue Apr 17 15:54:40 2012 > [0]PETSC ERROR: Configure options --download-ams --download-blacs > --download-chaco --download-hypre --download-metis --download-ml > --download-parmetis --download-spai --download-spooles --download-sundials > --download-superlu --download-superlu_dist --download-triangle > --with-blas-lapack=/usr --with-c2html --with-cholmod-dir=/usr --with-lgrind > --with-mpi-dir=/opt/mpich2 --with-pcbddc --with-pthreadclasses > --with-shared-libraries --with-single-library=0 --with-sowing > --with-umfpack-dir=/usr --with-x -PETSC_ARCH=mpich > [0]PETSC ERROR: > ------------------------------------------------------------------------ > [0]PETSC ERROR: MatGetFactor_seqsbaij_petsc() line 1817 in > /home/jed/petsc/src/mat/impls/sbaij/seq/sbaij.c > [0]PETSC ERROR: MatGetFactor() line 3990 in > /home/jed/petsc/src/mat/interface/matrix.c > [0]PETSC ERROR: PCSetUp_ILU() line 214 in > /home/jed/petsc/src/ksp/pc/impls/factor/ilu/ilu.c > [0]PETSC ERROR: PCSetUp() line 832 in > /home/jed/petsc/src/ksp/pc/interface/precon.c > [0]PETSC ERROR: KSPSetUp() line 278 in > /home/jed/petsc/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: KSPSolve() line 402 in > /home/jed/petsc/src/ksp/ksp/interface/itfunc.c > [0]PETSC ERROR: SNES_KSPSolve() line 4224 in > /home/jed/petsc/src/snes/interface/snes.c > [0]PETSC ERROR: SNESSolve_LS() line 200 in > /home/jed/petsc/src/snes/impls/ls/ls.c > [0]PETSC ERROR: SNESSolve() line 3442 in > /home/jed/petsc/src/snes/interface/snes.c > [0]PETSC ERROR: main() line 152 in src/snes/examples/tutorials/ex5.c > application called MPI_Abort(MPI_COMM_WORLD, 56) - process 0 > > What are the alternatives to moving matrix creation (via DM) all the way up > here?