def __init__(self, filepath, ftype, largeFile=False): """ PARAMETERS: filepath: filename without extension. ftype: file type, e.g. VtkImageData, etc. largeFile: If size of the stored data cannot be represented by a UInt32. """ self.ftype = ftype self.filename = filepath + ftype.ext self.xml = XmlWriter(self.filename) self.offset = 0 # offset in bytes after beginning of binary section self.appendedDataIsOpen = False self.largeFile = largeFile if largeFile == False: self.xml.openElement("VTKFile").addAttributes(type=ftype.name, version="0.1", byte_order=_get_byte_order()) else: print "WARNING: output file only compatible with VTK 6.0 and later." self.xml.openElement("VTKFile").addAttributes(type=ftype.name, version="1.0", byte_order=_get_byte_order( ), header_type="UInt64")
def __init__(self, filepath): """ Creates a VtkGroup file that is stored in filepath. PARAMETERS: filepath: filename without extension. """ self.xml = XmlWriter(filepath + ".pvd") self.xml.openElement("VTKFile") self.xml.addAttributes( type="Collection", version="0.1", byte_order=_get_byte_order()) self.xml.openElement("Collection") self.root = os.path.dirname(filepath)