Base Classes

Algorithm Base

class PVGeo.base.AlgorithmBase(nInputPorts=1, inputType='vtkDataSet', nOutputPorts=1, outputType='vtkTable', **kwargs)[source]

Bases: vtk.util.vtkAlgorithm.VTKPythonAlgorithmBase

This is a base class to add convienace methods to the VTKPythonAlgorithmBase for all algorithms implemented in PVGeo. We implement our algorithms in this manner to harness all of the backend support that the VTKPythonAlgorithmBase class provides for integrating custom algorithms on a VTK pipeline. All of the pipeline methods for setting inputs, getting outputs, making requests are handled by the super classes. For more information on what functionality is available, check out the VTK Docs for the vtkAlgorithm and then check out the following blog posts:

Apply()[source]

Update the algorithm and get the output data object

ErrorMessage()[source]

A conveience method to print the error message.

ErrorOccurred()[source]

A conveience method for handling errors on the VTK pipeline

Returns:true if an error has ovvured since last checked
Return type:bool
GetOutput(port=0)[source]

A conveience method to get the output data object of this PVGeo algorithm.

Filter Base

class PVGeo.base.FilterBase(nInputPorts=1, inputType='vtkDataSet', nOutputPorts=1, outputType='vtkPolyData', **kwargs)[source]

Bases: PVGeo.base.AlgorithmBase

A base class for implementing filters which holds several convienace methods

Apply(inputDataObject)[source]

Update the algorithm and get the output data object

Filter Preserve Type Base

class PVGeo.base.FilterPreserveTypeBase(nInputPorts=1, **kwargs)[source]

Bases: PVGeo.base.FilterBase

A Base class for implementing filters that preserve the data type of their arbitrary input.

RequestDataObject(request, inInfo, outInfo)[source]

There is no need to overwrite this. This method lets the pipeline know that the algorithm will dynamically decide the output data type based in the input data type.

Reader Base: Time Varying

class PVGeo.base.ReaderBase(nOutputPorts=1, outputType='vtkTable', **kwargs)[source]

Bases: PVGeo.base.ReaderBaseBase

A base class for inherrited functionality common to all reader algorithms that need to handle a time series.

GetTimestepValues()[source]

Use this in ParaView decorator to register timesteps on the pipeline.

RequestInformation(request, inInfo, outInfo)[source]

This is a conveience method that should be overwritten when needed. This will handle setting the timesteps appropriately based on the number of file names when the pipeline needs to know the time information.

SetTimeDelta(dt)[source]

An advanced property to set the time step in seconds.

_UpdateTimeSteps()[source]

For internal use only: appropriately sets the timesteps.

Reader Base Base

class PVGeo.base.ReaderBaseBase(nOutputPorts=1, outputType='vtkTable', **kwargs)[source]

Bases: PVGeo.base.AlgorithmBase

A base class for inherrited functionality common to all reader algorithms

AddFileName(fname)[source]

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

Parameters:fname (str) – The absolute file name with path to read.
Apply(fname)[source]

Given a file name (or list of file names), perfrom the read

ClearFileNames()[source]

Use to clear file names of the reader.

Note

This does not set the reader to need to read again as there are no files to read.

GetFileNames(idx=None)[source]

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

Modified(readAgain=True)[source]

Call modified if the files needs to be read again again

NeedToRead(flag=None)[source]

Ask self if the reader needs to read the files again.

Parameters:flag (bool) – Set the read status
Returns:the status of the reader.
Return type:bool
_GetFileContents(idx=None)[source]
_GetRawData(idx=0)[source]
_ReadUpFront()[source]

Two File Reader Base

class PVGeo.base.TwoFileReaderBase(nOutputPorts=1, outputType='vtkUnstructuredGrid', **kwargs)[source]

Bases: PVGeo.base.AlgorithmBase

A base clase for readers that need to handle two input files. One meta-data file and a series of data files.

AddModelFileName(fname)[source]

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

Parameters:fname (str or list(str)) – the file name(s) to use for the model data.
Apply()[source]

Perfrom the read with parameters/file names set during init or by setters

ClearMesh()[source]

Use to clear mesh file name

ClearModels()[source]

Use to clear data file names

GetMeshFileName()[source]
GetModelFileNames(idx=None)[source]

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

GetTimestepValues()[source]

Use this in ParaView decorator to register timesteps

static HasModels(modelfiles)[source]

A convienance method to see if a list contatins models filenames.

Modified(readAgainMesh=True, readAgainModels=True)[source]

Call modified if the files needs to be read again again

Parameters:
  • readAgainMesh (bool) – set the status of the reader for mesh files.
  • readAgainModels (bool) – set the status of the reader for model files.
NeedToReadMesh(flag=None)[source]

Ask self if the reader needs to read the mesh file again.

Parameters:flag (bool) – set the status of the reader for mesh files.
NeedToReadModels(flag=None)[source]

Ask self if the reader needs to read the model files again.

Parameters:flag (bool) – set the status of the reader for model files.
RequestInformation(request, inInfo, outInfo)[source]

Overwritten by subclass to provide meta-data to downstream pipeline.

SetMeshFileName(fname)[source]

Set the mesh file name.

SetTimeDelta(dt)[source]

An advanced property for the time step in seconds.

ThisHasModels()[source]

Ask self if the reader has model filenames set.

_TwoFileReaderBase__UpdateTimeSteps()

For internal use only

Writer Base

class PVGeo.base.WriterBase(nInputPorts=1, inputType='vtkPolyData', **kwargs)[source]

Bases: PVGeo.base.AlgorithmBase

Apply(inputDataObject)[source]

Update the algorithm and get the output data object

FillInputPortInformation(port, info)[source]

Allows us to save composite datasets as well.

Note

I only care about vtkMultiBlockDataSet

GetBlockFileName(idx)[source]
GetFileName()[source]

Get the set filename.

GetFormat()[source]
PerformWriteOut(inputDataObject, filename, objectName)[source]

This method must be implemented. This is automatically called by RequestData for single inputs or composite inputs.

RequestData(request, inInfoVec, outInfoVec)[source]

Subclasses must implement a PerformWriteOut method that takes an input data object and a filename. This method will automatically handle composite data sets.

SetBlockFileNames(n)[source]

Gets a list of filenames based on user input filename and creates a numbered list of filenames for the reader to save out. Assumes the filename has an extension set already.

SetFileName(fname)[source]

Specify the filename for the output. Writer can only handle a single output data object/time step.

SetFormat(fmt)[source]

Use to set the ASCII format for the writer default is '%.9e'

UseComposite()[source]

True if input dataset is a composite dataset

Write(inputDataObject=None)[source]

Perfrom the write out.