Vtkhandler¶
Derived module from filehandler.py to handle vtk files.
Warning
This module will be deprecated in next releases. Follow updates on https://github.com/mathLab for news about file handling.
- class VtkHandler[source]
Bases:
pygem.filehandler.FileHandler
Vtk file handler class
- Variables
infile (string) – name of the input file to be processed.
outfile (string) – name of the output file where to write in.
extensions (list) – extensions of the input/output files. It is equal to [‘.vtk’].
- parse(filename)[source]
Method to parse the file filename. It returns a matrix with all the coordinates.
- Parameters
filename (string) – name of the input file.
- Returns
mesh_points: it is a n_points-by-3 matrix containing the coordinates of the points of the mesh
- Return type
Todo
specify when it works
- write(mesh_points, filename)[source]
Writes a vtk file, called filename, copying all the structures from self.filename but the coordinates. mesh_points is a matrix that contains the new coordinates to write in the vtk file.
- Parameters
mesh_points (numpy.ndarray) – it is a n_points-by-3 matrix containing the coordinates of the points of the mesh
filename (string) – name of the output file.
- plot(plot_file=None, save_fig=False)[source]
Method to plot a vtk file. If plot_file is not given it plots self.infile.
- Parameters
plot_file (string) – the vtk filename you want to plot.
save_fig (bool) – a flag to save the figure in png or not. If True the plot is not shown.
- Returns
figure: matlplotlib structure for the figure of the chosen geometry
- Return type
matplotlib.pyplot.figure
- show(show_file=None)[source]
Method to show a vtk file. If show_file is not given it shows self.infile.
- Parameters
show_file (string) – the vtk filename you want to show.