3
5Ad]D  ã               @   s4   d Z ddlmZ ddlmZ ddlmZ dd„ ZdS )z.Some miscellaneous convenience functionality.
é    )Úsplitext)Útvtk)Úconfigure_input_datac             K   sä   d| j j }t| tjƒs t|ƒ‚dtjfdtjfdtjfdtj	fdtj
fdœ}x |D ]}| j|ƒrT|| }P qTW t|ƒd }|d	kr’|}|d }	n*t|ƒd
kr²||d
  }tj}	n
|}tj}	|	f d|i|—Ž}
t|
| ƒ |
jƒ  dS )aÝ  Given a TVTK `dataset` this writes the `dataset` to a VTK XML
    file having file name `fname`.

    If the given file name has no extension, one is automatically picked
    based on the dataset and an XML file is written out.  If the
    filename has a '.vtk' extension an old style VTK file is written.
    If any other extension is specified, an XML file is written out with
    the given extension.

    Any additional keyword arguments are passed to the writer used.
    z5Can only write tvtk.DataSet instances 'got %s insteadz.vtiz.vtrz.vtsz.vtpz.vtu)ÚvtkImageDataÚvtkRectilinearGridÚvtkStructuredGridÚvtkPolyDataÚvtkUnstructuredGridé   z.vtkr   Ú	file_nameN)Ú	__class__Ú__name__Ú
isinstancer   ZDataSetÚAssertionErrorZStructuredPointsWriterZRectilinearGridWriterZStructuredGridWriterZPolyDataWriterZUnstructuredGridWriterZis_ar   ÚlenZXMLDataSetWriterr   Úwrite)ZdatasetÚfnameÚkwargsÚerr_msgZd2rÚtypeÚdatatypeÚextr   ÚwriterÚw© r   úp/home/yuhw/wc/wire-cell-python/wcpy/lib/python3.6/site-packages/mayavi-4.7.1-py3.6-linux-x86_64.egg/tvtk/misc.pyÚ
write_data   s0    




r   N)Ú__doc__Úos.pathr   Ztvtk.tvtk_accessr   Ztvtk.commonr   r   r   r   r   r   Ú<module>   s   