[petsc-users] (no subject)

Mark Adams mfadams at lbl.gov
Wed Aug 6 11:00:37 CDT 2014


I am moving my code to have the DM create the matrix and am hitting this
error in DMGetLocalToGlobalMapping:

if (!dm->ops->getlocaltoglobalmapping)
SETERRQ(PetscObjectComm((PetscObject)dm),PETSC_ERR_SUP,"DM can not create
LocalToGlobalMapping");

This happens when I create the matrix like this:

  call DMCompositeCreate(comm,solver%da,ierr)
  call DMSetOptionsPrefix(solver%da,'fsa_',ierr)
  call DMCompositeAddDM(solver%da,solver%daphi,ierr)
  call DMCompositeAddDM(solver%da,solver%dalam,ierr)
  call DMSetFromOptions(solver%da,ierr)
  call DMCreateMatrix(solver%da,solver%KKTmat,ierr)

I am using DMShell and create them like so:

  ! phi DM
  call VecCreate(comm,x1Vec,ierr)
  call VecSetSizes(x1Vec,N1loc,N1Glob,ierr)
  call VecSetFromOptions(x1Vec,ierr)

  call DMShellCreate(comm,solver%daphi,ierr)
  call DMShellSetGlobalVector(solver%daphi,x1Vec,ierr)
  call DMShellSetMatrix(solver%daphi,solver%A0Mat,ierr)
  call VecDestroy(x1Vec,ierr)
  call DMSetOptionsPrefix(solver%daphi,'phi_',ierr)
  call DMSetFromOptions(solver%daphi,ierr)

  call VecCreate(PETSC_COMM_SELF,x1Vecloc,ierr)
  call VecSetSizes(x1Vecloc,N1loc,N1loc,ierr)
  call VecSetFromOptions(x1Vecloc,ierr)
  call DMShellSetLocalVector(solver%daphi,x1Vecloc,ierr)
  call VecDestroy(x1Vecloc,ierr)

All the examples that I see use DMDAs.  I am able to create a global vector
with this DM.

Any ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140806/78020503/attachment.html>


More information about the petsc-users mailing list