Base Classes

Model Appender Base

class PVGeo.ubc.two_file_base.ModelAppenderBase(inputType='vtkRectilinearGrid', outputType='vtkRectilinearGrid', **kwargs)[source]

Bases: AlgorithmBase

A base class for create mesh-model appenders on the UBC Mesh formats

Modified(read_again=True)[source]

Call modified if the files needs to be read again again.

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

Used by pipeline to generate output

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

Used by pipeline to handle time variance and update output extents

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

For internal use only: appropriately sets the timesteps.

add_model_file_name(filename)[source]

Use to set the file names for the reader. Handles single string or list of strings.

clear_models()[source]

Use to clear data file names.

get_data_name()[source]

Get the data array name

get_model_filenames(idx=None)[source]

Returns the list of file names or given and index returns a specified timestep’s filename.

get_time_step_values()[source]

Use this in ParaView decorator to register timesteps.

has_models()[source]

Return True if models are associated with this mesh

modified(read_again=True)[source]

Call modified if the files needs to be read again again.

need_to_read(flag=None)[source]

Ask self if the reader needs to read the files again

Parameters:

flag (bool) – if the flag is set then this method will set the read status

Returns:

The status of the reader aspect of the filter.

Return type:

bool

set_data_name(name)[source]

Set the data array name

set_use_filename(flag)[source]

Set a flag on whether or not to use the filename as the data array name

UBC Mesh Reader Base

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

Bases: TwoFileReaderBase

A base class for the UBC mesh readers

_read_extent()[source]

Reads the mesh file for the UBC 2D/3D Mesh or OcTree format to get output extents. Computationally inexpensive method to discover whole output extent.

Returns:

This returns a tuple of the whole extent for the grid to be made of the input mesh file (0,n1-1, 0,n2-1, 0,n3-1). This output should be directly passed to set the whole output extent.

Return type:

tuple(int)

static _ubc_mesh_2d_part(FileName)[source]

Internal helper to read 2D mesh file

extensions = 'mesh msh dat txt text'
get_data_name()[source]

Get the data array name

is_2d()[source]

Returns true if mesh is spatially referenced in only two dimensions

is_3d()[source]

Returns true if mesh is spatially referenced in three dimensions

set_data_name(name)[source]

Set the data array name

set_use_filename(flag)[source]

Set a flag on whether or not to use the filename as the data array name

static ubc_model_3d(FileName)[source]

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

Parameters:

FileName (str) – The model file name(s) as an absolute path for the input model file in UBC 3D Model Model Format. Also accepts a list of string file names.

Returns:

Returns a NumPy float array that holds the model data read from the file. Use the place_model_on_mesh() 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