Пример #1
0
    def __init__(self, name, mode=FILE_UPDATE):

        self.mode = mode
        self._time = None
        self._tidx = -1

        import os
        exists = os.path.exists(name + '.h5')
        if self.mode == FILE_READ and not exists:
            raise IOError(
                "File '%s' does not exist, cannot be opened for reading" %
                name)
        mode = self.mode
        if mode == FILE_UPDATE and not exists:
            mode = FILE_CREATE
        self.viewer = PETSc.ViewerHDF5().create(name + '.h5',
                                                mode=mode,
                                                comm=PETSc.COMM_WORLD)

        self.h5file = h5i.get_h5py_file(self.viewer)
Пример #2
0
 def h5file(self):
     """An h5py File object pointing at the open file handle."""
     if hasattr(self, '_h5file'):
         return self._h5file
     self._h5file = h5i.get_h5py_file(self.vwr)
     return self._h5file
Пример #3
0
 def h5file(self):
     """An h5py File object pointing at the open file handle."""
     if hasattr(self, '_h5file'):
         return self._h5file
     self._h5file = h5i.get_h5py_file(self.vwr)
     return self._h5file