Tensor Mesh

UBC Tensor Mesh Appender

class PVGeo.ubc.tensor.TensorMeshAppender(**kwargs)[source]

Bases: PVGeo.ubc.two_file_base.ModelAppenderBase

This filter reads a timeseries of models and appends it to an input vtkRectilinearGrid

_PlaceOnMesh(output, idx=0)[source]
_ReadUpFront()[source]

UBC Tensor Mesh Reader

class PVGeo.ubc.tensor.TensorMeshReader(nOutputPorts=1, outputType='vtkRectilinearGrid', **kwargs)[source]

Bases: PVGeo.ubc.two_file_base.ubcMeshReaderBase

UBC Mesh 2D/3D models are defined using a 2-file format. The “mesh” file describes how the data is discretized. The “model” file lists the physical property values for all cells in a mesh. A model file is meaningless without an associated mesh file. The reader will automatically detect if the mesh is 2D or 3D and read the remainder of the data with that dimensionality assumption. If the mesh file is 2D, then then model file must also be in the 2D format (same for 3D).

Note

Model File is optional. Reader will still construct vtkRectilinearGrid safely.

ClearMesh()[source]

Use to clean/rebuild the mesh

ClearModels()[source]

Use to clean the models and reread

static PlaceModelOnMesh(mesh, model, dataNm='Data')[source]

Places model data onto a mesh. This is for the UBC Grid data reaers to associate model data with the mesh grid.

Parameters:
  • mesh (vtkRectilinearGrid) – The vtkRectilinearGrid that is the mesh to place the model data upon.
  • model (np.array) – A NumPy float array that holds all of the data to place inside of the mesh’s cells.
  • dataNm (str) – The name of the model data array once placed on the vtkRectilinearGrid.
Returns:

Returns the input vtkRectilinearGrid with model data appended.

Return type:

vtkRectilinearGrid

RequestData(request, inInfo, outInfo)[source]

Handles data request by the pipeline.

RequestInformation(request, inInfo, outInfo)[source]

Handles info request by pipeline about timesteps and grid extents.

_TensorMeshReader__ubcMeshData2D(FileName_Mesh, FileName_Models, output)

Helper method to read a 2D mesh

_TensorMeshReader__ubcMeshData3D(FileName_Mesh, FileName_Models, output)

Helper method to read a 3D mesh

_TensorMeshReader__ubcTensorMesh(FileName_Mesh, FileName_Models, output)

Wrapper to Read UBC GIF 2D and 3D meshes. UBC Mesh 2D/3D models are defined using a 2-file format. The “mesh” file describes how the data is descritized. The “model” file lists the physical property values for all cells in a mesh. A model file is meaningless without an associated mesh file. If the mesh file is 2D, then then model file must also be in the 2D format (same for 3D).

Parameters:
  • FileName_Mesh (str) – The mesh filename as an absolute path for the input mesh file in UBC 2D/3D Mesh Format
  • FileName_Models (str or list(str)) – The model filename(s) as an absolute path for the input model file in UBC 2D/3D Model Format.
  • output (vtkRectilinearGrid) – The output data object
Returns:

Returns a vtkRectilinearGrid generated from the UBC 2D/3D Mesh grid. Mesh is defined by the input mesh file. Cell data is defined by the input model file.

Return type:

vtkRectilinearGrid

static ubcMesh2D(FileName, output)[source]

This method reads a UBC 2D Mesh file and builds an empty vtkRectilinearGrid for data to be inserted into. Format Specs.

Parameters:
  • FileName (str) – The mesh filename as an absolute path for the input mesh file in UBC 3D Mesh Format.
  • output (vtkRectilinearGrid) – The output data object
Returns:

a vtkRectilinearGrid generated from the UBC 3D Mesh grid. Mesh is defined by the input mesh file. No data attributes here, simply an empty mesh. Use the PlaceModelOnMesh() method to associate with model data.

Return type:

vtkRectilinearGrid

static ubcMesh3D(FileName, output)[source]

This method reads a UBC 3D Mesh file and builds an empty vtkRectilinearGrid for data to be inserted into.

Parameters:
  • FileName (str) – The mesh filename as an absolute path for the input mesh file in UBC 3D Mesh Format.
  • output (vtkRectilinearGrid) – The output data object
Returns:

a vtkRectilinearGrid generated from the UBC 3D Mesh grid. Mesh is defined by the input mesh file. No data attributes here, simply an empty mesh. Use the PlaceModelOnMesh() method to associate with model data.

Return type:

vtkRectilinearGrid

static ubcModel2D(FileName)[source]

Reads a 2D model file and returns a 1D NumPy float array. Use the PlaceModelOnMesh() method to associate with a grid.

Parameters:FileName (str) – The model filename as an absolute path for the input model file in UBCMesh Model Format. Also accepts a list of string file names.
Returns:a NumPy float array that holds the model data read from the file. Use the PlaceModelOnMesh() method to associate with a grid. If a list of file names is given then it will return a dictionary of NumPy float array with keys as the basenames of the files.
Return type:np.array

Note

Only supports single component data