discretize.MeshIO.TensorMeshIO

class discretize.MeshIO.TensorMeshIO[source]

Bases: discretize.mixins.vtkModule.InterfaceTensorread_vtk

Methods

readModelUBC(fileName[, directory])

Read UBC 2D or 3D Tensor mesh model

readUBC(fileName[, directory])

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

readVTK(filename[, directory])

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

read_vtk(filename[, directory])

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

vtk_to_tensor_mesh(vtrGrid)

Converts a vtkRectilinearGrid or pyvista.RectilinearGrid to a discretize.TensorMesh object.

writeModelUBC(fileName, model[, directory])

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

writeUBC(fileName[, models, directory, …])

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

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
filenamestr

path to the vtr model file to read or just its name if directory is specified

directorystr

directory where the UBC GIF file lives

Returns
tuple

(TensorMesh, modelDictionary)

classmethod TensorMeshIO.read_vtk(filename, directory='')

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

Parameters
filenamestr

path to the vtr model file to read or just its name if directory is specified

directorystr

directory where the UBC GIF file lives

Returns
tuple

(TensorMesh, modelDictionary)

classmethod TensorMeshIO.vtk_to_tensor_mesh(vtrGrid)

Converts a vtkRectilinearGrid or pyvista.RectilinearGrid to a discretize.TensorMesh object.

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