ParaView
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
vtkPythonCalculator Class Reference

Evaluates a Python expression vtkPythonCalculator uses Python to calculate an expression. More...

#include <vtkPythonCalculator.h>

Inherits vtkProgrammableFilter.

Public Types

typedef vtkProgrammableFilter Superclass
 

Public Member Functions

virtual const char * GetClassName ()
 
virtual int IsA (const char *type)
 
void PrintSelf (ostream &os, vtkIndent indent)
 
virtual void SetArrayAssociation (int)
 Which field data to get the arrays from. More...
 
virtual int GetArrayAssociation ()
 Which field data to get the arrays from. More...
 
virtual void SetCopyArrays (bool)
 Controls whether the input arrays are copied to the output. More...
 
virtual bool GetCopyArrays ()
 Controls whether the input arrays are copied to the output. More...
 
virtual void CopyArraysOn ()
 Controls whether the input arrays are copied to the output. More...
 
virtual void CopyArraysOff ()
 Controls whether the input arrays are copied to the output. More...
 
virtual void SetExpression (const char *)
 Set the text of the python expression to execute. More...
 
virtual char * GetExpression ()
 Set the text of the python expression to execute. More...
 
virtual void SetArrayName (const char *)
 Set the name of the output array. More...
 
virtual char * GetArrayName ()
 Set the name of the output array. More...
 

Static Public Member Functions

static int IsTypeOf (const char *type)
 
static vtkPythonCalculatorSafeDownCast (vtkObject *o)
 
static vtkPythonCalculatorNew ()
 
static void ExecuteScript (void *)
 For internal use only. More...
 

Protected Member Functions

 vtkPythonCalculator ()
 
 ~vtkPythonCalculator ()
 
void Exec (const char *)
 For internal use only. More...
 
virtual int FillOutputPortInformation (int port, vtkInformation *info)
 
virtual int FillInputPortInformation (int port, vtkInformation *info)
 
virtual int RequestDataObject (vtkInformation *request, vtkInformationVector **inputVector, vtkInformationVector *outputVector)
 

Protected Attributes

char * Expression
 
char * ArrayName
 
int ArrayAssociation
 
bool CopyArrays
 

Detailed Description

Evaluates a Python expression vtkPythonCalculator uses Python to calculate an expression.

This filter depends heavily on the numpy and paraview.vtk modules. To use the parallel functions, mpi4py is also necessary. The expression is evaluated and the resulting scalar value or numpy array is added to the output as an array. See numpy and paraview.vtk documentation for the list of available functions.

This filter tries to make it easy for the user to write expressions by defining certain variables. The filter tries to assign each array to a variable of the same name. If the name of the array is not a valid Python variable, it has to be accessed through a dictionary called arrays (i.e. arrays['array_name']). The points can be accessed using the points variable.

Definition at line 39 of file vtkPythonCalculator.h.

Member Typedef Documentation

◆ Superclass

typedef vtkProgrammableFilter vtkPythonCalculator::Superclass

Definition at line 42 of file vtkPythonCalculator.h.

Constructor & Destructor Documentation

◆ vtkPythonCalculator()

vtkPythonCalculator::vtkPythonCalculator ( )
protected

◆ ~vtkPythonCalculator()

vtkPythonCalculator::~vtkPythonCalculator ( )
protected

Member Function Documentation

◆ GetClassName()

virtual const char* vtkPythonCalculator::GetClassName ( )
virtual

◆ IsTypeOf()

static int vtkPythonCalculator::IsTypeOf ( const char *  type)
static

◆ IsA()

virtual int vtkPythonCalculator::IsA ( const char *  type)
virtual

◆ SafeDownCast()

static vtkPythonCalculator* vtkPythonCalculator::SafeDownCast ( vtkObject *  o)
static

◆ PrintSelf()

void vtkPythonCalculator::PrintSelf ( ostream &  os,
vtkIndent  indent 
)

◆ New()

static vtkPythonCalculator* vtkPythonCalculator::New ( )
static

◆ SetArrayAssociation()

virtual void vtkPythonCalculator::SetArrayAssociation ( int  )
virtual

Which field data to get the arrays from.

See vtkDataObject::FieldAssociations for choices. The default is FIELD_ASSOCIATION_POINTS.

◆ GetArrayAssociation()

virtual int vtkPythonCalculator::GetArrayAssociation ( )
virtual

Which field data to get the arrays from.

See vtkDataObject::FieldAssociations for choices. The default is FIELD_ASSOCIATION_POINTS.

◆ SetCopyArrays()

virtual void vtkPythonCalculator::SetCopyArrays ( bool  )
virtual

Controls whether the input arrays are copied to the output.

True by default.

◆ GetCopyArrays()

virtual bool vtkPythonCalculator::GetCopyArrays ( )
virtual

Controls whether the input arrays are copied to the output.

True by default.

◆ CopyArraysOn()

virtual void vtkPythonCalculator::CopyArraysOn ( )
virtual

Controls whether the input arrays are copied to the output.

True by default.

◆ CopyArraysOff()

virtual void vtkPythonCalculator::CopyArraysOff ( )
virtual

Controls whether the input arrays are copied to the output.

True by default.

◆ SetExpression()

virtual void vtkPythonCalculator::SetExpression ( const char *  )
virtual

Set the text of the python expression to execute.

This expression must return a scalar value (which is converted to an array) or a numpy array.

◆ GetExpression()

virtual char* vtkPythonCalculator::GetExpression ( )
virtual

Set the text of the python expression to execute.

This expression must return a scalar value (which is converted to an array) or a numpy array.

◆ SetArrayName()

virtual void vtkPythonCalculator::SetArrayName ( const char *  )
virtual

Set the name of the output array.

◆ GetArrayName()

virtual char* vtkPythonCalculator::GetArrayName ( )
virtual

Set the name of the output array.

◆ ExecuteScript()

static void vtkPythonCalculator::ExecuteScript ( void *  )
static

For internal use only.

◆ Exec()

void vtkPythonCalculator::Exec ( const char *  )
protected

For internal use only.

◆ FillOutputPortInformation()

virtual int vtkPythonCalculator::FillOutputPortInformation ( int  port,
vtkInformation *  info 
)
protectedvirtual

◆ FillInputPortInformation()

virtual int vtkPythonCalculator::FillInputPortInformation ( int  port,
vtkInformation *  info 
)
protectedvirtual

◆ RequestDataObject()

virtual int vtkPythonCalculator::RequestDataObject ( vtkInformation *  request,
vtkInformationVector **  inputVector,
vtkInformationVector *  outputVector 
)
protectedvirtual

Member Data Documentation

◆ Expression

char* vtkPythonCalculator::Expression
protected

Definition at line 106 of file vtkPythonCalculator.h.

◆ ArrayName

char* vtkPythonCalculator::ArrayName
protected

Definition at line 107 of file vtkPythonCalculator.h.

◆ ArrayAssociation

int vtkPythonCalculator::ArrayAssociation
protected

Definition at line 108 of file vtkPythonCalculator.h.

◆ CopyArrays

bool vtkPythonCalculator::CopyArrays
protected

Definition at line 109 of file vtkPythonCalculator.h.


The documentation for this class was generated from the following file: