#NEWLINE# @ staticmethod #NEWLINE# def load( filename , network = None ) : #NEWLINE# #INDENT# '\n        Read in pore and throat data from a saved VTK file.\n\n        Parameters\n        ----------\n        filename : string (optional)\n            The name of the file containing the data to import.  The formatting\n            of this file is outlined below.\n\n        network : OpenPNM Network Object\n            The Network object onto which the data should be loaded.  If no\n            Network is supplied than one will be created and returned.\n\n        Returns\n        -------\n        If no Network object is supplied then one will be created and returned.\n        ' #NEWLINE# net = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# filename = filename . rsplit ( '.' , maxsplit = 1 ) [ 0 ] #NEWLINE# tree = _ET . parse ( ( filename + '.vtp' ) ) #NEWLINE# piece_node = tree . find ( 'PolyData' ) . find ( 'Piece' ) #NEWLINE# conn_element = piece_node . find ( 'Lines' ) . find ( 'DataArray' ) #NEWLINE# array = VTK . _element_to_array ( conn_element , 2 ) #NEWLINE# net . update ( { #NEWLINE# #INDENT# 'throat.conns' : array , #NEWLINE# #UNINDENT# } ) #NEWLINE# coord_element = piece_node . find ( 'Points' ) . find ( 'DataArray' ) #NEWLINE# array = VTK . _element_to_array ( coord_element , 3 ) #NEWLINE# net . update ( { #NEWLINE# #INDENT# 'pore.coords' : array , #NEWLINE# #UNINDENT# } ) #NEWLINE# for item in piece_node . find ( 'PointData' ) . iter ( 'DataArray' ) : #NEWLINE# #INDENT# key = item . get ( 'Name' ) #NEWLINE# element = key . split ( '.' ) [ 0 ] #NEWLINE# array = VTK . _element_to_array ( item ) #NEWLINE# propname = key . split ( '.' ) [ 1 ] #NEWLINE# net . update ( { #NEWLINE# #INDENT# ( ( element + '.' ) + propname ) : array , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# for item in piece_node . find ( 'CellData' ) . iter ( 'DataArray' ) : #NEWLINE# #INDENT# key = item . get ( 'Name' ) #NEWLINE# element = key . split ( '.' ) [ 0 ] #NEWLINE# array = VTK . _element_to_array ( item ) #NEWLINE# propname = key . split ( '.' ) [ 1 ] #NEWLINE# net . update ( { #NEWLINE# #INDENT# ( ( element + '.' ) + propname ) : array , #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# if ( network is None ) : #NEWLINE# #INDENT# network = OpenPNM . Network . GenericNetwork ( ) #NEWLINE# #UNINDENT# network = _update_network ( network = network , net = net ) #NEWLINE# return network