OcTree Mesh

UBC OcTree Mesh Appender

class PVGeo.ubc.octree.OcTreeAppender(**kwargs)[source]

Bases: ModelAppenderBase

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

_place_on_mesh(output, idx=0)[source]

Internal helper to place a model on the mesh for a given index

_read_up_front()[source]

Internal helper to read all data at start

UBC OcTree Mesh Reader

class PVGeo.ubc.octree.OcTreeReader(nOutputPorts=1, outputType='vtkUnstructuredGrid', **kwargs)[source]

Bases: ubcMeshReaderBase

This class reads a UBC OcTree Mesh file and builds a vtkUnstructuredGrid of the data in the file. Model File is optional. Reader will still construct vtkUnstructuredGrid safely.

RequestData(request, inInfo, outInfo)[source]

Used by pipeline to generate output

RequestInformation(request, inInfo, outInfo)[source]

Pipeline method for handling requests about the grid extents and time step values

__ubc_octree(filename_mesh, filename_models, output)

Wrapper to Read UBC GIF OcTree mesh and model file pairs. UBC OcTree 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. This only handles OcTree formats

Parameters:

filename_mesh (str) – The OcTree Mesh filename as an absolute path for the input mesh file in UBC OcTree Mesh Format

filename_models (list(str)): The model filenames as absolute paths for

the input model timesteps in UBC OcTree Model Format. output (vtkUnstructuredGrid): The output data object

Returns:

A vtkUnstructuredGrid 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:

vtkUnstructuredGrid

clear_mesh()[source]

Use to clean/rebuild the mesh.

clear_models()[source]

Use to clean the models and reread the data

description = 'PVGeo: UBC OcTree Mesh'
static place_model_on_octree_mesh(mesh, model, data_name='Data')[source]

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

Parameters:
  • mesh (vtkUnstructuredGrid) – The vtkUnstructuredGrid that is the mesh to place the model data upon. Needs to have been read in by ubcOcTree

  • model (np.ndarray) – A NumPy float array that holds all of the data to place inside of the mesh’s cells.

  • data_name (str) – The name of the model data array once placed on the vtkUnstructuredGrid.

Returns:

The input vtkUnstructuredGrid with model data appended.

Return type:

vtkUnstructuredGrid

ubc_octree_mesh(FileName, pdo=None)[source]

This method reads a UBC OcTree Mesh file and builds a vtkUnstructuredGrid of the data in the file. This method generates the vtkUnstructuredGrid without any data attributes.

Parameters:
  • FileName (str) – The mesh filename as an absolute path for the input mesh file in UBC OcTree format.

  • pdo (vtkUnstructuredGrid) – A pointer to the output data object.

Returns:

a vtkUnstructuredGrid generated from the UBCMesh grid. Mesh is defined by the input mesh file. No data attributes here, simply an empty mesh. Use the place_model_on_octree_mesh() method to associate with model data.

Return type:

vtkUnstructuredGrid