def from_file(filename=None, io='auto', prefix_dir=None,
                  omit_facets=False):
        """
        Read a mesh from a file.

        Parameters
        ----------
        filename : string or function or MeshIO instance or Mesh instance
            The name of file to read the mesh from. For convenience, a
            mesh creation function or a MeshIO instance or directly a Mesh
            instance can be passed in place of the file name.
        io : *MeshIO instance
            Passing *MeshIO instance has precedence over filename.
        prefix_dir : str
            If not None, the filename is relative to that directory.
        omit_facets : bool
            If True, do not read cells of lower dimension than the space
            dimension (faces and/or edges). Only some MeshIO subclasses
            support this!
        """
        if isinstance(filename, Mesh):
            return filename

        if io == 'auto':
            if filename is None:
                output( 'filename or io must be specified!' )
                raise ValueError
            else:
                io = MeshIO.any_from_filename(filename, prefix_dir=prefix_dir)

        output('reading mesh (%s)...' % (io.filename))
        tt = time.clock()

        trunk = io.get_filename_trunk()
        mesh = Mesh(trunk)
        mesh = io.read(mesh, omit_facets=omit_facets)

        output('...done in %.2f s' % (time.clock() - tt))

        mesh._set_shape_info()

        return mesh
def from_file ( filename = None , io = 'auto' , prefix_dir = None , omit_facets = False ) : if isinstance ( filename , Mesh ) : return filename if io == 'auto' : if filename is None : output ( 'filename or io must be specified!' ) raise ValueError else : io = MeshIO . any_from_filename ( filename , prefix_dir = prefix_dir ) output ( 'reading mesh (%s)...' % ( io . filename ) ) tt = time . clock ( ) trunk = io . get_filename_trunk ( ) mesh = Mesh ( trunk ) mesh = io . read ( mesh , omit_facets = omit_facets ) output ( '...done in %.2f s' % ( time . clock ( ) - tt ) ) mesh . _set_shape_info ( ) return mesh
Read a mesh from a file.

        Parameters
        ----------
        filename : string or function or MeshIO instance or Mesh instance
            The name of file to read the mesh from. For convenience, a
            mesh creation function or a MeshIO instance or directly a Mesh
            instance can be passed in place of the file name.
        io : *MeshIO instance
            Passing *MeshIO instance has precedence over filename.
        prefix_dir : str
            If not None, the filename is relative to that directory.
        omit_facets : bool
            If True, do not read cells of lower dimension than the space
            dimension (faces and/or edges). Only some MeshIO subclasses
            support this!