Unvhandler

Derived module from filehandler.py to handle Universal (unv) files.

Warning

This module will be deprecated in next releases. Follow updates on https://github.com/mathLab for news about file handling.

class UnvHandler[source]

Bases: pygem.filehandler.FileHandler

Universal 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 [‘.unv’].

parse(filename)[source]

Method to parse the file filename. It returns a matrix with all the coordinates. It reads only the section 2411 of the unv files and it assumes there are only triangles.

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

numpy.ndarray

write(mesh_points, filename)[source]

Writes a unv file, called filename, copying all the lines from self.filename but the coordinates. mesh_points is a matrix that contains the new coordinates to write in the unv 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.