1 /*========================================================================= 2 3 Program: Visualization Toolkit 4 Module: vtkCPExodusIIResultsArrayTemplate.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 /** 17 * @class vtkCPExodusIIResultsArrayTemplate 18 * @brief Map native Exodus II results arrays 19 * into the vtkDataArray interface. 20 * 21 * 22 * Map native Exodus II results arrays into the vtkDataArray interface. Use 23 * the vtkCPExodusIIInSituReader to read an Exodus II file's data into this 24 * structure. 25 */ 26 27 #ifndef vtkCPExodusIIResultsArrayTemplate_h 28 #define vtkCPExodusIIResultsArrayTemplate_h 29 30 #include "vtkMappedDataArray.h" 31 32 #include "vtkObjectFactory.h" // for vtkStandardNewMacro 33 34 template <class Scalar> 35 class vtkCPExodusIIResultsArrayTemplate : public vtkMappedDataArray<Scalar> 36 { 37 public: 38 vtkAbstractTemplateTypeMacro( 39 vtkCPExodusIIResultsArrayTemplate<Scalar>, vtkMappedDataArray<Scalar>) 40 vtkMappedDataArrayNewInstanceMacro( 41 vtkCPExodusIIResultsArrayTemplate<Scalar>) static vtkCPExodusIIResultsArrayTemplate* New(); 42 void PrintSelf(ostream& os, vtkIndent indent) override; 43 44 typedef typename Superclass::ValueType ValueType; 45 46 ///@{ 47 /** 48 * Set the arrays to be used and the number of tuples in each array. 49 * The save option can be set to true to indicate that this class 50 * should not delete the actual allocated memory. By default it will 51 * delete the array with the 'delete []' method. 52 */ 53 void SetExodusScalarArrays(std::vector<Scalar*> arrays, vtkIdType numTuples); 54 void SetExodusScalarArrays(std::vector<Scalar*> arrays, vtkIdType numTuples, bool save); 55 ///@} 56 57 // Reimplemented virtuals -- see superclasses for descriptions: 58 void Initialize() override; 59 void GetTuples(vtkIdList* ptIds, vtkAbstractArray* output) override; 60 void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray* output) override; 61 void Squeeze() override; 62 VTK_NEWINSTANCE vtkArrayIterator* NewIterator() override; 63 vtkIdType LookupValue(vtkVariant value) override; 64 void LookupValue(vtkVariant value, vtkIdList* ids) override; 65 vtkVariant GetVariantValue(vtkIdType idx) override; 66 void ClearLookup() override; 67 double* GetTuple(vtkIdType i) override; 68 void GetTuple(vtkIdType i, double* tuple) override; 69 vtkIdType LookupTypedValue(Scalar value) override; 70 void LookupTypedValue(Scalar value, vtkIdList* ids) override; 71 ValueType GetValue(vtkIdType idx) const override; 72 ValueType& GetValueReference(vtkIdType idx) override; 73 void GetTypedTuple(vtkIdType idx, Scalar* t) const override; 74 75 ///@{ 76 /** 77 * This container is read only -- this method does nothing but print a 78 * warning. 79 */ 80 vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override; 81 vtkTypeBool Resize(vtkIdType numTuples) override; 82 void SetNumberOfTuples(vtkIdType number) override; 83 void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override; 84 void SetTuple(vtkIdType i, const float* source) override; 85 void SetTuple(vtkIdType i, const double* source) override; 86 void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override; 87 void InsertTuple(vtkIdType i, const float* source) override; 88 void InsertTuple(vtkIdType i, const double* source) override; 89 void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds, vtkAbstractArray* source) override; 90 void InsertTuples( 91 vtkIdType dstStart, vtkIdType n, vtkIdType srcStart, vtkAbstractArray* source) override; 92 vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) override; 93 vtkIdType InsertNextTuple(const float* source) override; 94 vtkIdType InsertNextTuple(const double* source) override; 95 void DeepCopy(vtkAbstractArray* aa) override; 96 void DeepCopy(vtkDataArray* da) override; 97 void InterpolateTuple( 98 vtkIdType i, vtkIdList* ptIndices, vtkAbstractArray* source, double* weights) override; 99 void InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray* source1, vtkIdType id2, 100 vtkAbstractArray* source2, double t) override; 101 void SetVariantValue(vtkIdType idx, vtkVariant value) override; 102 void InsertVariantValue(vtkIdType idx, vtkVariant value) override; 103 void RemoveTuple(vtkIdType id) override; 104 void RemoveFirstTuple() override; 105 void RemoveLastTuple() override; 106 void SetTypedTuple(vtkIdType i, const Scalar* t) override; 107 void InsertTypedTuple(vtkIdType i, const Scalar* t) override; 108 vtkIdType InsertNextTypedTuple(const Scalar* t) override; 109 void SetValue(vtkIdType idx, Scalar value) override; 110 vtkIdType InsertNextValue(Scalar v) override; 111 void InsertValue(vtkIdType idx, Scalar v) override; 112 ///@} 113 114 protected: 115 vtkCPExodusIIResultsArrayTemplate(); 116 ~vtkCPExodusIIResultsArrayTemplate() override; 117 118 std::vector<Scalar*> Arrays; 119 120 private: 121 vtkCPExodusIIResultsArrayTemplate(const vtkCPExodusIIResultsArrayTemplate&) = delete; 122 void operator=(const vtkCPExodusIIResultsArrayTemplate&) = delete; 123 124 vtkIdType Lookup(const Scalar& val, vtkIdType startIndex); 125 double* TempDoubleArray; 126 ///@{ 127 /** 128 * By default Save is false. 129 */ 130 bool Save; 131 ///@} 132 }; 133 134 #include "vtkCPExodusIIResultsArrayTemplate.txx" 135 136 #endif // vtkCPExodusIIResultsArrayTemplate_h 137 138 // VTK-HeaderTest-Exclude: vtkCPExodusIIResultsArrayTemplate.h 139