VTK
vtkStringToNumeric.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkStringToNumeric.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 =========================================================================*/
15 /*-------------------------------------------------------------------------
16  Copyright 2008 Sandia Corporation.
17  Under the terms of Contract DE-AC04-94AL85000 with Sandia Corporation,
18  the U.S. Government retains certain rights in this software.
19 -------------------------------------------------------------------------*/
29 #ifndef vtkStringToNumeric_h
30 #define vtkStringToNumeric_h
31 
32 #include "vtkInfovisCoreModule.h" // For export macro
33 #include "vtkDataObjectAlgorithm.h"
34 
35 class VTKINFOVISCORE_EXPORT vtkStringToNumeric : public vtkDataObjectAlgorithm
36 {
37 public:
38  static vtkStringToNumeric* New();
40  void PrintSelf(ostream& os, vtkIndent indent) override;
41 
43 
47  vtkSetMacro(ForceDouble, bool);
48  vtkGetMacro(ForceDouble, bool);
49  vtkBooleanMacro(ForceDouble, bool);
51 
53 
56  vtkSetMacro(DefaultIntegerValue, int);
57  vtkGetMacro(DefaultIntegerValue, int);
59 
61 
64  vtkSetMacro(DefaultDoubleValue, double);
65  vtkGetMacro(DefaultDoubleValue, double);
67 
69 
83  vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
84  vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
85  vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
87 
89 
92  vtkSetMacro(ConvertFieldData, bool);
93  vtkGetMacro(ConvertFieldData, bool);
94  vtkBooleanMacro(ConvertFieldData, bool);
96 
98 
101  vtkSetMacro(ConvertPointData, bool);
102  vtkGetMacro(ConvertPointData, bool);
103  vtkBooleanMacro(ConvertPointData, bool);
105 
107 
110  vtkSetMacro(ConvertCellData, bool);
111  vtkGetMacro(ConvertCellData, bool);
112  vtkBooleanMacro(ConvertCellData, bool);
114 
118  virtual void SetConvertVertexData(bool b)
119  { this->SetConvertPointData(b); }
120  virtual bool GetConvertVertexData()
121  { return this->GetConvertPointData(); }
122  vtkBooleanMacro(ConvertVertexData, bool);
123 
127  virtual void SetConvertEdgeData(bool b)
128  { this->SetConvertCellData(b); }
129  virtual bool GetConvertEdgeData()
130  { return this->GetConvertCellData(); }
131  vtkBooleanMacro(ConvertEdgeData, bool);
132 
136  virtual void SetConvertRowData(bool b)
137  { this->SetConvertPointData(b); }
138  virtual bool GetConvertRowData()
139  { return this->GetConvertPointData(); }
140  vtkBooleanMacro(ConvertRowData, bool);
141 
145  int ProcessRequest(vtkInformation* request,
146  vtkInformationVector** inputVector,
147  vtkInformationVector* outputVector) override;
148 
149 protected:
151  ~vtkStringToNumeric() override;
152 
156  int RequestDataObject(vtkInformation* request,
157  vtkInformationVector** inputVector,
158  vtkInformationVector* outputVector) override;
159 
163  void ConvertArrays(vtkFieldData* fieldData);
164 
172 
178  int CountItemsToConvert(vtkFieldData *fieldData);
179 
180  // These keep track of our progress
183 
184  int RequestData(
187  vtkInformationVector*) override;
188 
189 private:
190  vtkStringToNumeric(const vtkStringToNumeric&) = delete;
191  void operator=(const vtkStringToNumeric&) = delete;
192 };
193 
194 #endif
195 
vtkDataObjectAlgorithm::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkStringToNumeric::DefaultDoubleValue
double DefaultDoubleValue
Definition: vtkStringToNumeric.h:170
vtkInformationVector
Store zero or more vtkInformation instances.
Definition: vtkInformationVector.h:35
vtkStringToNumeric::SetConvertVertexData
virtual void SetConvertVertexData(bool b)
Whether to detect and convert vertex data arrays.
Definition: vtkStringToNumeric.h:118
vtkStringToNumeric::ConvertPointData
bool ConvertPointData
Definition: vtkStringToNumeric.h:166
vtkDataObjectAlgorithm
Superclass for algorithms that produce only data object as output.
Definition: vtkDataObjectAlgorithm.h:43
vtkStringToNumeric::TrimWhitespacePriorToNumericConversion
bool TrimWhitespacePriorToNumericConversion
Definition: vtkStringToNumeric.h:171
vtkFieldData
represent and manipulate fields of data
Definition: vtkFieldData.h:53
vtkStringToNumeric
Converts string arrays to numeric arrays.
Definition: vtkStringToNumeric.h:35
vtkStringToNumeric::SetConvertEdgeData
virtual void SetConvertEdgeData(bool b)
Whether to detect and convert edge data arrays.
Definition: vtkStringToNumeric.h:127
vtkStringToNumeric::GetConvertVertexData
virtual bool GetConvertVertexData()
Definition: vtkStringToNumeric.h:120
vtkStringToNumeric::GetConvertRowData
virtual bool GetConvertRowData()
Definition: vtkStringToNumeric.h:138
fromvtkm::ConvertArrays
VTKACCELERATORSVTKM_EXPORT bool ConvertArrays(const vtkm::cont::DataSet &input, vtkDataSet *output)
vtkStringToNumeric::ConvertFieldData
bool ConvertFieldData
Definition: vtkStringToNumeric.h:165
vtkStringToNumeric::ItemsToConvert
int ItemsToConvert
Definition: vtkStringToNumeric.h:181
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:33
vtkStringToNumeric::ConvertCellData
bool ConvertCellData
Definition: vtkStringToNumeric.h:167
vtkStringToNumeric::DefaultIntegerValue
int DefaultIntegerValue
Definition: vtkStringToNumeric.h:169
vtkStringToNumeric::ItemsConverted
int ItemsConverted
Definition: vtkStringToNumeric.h:182
vtkInformation
Store vtkAlgorithm input/output information.
Definition: vtkInformation.h:80
vtkDataObjectAlgorithm::ProcessRequest
int ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
vtkStringToNumeric::SetConvertRowData
virtual void SetConvertRowData(bool b)
Whether to detect and convert row data arrays.
Definition: vtkStringToNumeric.h:136
vtkDataObjectAlgorithm::New
static vtkDataObjectAlgorithm * New()
vtkDataObjectAlgorithm::RequestData
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
Definition: vtkDataObjectAlgorithm.h:122
vtkDataObjectAlgorithm.h
vtkDataObjectAlgorithm::RequestDataObject
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
Definition: vtkDataObjectAlgorithm.h:104
vtkStringToNumeric::ForceDouble
bool ForceDouble
Definition: vtkStringToNumeric.h:168
vtkStringToNumeric::GetConvertEdgeData
virtual bool GetConvertEdgeData()
Definition: vtkStringToNumeric.h:129