ParaView
vtkPythonCalculator.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkPythonCalculator.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
33 #ifndef vtkPythonCalculator_h
34 #define vtkPythonCalculator_h
35 
36 #include "vtkPVClientServerCoreDefaultModule.h" //needed for exports
37 #include "vtkProgrammableFilter.h"
38 
39 class VTKPVCLIENTSERVERCOREDEFAULT_EXPORT vtkPythonCalculator : public vtkProgrammableFilter
40 {
41 public:
42  vtkTypeMacro(vtkPythonCalculator, vtkProgrammableFilter);
43  void PrintSelf(ostream& os, vtkIndent indent);
44  static vtkPythonCalculator* New();
45 
47 
52  vtkSetMacro(ArrayAssociation, int);
53  vtkGetMacro(ArrayAssociation, int);
55 
57 
61  vtkSetMacro(CopyArrays, bool);
62  vtkGetMacro(CopyArrays, bool);
63  vtkBooleanMacro(CopyArrays, bool);
65 
67 
72  vtkSetStringMacro(Expression) vtkGetStringMacro(Expression)
74 
76 
79  vtkSetStringMacro(ArrayName) vtkGetStringMacro(ArrayName)
81 
85  static void ExecuteScript(void*);
86 
87 protected:
89  ~vtkPythonCalculator();
90 
94  void Exec(const char*);
95 
96  virtual int FillOutputPortInformation(int port, vtkInformation* info);
97 
98  // overridden to allow multiple inputs to port 0
99  virtual int FillInputPortInformation(int port, vtkInformation* info);
100 
101  // DeExpressionion:
102  // Creates whatever output data set type is selected.
103  virtual int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
104  vtkInformationVector* outputVector);
105 
106  char* Expression;
107  char* ArrayName;
108  int ArrayAssociation;
109  bool CopyArrays;
110 
111 private:
112  vtkPythonCalculator(const vtkPythonCalculator&) VTK_DELETE_FUNCTION;
113  void operator=(const vtkPythonCalculator&) VTK_DELETE_FUNCTION;
114 };
115 
116 #endif
Evaluates a Python expression vtkPythonCalculator uses Python to calculate an expression.