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 
38 #ifndef vtkRCalculatorFilter_h
39 #define vtkRCalculatorFilter_h
40 
41 #include "vtkFiltersStatisticsGnuRModule.h" // For export macro
42 #include "vtkDataObjectAlgorithm.h"
43 
44 class vtkRInterface;
45 class vtkRCalculatorFilterInternals;
46 class vtkDataSet;
47 class vtkDoubleArray;
48 class vtkGraph;
49 class vtkTree;
50 class vtkTable;
52 class vtkArrayData;
53 class vtkStringArray;
54 
55 class VTKFILTERSSTATISTICSGNUR_EXPORT vtkRCalculatorFilter : public vtkDataObjectAlgorithm
56 {
57 
58 public:
59 
60  static vtkRCalculatorFilter *New();
61 
63  void PrintSelf(ostream& os, vtkIndent indent);
64 
72  void PutArray(const char* NameOfVTKArray, const char* NameOfRvar);
73 
81  void GetArray(const char* NameOfVTKArray, const char* NameOfRvar);
82 
86  void RemoveAllPutVariables();
87 
91  void RemoveAllGetVariables();
92 
94 
99  void PutTable(const char* NameOfRvar);
100  void GetTable(const char* NameOfRvar);
102 
107  void PutTables(vtkStringArray* NamesOfRVars);
108 
114  void GetTables(vtkStringArray* NamesOfRVars);
115 
117 
122  void PutTree(const char* NameOfRvar);
123  void GetTree(const char* NameOfRvar);
125 
130  void PutTrees(vtkStringArray* NamesOfRvars);
131 
137  void GetTrees(vtkStringArray* NamesOfRvars);
138 
139 
141 
144  vtkSetStringMacro(Rscript);
145  vtkGetStringMacro(Rscript);
147 
149 
152  vtkSetStringMacro(ScriptFname);
153  vtkGetStringMacro(ScriptFname);
155 
157 
160  vtkSetMacro(Routput,int);
161  vtkGetMacro(Routput,int);
163 
165 
174  vtkSetMacro(TimeOutput,int);
175  vtkGetMacro(TimeOutput,int);
177 
179 
182  vtkSetMacro(BlockInfoOutput,int);
183  vtkGetMacro(BlockInfoOutput,int);
185 
189  virtual int ProcessRequest(vtkInformation* request,
190  vtkInformationVector** inputVector,
191  vtkInformationVector* outputVector);
192 
193 protected:
194 
195  int SetRscriptFromFile(const char* fname);
196 
197  virtual int RequestData(vtkInformation *vtkNotUsed(request),
198  vtkInformationVector **inputVector,
199  vtkInformationVector *outputVector);
200 
204  virtual int RequestDataObject(vtkInformation* request,
205  vtkInformationVector** inputVector,
206  vtkInformationVector* outputVector);
207 
210 
211 private:
212 
213  vtkRCalculatorFilter(const vtkRCalculatorFilter&) VTK_DELETE_FUNCTION;
214  void operator=(const vtkRCalculatorFilter&) VTK_DELETE_FUNCTION;
215 
216  // Implementation details
217  vtkRCalculatorFilterInternals* rcfi;
218 
219  int ProcessInputDataSet(vtkDataSet* dsIn);
220  int ProcessOutputDataSet(vtkDataSet* dsOut);
221 
222  int ProcessInputGraph(vtkGraph* gIn);
223  int ProcessOutputGraph(vtkGraph* gOut);
224 
225  int ProcessInputArrayData(vtkArrayData * adIn);
226  int ProcessOutputArrayData(vtkArrayData * adOut);
227 
228  int ProcessInputCompositeDataSet(vtkCompositeDataSet* cdsIn);
229  int ProcessOutputCompositeDataSet(vtkCompositeDataSet * cdsOut);
230 
231  int ProcessInputTable(vtkTable* tOut);
232  int ProcessInputTable(std::string& name, vtkTable* tIn);
233 
234  vtkTable* GetOutputTable(std::string& name);
235  int ProcessOutputTable(vtkTable* tOut);
236 
237  int ProcessInputTree(vtkTree* tIn);
238  int ProcessInputTree(std::string& name, vtkTree* tIn);
239 
240  vtkTree* GetOutputTree(std::string& name);
241  int ProcessOutputTree(vtkTree* tOut);
242 
243  int ProcessInputDataObject(vtkDataObject *input);
244  int ProcessOutputDataObject(vtkDataObject *input);
245  int HasMultipleGets();
246  int HasMultiplePuts();
247 
248  vtkRInterface* ri;
249  char* Rscript;
250  char* RfileScript;
251  char* ScriptFname;
252  int Routput;
253  int TimeOutput;
254  int BlockInfoOutput;
255  char* OutputBuffer;
256  vtkDoubleArray* CurrentTime;
257  vtkDoubleArray* TimeRange;
258  vtkDoubleArray* TimeSteps;
259  vtkDoubleArray* BlockId;
260  vtkDoubleArray* NumBlocks;
261 
262 };
263 
264 #endif
265 
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:56
static vtkDataObjectAlgorithm * New()
a vtkAbstractArray subclass for strings
Pipeline data object that contains multiple vtkArray objects.
Definition: vtkArrayData.h:49
This class defines a VTK interface to an embedded GNU R interpreter instance.
Definition: vtkRInterface.h:53
dynamic, self-adjusting array of double
Base class for graph data types.
Definition: vtkGraph.h:281
abstract superclass for composite (multi-block or AMR) datasets
a simple class to control print indentation
Definition: vtkIndent.h:33
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:62
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Store zero or more vtkInformation instances.
A rooted tree data structure.
Definition: vtkTree.h:54
general representation of visualization data
Definition: vtkDataObject.h:58
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.