discretize.MeshIO.TensorMeshIO

class discretize.MeshIO.TensorMeshIO[source]

Bases: discretize.mixins.vtkModule.vtkTensorRead

Attributes

Methods

TensorMeshIO.readModelUBC(fileName, directory='')[source]
Read UBC 2D or 3D Tensor mesh model
and generate Tensor mesh model

Input: :param str fileName: path to the UBC GIF mesh file to read or just its name if directory is specified :param str directory: directory where the UBC GIF file lives

Output: :rtype: numpy.ndarray :return: model with TensorMesh ordered

classmethod TensorMeshIO.readUBC(fileName, directory='')[source]

Wrapper to Read UBC GIF 2D and 3D tensor mesh and generate same dimension TensorMesh.

Input: :param str fileName: path to the UBC GIF mesh file or just its name if directory is specified :param str directory: directory where the UBC GIF file lives

Output: :rtype: TensorMesh :return: The tensor mesh for the fileName.

classmethod TensorMeshIO.readVTK(fileName, directory='')

Read VTK Rectilinear (vtr xml file) and return Tensor mesh and model

Parameters:
  • fileName (str) – path to the vtr model file to read or just its name if directory is specified
  • directory (str) – directory where the UBC GIF file lives
Returns:

(TensorMesh, modelDictionary)

Return type:

tuple

TensorMeshIO.writeModelUBC(fileName, model, directory='')[source]

Writes a model associated with a TensorMesh to a UBC-GIF format model file.

Input: :param str fileName: File to write to or just its name if directory is specified :param str directory: directory where the UBC GIF file lives :param numpy.ndarray model: The model

TensorMeshIO.writeUBC(fileName, models=None, directory='', comment_lines='')[source]

Writes a TensorMesh to a UBC-GIF format mesh file.

Input: :param str fileName: File to write to :param str directory: directory where to save model :param dict models: A dictionary of the models :param str comment_lines: comment lines preceded with ‘!’ to add