VTK
vtkRCalculatorFilter.h
Go to the documentation of this file.
1 
2 /*=========================================================================
3 
4  Program: Visualization Toolkit
5  Module: vtkRCalculatorFilter.h
6 
7  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
8  All rights reserved.
9  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
10 
11  This software is distributed WITHOUT ANY WARRANTY; without even
12  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
13  PURPOSE. See the above copyright notice for more information.
14 
15 =========================================================================*/
16 /*-------------------------------------------------------------------------
17  Copyright 2009 Sandia Corporation.
18  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
19  the U.S. Government retains certain rights in this software.
20 -------------------------------------------------------------------------*/
21 
44 #ifndef vtkRCalculatorFilter_h
45 #define vtkRCalculatorFilter_h
46 
47 #include "vtkFiltersStatisticsGnuRModule.h" // For export macro
48 #include "vtkDataObjectAlgorithm.h"
49 
50 class vtkRInterface;
51 class vtkRCalculatorFilterInternals;
52 class vtkDataSet;
53 class vtkDoubleArray;
54 class vtkGraph;
55 class vtkTree;
56 class vtkTable;
58 class vtkArrayData;
59 class vtkStringArray;
60 
61 class VTKFILTERSSTATISTICSGNUR_EXPORT vtkRCalculatorFilter : public vtkDataObjectAlgorithm
62 {
63 
64 public:
65 
66  static vtkRCalculatorFilter *New();
67 
69  void PrintSelf(ostream& os, vtkIndent indent);
70 
78  void PutArray(const char* NameOfVTKArray, const char* NameOfRvar);
79 
87  void GetArray(const char* NameOfVTKArray, const char* NameOfRvar);
88 
92  void RemoveAllPutVariables();
93 
97  void RemoveAllGetVariables();
98 
100 
105  void PutTable(const char* NameOfRvar);
106  void GetTable(const char* NameOfRvar);
108 
113  void PutTables(vtkStringArray* NamesOfRVars);
114 
120  void GetTables(vtkStringArray* NamesOfRVars);
121 
123 
128  void PutTree(const char* NameOfRvar);
129  void GetTree(const char* NameOfRvar);
131 
136  void PutTrees(vtkStringArray* NamesOfRvars);
137 
143  void GetTrees(vtkStringArray* NamesOfRvars);
144 
145 
147 
150  vtkSetStringMacro(Rscript);
151  vtkGetStringMacro(Rscript);
153 
155 
158  vtkSetStringMacro(ScriptFname);
159  vtkGetStringMacro(ScriptFname);
161 
163 
166  vtkSetMacro(Routput,int);
167  vtkGetMacro(Routput,int);
169 
171 
180  vtkSetMacro(TimeOutput,int);
181  vtkGetMacro(TimeOutput,int);
183 
185 
188  vtkSetMacro(BlockInfoOutput,int);
189  vtkGetMacro(BlockInfoOutput,int);
191 
195  virtual int ProcessRequest(vtkInformation* request,
196  vtkInformationVector** inputVector,
197  vtkInformationVector* outputVector);
198 
199 protected:
200 
201  int SetRscriptFromFile(const char* fname);
202 
203  virtual int RequestData(vtkInformation *vtkNotUsed(request),
204  vtkInformationVector **inputVector,
205  vtkInformationVector *outputVector);
206 
210  virtual int RequestDataObject(vtkInformation* request,
211  vtkInformationVector** inputVector,
212  vtkInformationVector* outputVector);
213 
216 
217 private:
218 
219  vtkRCalculatorFilter(const vtkRCalculatorFilter&) VTK_DELETE_FUNCTION;
220  void operator=(const vtkRCalculatorFilter&) VTK_DELETE_FUNCTION;
221 
222  // Implementation details
223  vtkRCalculatorFilterInternals* rcfi;
224 
225  int ProcessInputDataSet(vtkDataSet* dsIn);
226  int ProcessOutputDataSet(vtkDataSet* dsOut);
227 
228  int ProcessInputGraph(vtkGraph* gIn);
229  int ProcessOutputGraph(vtkGraph* gOut);
230 
231  int ProcessInputArrayData(vtkArrayData * adIn);
232  int ProcessOutputArrayData(vtkArrayData * adOut);
233 
234  int ProcessInputCompositeDataSet(vtkCompositeDataSet* cdsIn);
235  int ProcessOutputCompositeDataSet(vtkCompositeDataSet * cdsOut);
236 
237  int ProcessInputTable(vtkTable* tOut);
238  int ProcessInputTable(std::string& name, vtkTable* tIn);
239 
240  vtkTable* GetOutputTable(std::string& name);
241  int ProcessOutputTable(vtkTable* tOut);
242 
243  int ProcessInputTree(vtkTree* tIn);
244  int ProcessInputTree(std::string& name, vtkTree* tIn);
245 
246  vtkTree* GetOutputTree(std::string& name);
247  int ProcessOutputTree(vtkTree* tOut);
248 
249  int ProcessInputDataObject(vtkDataObject *input);
250  int ProcessOutputDataObject(vtkDataObject *input);
251  int HasMultipleGets();
252  int HasMultiplePuts();
253 
254  vtkRInterface* ri;
255  char* Rscript;
256  char* RfileScript;
257  char* ScriptFname;
258  int Routput;
259  int TimeOutput;
260  int BlockInfoOutput;
261  char* OutputBuffer;
262  vtkDoubleArray* CurrentTime;
263  vtkDoubleArray* TimeRange;
264  vtkDoubleArray* TimeSteps;
265  vtkDoubleArray* BlockId;
266  vtkDoubleArray* NumBlocks;
267 
268 };
269 
270 #endif
271 
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Store vtkAlgorithm input/output information.
abstract class to specify dataset behavior
Definition: vtkDataSet.h:62
static vtkDataObjectAlgorithm * New()
a vtkAbstractArray subclass for strings
Pipeline data object that contains multiple vtkArray objects.
Definition: vtkArrayData.h:52
This class defines a VTK interface to an embedded GNU R intepreter instance.
Definition: vtkRInterface.h:59
dynamic, self-adjusting array of double
Base class for graph data types.
Definition: vtkGraph.h:287
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:39
This class functions as an array calculator for vtkDataArrays and VTKarray objects, using GNU R as the calculation engine.
int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
vtkGetStringMacro(ExtensionsString)
Returns a string listing all available extensions.
vtkSetMacro(IgnoreDriverBugs, bool)
When set known driver bugs are ignored during driver feature detection.
Superclass for algorithms that produce only data object as output.
A table, which contains similar-typed columns of data.
Definition: vtkTable.h:68
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Store zero or more vtkInformation instances.
A rooted tree data structure.
Definition: vtkTree.h:60
general representation of visualization data
Definition: vtkDataObject.h:64
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.