On Wed, Dec 21, 2016 at 9:53 PM, Mark Adams <[email protected]> wrote: > You have to add code to get dm_view to work apparently. > > I have done this before. This is some hocus pocus that Toby gave me. Is > this really the way? > > PetscViewer viewer = NULL; > PetscBool flg; > PetscViewerFormat fmt; > ierr = DMViewFromOptions(dm,NULL,"-dm_view");CHKERRQ(ierr); > ierr = PetscOptionsGetViewer(ctx->wComm,NULL,"-x2_vec_view",& > viewer,&fmt,&flg);CHKERRQ(ierr); > if (flg) { > ierr = PetscViewerPushFormat(viewer,fmt);CHKERRQ(ierr); > ierr = VecView(dmpi->phi,viewer);CHKERRQ(ierr); > ierr = VecView(dmpi->rho,viewer);CHKERRQ(ierr); > ierr = PetscViewerPopFormat(viewer);CHKERRQ(ierr); > } > ierr = PetscViewerDestroy(&viewer);CHKERRQ(ierr); >
I can't see why you need this. Did the other options not work? Matt > On Wed, Dec 21, 2016 at 2:16 PM, Barry Smith <[email protected]> wrote: > >> >> How about adding a least some documentation to bin/petsc_gen_xdmf.py >> >> >> > On Dec 21, 2016, at 1:14 PM, Matthew Knepley <[email protected]> wrote: >> > >> > On Wed, Dec 21, 2016 at 12:56 PM, Mark Adams <[email protected]> wrote: >> > I ran with: >> > >> > -snes_monitor_residual hdf5:res.h5 >> > -snes_monitor_solution hdf5:sol.h5 >> > >> > and got h5 files that look OK: >> > >> > That will stash vectors in the HDF5 file, but you still need to put in >> the DM as well >> > >> > -dm_view hdf5:ex1.h5 >> > -snes_monitor_residual hdf5:ex1.h5::append >> > -snes_monitor_solution hdf5:ex1.h5::append >> > >> > Matt >> > >> > -rw-r--r-- 1 markadams staff 19760 Dec 21 13:46 res.h5 >> > -rw-r--r-- 1 markadams staff 19760 Dec 21 13:46 sol.h5 >> > >> > but then got this. Am I doing this wrong? >> > >> > 13:46 multi-species *+> ~/Codes/landaufem/Plex$ >> ~/Codes/petsc/bin/petsc_gen_xdmf.py res.h5 >> > Traceback (most recent call last): >> > File "/Users/markadams/Codes/petsc/bin/petsc_gen_xdmf.py", line 241, >> in <module> >> > generateXdmf(f) >> > File "/Users/markadams/Codes/petsc/bin/petsc_gen_xdmf.py", line 211, >> in generateXdmf >> > geom = h5['geometry'] >> > File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper >> (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2405) >> > File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper >> (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2362) >> > File >> > "/Users/markadams/homebrew/lib/python2.7/site-packages/h5py/_hl/group.py", >> line 160, in __getitem__ >> > oid = h5o.open(self.id, self._e(name), lapl=self._lapl) >> > File "h5py/_objects.pyx", line 54, in h5py._objects.with_phil.wrapper >> (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2405) >> > File "h5py/_objects.pyx", line 55, in h5py._objects.with_phil.wrapper >> (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/_objects.c:2362) >> > File "h5py/h5o.pyx", line 190, in h5py.h5o.open >> (/Users/travis/build/MacPython/h5py-wheels/h5py/h5py/h5o.c:3456) >> > KeyError: "Unable to open object (Object 'geometry' doesn't exist)" >> > >> > >> > >> > -- >> > What most experimenters take for granted before they begin their >> experiments is infinitely more interesting than any results to which their >> experiments lead. >> > -- Norbert Wiener >> >> > -- What most experimenters take for granted before they begin their experiments is infinitely more interesting than any results to which their experiments lead. -- Norbert Wiener
