VTK  9.3.1
vtkStringToNumeric.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-FileCopyrightText: Copyright 2008 Sandia Corporation
3 // SPDX-License-Identifier: LicenseRef-BSD-3-Clause-Sandia-USGov
19 #ifndef vtkStringToNumeric_h
20 #define vtkStringToNumeric_h
21 
22 #include "vtkDataObjectAlgorithm.h"
23 #include "vtkInfovisCoreModule.h" // For export macro
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class VTKINFOVISCORE_EXPORT vtkStringToNumeric : public vtkDataObjectAlgorithm
27 {
28 public:
29  static vtkStringToNumeric* New();
31  void PrintSelf(ostream& os, vtkIndent indent) override;
32 
34 
38  vtkSetMacro(ForceDouble, bool);
39  vtkGetMacro(ForceDouble, bool);
40  vtkBooleanMacro(ForceDouble, bool);
42 
44 
47  vtkSetMacro(DefaultIntegerValue, int);
48  vtkGetMacro(DefaultIntegerValue, int);
50 
52 
55  vtkSetMacro(DefaultDoubleValue, double);
56  vtkGetMacro(DefaultDoubleValue, double);
58 
60 
74  vtkSetMacro(TrimWhitespacePriorToNumericConversion, bool);
75  vtkGetMacro(TrimWhitespacePriorToNumericConversion, bool);
76  vtkBooleanMacro(TrimWhitespacePriorToNumericConversion, bool);
78 
80 
83  vtkSetMacro(ConvertFieldData, bool);
84  vtkGetMacro(ConvertFieldData, bool);
85  vtkBooleanMacro(ConvertFieldData, bool);
87 
89 
92  vtkSetMacro(ConvertPointData, bool);
93  vtkGetMacro(ConvertPointData, bool);
94  vtkBooleanMacro(ConvertPointData, bool);
96 
98 
101  vtkSetMacro(ConvertCellData, bool);
102  vtkGetMacro(ConvertCellData, bool);
103  vtkBooleanMacro(ConvertCellData, bool);
105 
109  virtual void SetConvertVertexData(bool b) { this->SetConvertPointData(b); }
110  virtual bool GetConvertVertexData() { return this->GetConvertPointData(); }
111  vtkBooleanMacro(ConvertVertexData, bool);
112 
116  virtual void SetConvertEdgeData(bool b) { this->SetConvertCellData(b); }
117  virtual bool GetConvertEdgeData() { return this->GetConvertCellData(); }
118  vtkBooleanMacro(ConvertEdgeData, bool);
119 
123  virtual void SetConvertRowData(bool b) { this->SetConvertPointData(b); }
124  virtual bool GetConvertRowData() { return this->GetConvertPointData(); }
125  vtkBooleanMacro(ConvertRowData, bool);
126 
131  vtkInformationVector* outputVector) override;
132 
133 protected:
135  ~vtkStringToNumeric() override;
136 
140  int RequestDataObject(vtkInformation* request, vtkInformationVector** inputVector,
141  vtkInformationVector* outputVector) override;
142 
146  void ConvertArrays(vtkFieldData* fieldData);
147 
155 
161  int CountItemsToConvert(vtkFieldData* fieldData);
162 
163  // These keep track of our progress
166 
168 
169 private:
170  vtkStringToNumeric(const vtkStringToNumeric&) = delete;
171  void operator=(const vtkStringToNumeric&) = delete;
172 };
173 
174 VTK_ABI_NAMESPACE_END
175 #endif
virtual int RequestDataObject(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
This is called by the superclass.
virtual bool GetConvertRowData()
Store vtkAlgorithm input/output information.
static vtkDataObjectAlgorithm * New()
vtkTypeBool ProcessRequest(vtkInformation *, vtkInformationVector **, vtkInformationVector *) override
see vtkAlgorithm for details
VTKACCELERATORSVTKMDATAMODEL_EXPORT bool ConvertArrays(const vtkm::cont::DataSet &input, vtkDataSet *output)
virtual void SetConvertRowData(bool b)
Whether to detect and convert row data arrays.
int vtkTypeBool
Definition: vtkABI.h:64
a simple class to control print indentation
Definition: vtkIndent.h:28
Converts string arrays to numeric arrays.
bool TrimWhitespacePriorToNumericConversion
Superclass for algorithms that produce only data object as output.
virtual int RequestData(vtkInformation *, vtkInformationVector **, vtkInformationVector *)
virtual bool GetConvertVertexData()
Store zero or more vtkInformation instances.
virtual void SetConvertVertexData(bool b)
Whether to detect and convert vertex data arrays.
virtual bool GetConvertEdgeData()
virtual void SetConvertEdgeData(bool b)
Whether to detect and convert edge data arrays.
represent and manipulate fields of data
Definition: vtkFieldData.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.