Package esys :: Package pyvisi :: Module datacollector :: Class DataCollector
[hide private]
[frames] | no frames]

Class DataCollector

Class that defines a data collector. A data collector is used to read data from a XML file or from an escript object directly. Writing XML files are expensive, but this approach has the advantage given that the results can be analyzed easily after the simulation has completed.


Attention: A DataCollector instance can only be used to specify one scalar, vector and tensor attribute from a source at any one time. If a second scalar, vector or tensor attribute needs to be specified from the same source, a second DataCollector instance must be created.

Instance Methods [hide private]
 
__del__(self)
Perform some clean up of ths assumese temporary file.
String
__get_array_type(self, arr)
Return whether an array type is scalar, vector or tensor by looking at the number of components in the array.
Dictionary
__get_attribute_list(self, data)
Return the available scalar, vector and tensor attributes (either point or cell data).
 
__get_attribute_lists(self)
Get all the available point and cell data attributes from the source.
 
__init__(self, source='xml')
Initialise the data collector.
Three column tuple containing numbers
_getCenter(self)
Return the center of the rendered object.
vtkUnstructuredGrid
_getDataCollectorOutput(self)
Return the output of the data collector.
Two column tuple containing numbers
_getScalarRange(self)
Return the scalar range.
Two column tuple containing numbers
_getTensorRange(self)
Return the tensor range.
Two column tuple containing numbers
_getVectorRange(self)
Return the vector range.
Boolean
_isModified(self)
Return whether the DataCollector has been modified.
Boolean
_isScalarSet(self)
Return whether a specific scalar field has been specified.
Boolean
_isTensorSet(self)
Return whether a specific tensor field has been specified.
Boolean
_isVectorSet(self)
Return whether a specific vector field has been specified.
 
_setActiveScalar(self)
Load the specified scalar field.
 
_setActiveTensor(self)
Load the the specified tensor field.
 
_setActiveVector(self)
Load the specified vector field.
 
setActiveScalar(self, scalar)
Specify the scalar field to load.
 
setActiveTensor(self, tensor)
Specify the tensor field to load.
 
setActiveVector(self, vector)
Specify the vector field to load.
 
setData(self, **args)
Create data using the <name>=<data> pairing.
 
setFileName(self, file_name)
Set the XML file name to read.
Method Details [hide private]

__get_array_type(self, arr)

 

Return whether an array type is scalar, vector or tensor by looking at the number of components in the array.

Parameters:
  • arr (vtkDataArray) - An array from the source.
Returns: String
Array type ('scalar', vector' or 'tensor')

__get_attribute_list(self, data)

 

Return the available scalar, vector and tensor attributes (either point or cell data).

Parameters:
  • data (vtkPointData or vtkCellData) - Available point data or cell data from the source
Returns: Dictionary
Dictionary containing the available scalar, vector and tensor attributes

__init__(self, source='xml')
(Constructor)

 

Initialise the data collector.

Parameters:
  • source (Source constant) - Source type

_getCenter(self)

 

Return the center of the rendered object.

Returns: Three column tuple containing numbers
Center of the rendered object

_getDataCollectorOutput(self)

 

Return the output of the data collector.

Returns: vtkUnstructuredGrid
Unstructured grid

_getScalarRange(self)

 

Return the scalar range.

Returns: Two column tuple containing numbers
Scalar range

_getTensorRange(self)

 

Return the tensor range.

Returns: Two column tuple containing numbers
Tensor range

_getVectorRange(self)

 

Return the vector range.

Returns: Two column tuple containing numbers
Vector range

_isModified(self)

 

Return whether the DataCollector has been modified.

Returns: Boolean
True or False

_isScalarSet(self)

 

Return whether a specific scalar field has been specified.

Returns: Boolean
True or False

_isTensorSet(self)

 

Return whether a specific tensor field has been specified.

Returns: Boolean
True or False

_isVectorSet(self)

 

Return whether a specific vector field has been specified.

Returns: Boolean
True or False

setActiveScalar(self, scalar)

 

Specify the scalar field to load.

Parameters:
  • scalar (String) - Scalar field to load from the file.

setActiveTensor(self, tensor)

 

Specify the tensor field to load.

Parameters:
  • tensor (String) - Tensor field to load from the file.

setActiveVector(self, vector)

 

Specify the vector field to load.

Parameters:
  • vector (String) - Vector field to load from the file.

setData(self, **args)

 

Create data using the <name>=<data> pairing. Assumption is made that the data will be given in the appropriate format.

setFileName(self, file_name)

 

Set the XML file name to read.

Parameters:
  • file_name (String) - Name of the file to read