Commits

Jed Brown committed f1d1c62 Merge

Merge branch 'barry/fix-viewer-format-secret-change' of bitbucket:petsc/petsc

* 'barry/fix-viewer-format-secret-change' of bitbucket:petsc/petsc:
PetscViewerCreate_XXX() and PetscViewerFileSetName_XXX() should not change format or iformat

  • Participants
  • Parent commits 370e775, 23a2479

Comments (0)

Files changed (7)

include/petsc-private/viewerimpl.h

 struct _p_PetscViewer {
   PETSCHEADER(struct _PetscViewerOps);
   PetscViewerFormat format,formats[10];
-  int               iformat;
+  int               iformat;   /* number of formats that have been pushed on formats[] stack */
   void              *data;
 };
 

src/sys/classes/viewer/impls/ascii/filev.c

   vascii->sviewer = *outviewer;
 
   (*outviewer)->format  = viewer->format;
-  (*outviewer)->iformat = viewer->iformat;
 
   ierr = PetscObjectGetName((PetscObject)viewer,&name);CHKERRQ(ierr);
   ierr = PetscObjectSetName((PetscObject)(*outviewer),name);CHKERRQ(ierr);
   vascii->sviewer = *outviewer;
 
   (*outviewer)->format  = viewer->format;
-  (*outviewer)->iformat = viewer->iformat;
 
   ierr = PetscObjectGetName((PetscObject)viewer,&name);CHKERRQ(ierr);
   ierr = PetscObjectSetName((PetscObject)(*outviewer),name);CHKERRQ(ierr);
   vascii->mode      = FILE_MODE_WRITE;
   vascii->bviewer   = 0;
   vascii->sviewer   = 0;
-  viewer->format    = PETSC_VIEWER_DEFAULT;
-  viewer->iformat   = 0;
   vascii->tab       = 0;
   vascii->tab_store = 0;
   vascii->filename  = 0;

src/sys/classes/viewer/impls/binary/binv.c

     } else if (fname) SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ARG_OUTOFRANGE,"Unknown file type");
 #endif
   } else vbinary->fdes = -1;
-  viewer->format = PETSC_VIEWER_NOFORMAT;
 
   /*
       try to open info file: all processors open this file if read only
   } else if (type == FILE_MODE_WRITE) {
     MPI_File_open(PetscObjectComm((PetscObject)viewer),vbinary->filename,MPI_MODE_WRONLY | MPI_MODE_CREATE,MPI_INFO_NULL,&vbinary->mfdes);CHKERRQ(ierr);
   }
-  viewer->format = PETSC_VIEWER_NOFORMAT;
 
   /*
       try to open info file: all processors open this file if read only
   v->ops->destroy          = PetscViewerDestroy_Binary;
   v->ops->view             = PetscViewerView_Binary;
   v->ops->flush            = 0;
-  v->iformat               = 0;
   vbinary->fdes_info       = 0;
   vbinary->fdes            = 0;
   vbinary->skipinfo        = PETSC_FALSE;

src/sys/classes/viewer/impls/draw/drawv.c

   viewer->ops->setfromoptions   = PetscViewerSetFromOptions_Draw;
   viewer->ops->getsingleton     = PetscViewerGetSingleton_Draw;
   viewer->ops->restoresingleton = PetscViewerRestoreSingleton_Draw;
-  viewer->format                = PETSC_VIEWER_NOFORMAT;
 
   /* these are created on the fly if requested */
   vdraw->draw_max  = 5;

src/sys/classes/viewer/impls/hdf5/hdf5v.c

     SETERRQ(PETSC_COMM_SELF,PETSC_ERR_ORDER, "Must call PetscViewerFileSetMode() before PetscViewerFileSetName()");
   }
   if (hdf5->file_id < 0) SETERRQ1(PETSC_COMM_SELF,PETSC_ERR_LIB, "H5Fcreate failed for %s", name);
-  viewer->format = PETSC_VIEWER_NOFORMAT;
   H5Pclose(plist_id);
   PetscFunctionReturn(0);
 }
   v->data         = (void*) hdf5;
   v->ops->destroy = PetscViewerDestroy_HDF5;
   v->ops->flush   = 0;
-  v->iformat      = 0;
   hdf5->btype     = (PetscFileMode) -1;
   hdf5->filename  = 0;
   hdf5->timestep  = -1;

src/sys/classes/viewer/impls/vtk/vtkv.c

   v->data         = (void*)vtk;
   v->ops->destroy = PetscViewerDestroy_VTK;
   v->ops->flush   = PetscViewerFlush_VTK;
-  v->iformat      = 0;
   vtk->btype      = (PetscFileMode) -1;
   vtk->filename   = 0;
 

src/sys/classes/viewer/impls/vu/petscvu.c

   viewer->ops->flush            = PetscViewerFlush_VU;
   viewer->ops->getsingleton     = NULL;
   viewer->ops->restoresingleton = NULL;
-  viewer->format                = PETSC_VIEWER_DEFAULT;
-  viewer->iformat               = 0;
 
   vu->fd          = NULL;
   vu->mode        = FILE_MODE_WRITE;