VTK
vtkCPExodusIIResultsArrayTemplate.h
Go to the documentation of this file.
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 
30 #ifndef vtkCPExodusIIResultsArrayTemplate_h
31 #define vtkCPExodusIIResultsArrayTemplate_h
32 
33 #include "vtkMappedDataArray.h"
34 
35 #include "vtkObjectFactory.h" // for vtkStandardNewMacro
36 
37 template <class Scalar>
39 {
40 public:
45  void PrintSelf(ostream &os, vtkIndent indent) override;
46 
47  typedef typename Superclass::ValueType ValueType;
48 
50 
56  void SetExodusScalarArrays(std::vector<Scalar*> arrays, vtkIdType numTuples);
57  void SetExodusScalarArrays(std::vector<Scalar*> arrays, vtkIdType numTuples, bool save);
59 
60  // Reimplemented virtuals -- see superclasses for descriptions:
61  void Initialize() override;
62  void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override;
63  void GetTuples(vtkIdType p1, vtkIdType p2, vtkAbstractArray *output) override;
64  void Squeeze() override;
67  void LookupValue(vtkVariant value, vtkIdList *ids) override;
68  vtkVariant GetVariantValue(vtkIdType idx) override;
69  void ClearLookup() override;
70  double* GetTuple(vtkIdType i) override;
71  void GetTuple(vtkIdType i, double *tuple) override;
72  vtkIdType LookupTypedValue(Scalar value) override;
73  void LookupTypedValue(Scalar value, vtkIdList *ids) override;
74  ValueType GetValue(vtkIdType idx) const override;
75  ValueType& GetValueReference(vtkIdType idx) override;
76  void GetTypedTuple(vtkIdType idx, Scalar *t) const override;
77 
79 
83  vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override;
84  vtkTypeBool Resize(vtkIdType numTuples) override;
85  void SetNumberOfTuples(vtkIdType number) override;
86  void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override;
87  void SetTuple(vtkIdType i, const float *source) override;
88  void SetTuple(vtkIdType i, const double *source) override;
90  void InsertTuple(vtkIdType i, const float *source) override;
91  void InsertTuple(vtkIdType i, const double *source) override;
92  void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds,
93  vtkAbstractArray *source) override;
94  void InsertTuples(vtkIdType dstStart, vtkIdType n, vtkIdType srcStart,
95  vtkAbstractArray* source) override;
97  vtkIdType InsertNextTuple(const float *source) override;
98  vtkIdType InsertNextTuple(const double *source) override;
99  void DeepCopy(vtkAbstractArray *aa) override;
100  void DeepCopy(vtkDataArray *da) override;
101  void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices,
102  vtkAbstractArray* source, double* weights) override;
104  vtkIdType id2, vtkAbstractArray *source2, double t) override;
105  void SetVariantValue(vtkIdType idx, vtkVariant value) override;
106  void InsertVariantValue(vtkIdType idx, vtkVariant value) override;
107  void RemoveTuple(vtkIdType id) override;
108  void RemoveFirstTuple() override;
109  void RemoveLastTuple() override;
110  void SetTypedTuple(vtkIdType i, const Scalar *t) override;
111  void InsertTypedTuple(vtkIdType i, const Scalar *t) override;
112  vtkIdType InsertNextTypedTuple(const Scalar *t) override;
113  void SetValue(vtkIdType idx, Scalar value) override;
114  vtkIdType InsertNextValue(Scalar v) override;
115  void InsertValue(vtkIdType idx, Scalar v) override;
117 
118 protected:
121 
122  std::vector<Scalar *> Arrays;
123 
124 private:
126  void operator=(const vtkCPExodusIIResultsArrayTemplate &) = delete;
127 
128  vtkIdType Lookup(const Scalar &val, vtkIdType startIndex);
129  double *TempDoubleArray;
131 
134  bool Save;
135 };
137 
138 #include "vtkCPExodusIIResultsArrayTemplate.txx"
139 
140 #endif //vtkCPExodusIIResultsArrayTemplate_h
141 
142 // VTK-HeaderTest-Exclude: vtkCPExodusIIResultsArrayTemplate.h
vtkCPExodusIIResultsArrayTemplate::LookupTypedValue
vtkIdType LookupTypedValue(Scalar value) override
vtkCPExodusIIResultsArrayTemplate::SetValue
void SetValue(vtkIdType idx, Scalar value) override
Set the data at a particular index.
vtkCPExodusIIResultsArrayTemplate::DeepCopy
void DeepCopy(vtkAbstractArray *aa) override
Deep copy of data.
vtkX3D::value
Definition: vtkX3D.h:220
vtkCPExodusIIResultsArrayTemplate::InsertNextValue
vtkIdType InsertNextValue(Scalar v) override
Insert data at the end of the array.
vtkCPExodusIIResultsArrayTemplate::GetTypedTuple
void GetTypedTuple(vtkIdType idx, Scalar *t) const override
Copy the tuple value into a user-provided array.
vtkIdType
int vtkIdType
Definition: vtkType.h:347
vtkCPExodusIIResultsArrayTemplate::LookupValue
vtkIdType LookupValue(vtkVariant value) override
Return the value indices where a specific value appears.
vtkCPExodusIIResultsArrayTemplate::RemoveFirstTuple
void RemoveFirstTuple() override
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkCPExodusIIResultsArrayTemplate::RemoveLastTuple
void RemoveLastTuple() override
save
void save(Archiver &ar, const vtkUnicodeString &str, const unsigned int vtkNotUsed(version))
Definition: vtkVariantBoostSerialization.h:65
vtkCPExodusIIResultsArrayTemplate::Squeeze
void Squeeze() override
Free any unnecessary memory.
vtkCPExodusIIResultsArrayTemplate::InsertNextTypedTuple
vtkIdType InsertNextTypedTuple(const Scalar *t) override
Insert (memory allocation performed) the tuple onto the end of the array.
vtkObjectFactory.h
vtkMappedDataArray.h
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
vtkCPExodusIIResultsArrayTemplate::Arrays
std::vector< Scalar * > Arrays
Definition: vtkCPExodusIIResultsArrayTemplate.h:122
vtkMappedDataArray
Map non-contiguous data structures into the vtkDataArray API.
Definition: vtkMappedDataArray.h:41
vtkCPExodusIIResultsArrayTemplate::SetTuple
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Set the tuple at dstTupleIdx in this array to the tuple at srcTupleIdx in the source array.
vtkCPExodusIIResultsArrayTemplate::NewIterator
vtkArrayIterator * NewIterator() override
Subclasses must override this method and provide the right kind of templated vtkArrayIteratorTemplate...
vtkCPExodusIIResultsArrayTemplate::RemoveTuple
void RemoveTuple(vtkIdType id) override
These methods remove tuples from the data array.
vtkCPExodusIIResultsArrayTemplate::InterpolateTuple
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
Set the tuple at dstTupleIdx in this array to the interpolated tuple value, given the ptIndices in th...
vtkCPExodusIIResultsArrayTemplate::InsertValue
void InsertValue(vtkIdType idx, Scalar v) override
Insert data at a specified position in the array.
vtkMappedDataArrayNewInstanceMacro
#define vtkMappedDataArrayNewInstanceMacro(thisClass)
vtkCPExodusIIResultsArrayTemplate::SetNumberOfTuples
void SetNumberOfTuples(vtkIdType number) override
Set the number of tuples (a component group) in the array.
source
boost::graph_traits< vtkGraph * >::vertex_descriptor source(boost::graph_traits< vtkGraph * >::edge_descriptor e, vtkGraph *)
Definition: vtkBoostGraphAdapter.h:825
vtkCPExodusIIResultsArrayTemplate::InsertVariantValue
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
Insert a value into the array from a variant.
vtkCPExodusIIResultsArrayTemplate::InsertTypedTuple
void InsertTypedTuple(vtkIdType i, const Scalar *t) override
Insert (memory allocation performed) the tuple into the ith location in the array.
vtkCPExodusIIResultsArrayTemplate::InsertTuple
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
Insert the tuple at srcTupleIdx in the source array into this array at dstTupleIdx.
vtkCPExodusIIResultsArrayTemplate::GetValueReference
ValueType & GetValueReference(vtkIdType idx) override
Get a reference to the scalar value at a particular index.
vtkCPExodusIIResultsArrayTemplate::InsertNextTuple
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override
Insert the tuple from srcTupleIdx in the source array at the end of this array.
vtkCPExodusIIResultsArrayTemplate::GetTuples
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override
Given a list of tuple ids, return an array of tuples.
vtkCPExodusIIResultsArrayTemplate::Resize
vtkTypeBool Resize(vtkIdType numTuples) override
Resize the array to the requested number of tuples and preserve data.
vtkCPExodusIIResultsArrayTemplate::~vtkCPExodusIIResultsArrayTemplate
~vtkCPExodusIIResultsArrayTemplate() override
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkCPExodusIIResultsArrayTemplate::ValueType
Superclass::ValueType ValueType
Definition: vtkCPExodusIIResultsArrayTemplate.h:47
vtkVariant
A atomic type representing the union of many types.
Definition: vtkVariant.h:71
vtkIdList
list of point or cell ids
Definition: vtkIdList.h:36
vtkCPExodusIIResultsArrayTemplate::SetExodusScalarArrays
void SetExodusScalarArrays(std::vector< Scalar * > arrays, vtkIdType numTuples)
Set the arrays to be used and the number of tuples in each array.
vtkCPExodusIIResultsArrayTemplate::vtkCPExodusIIResultsArrayTemplate
vtkCPExodusIIResultsArrayTemplate()
vtkCPExodusIIResultsArrayTemplate::GetTuple
double * GetTuple(vtkIdType i) override
Get the data tuple at tupleIdx.
vtkAbstractArray
Abstract superclass for all arrays.
Definition: vtkAbstractArray.h:78
vtkCPExodusIIResultsArrayTemplate::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkCPExodusIIResultsArrayTemplate::InsertTuples
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
Copy the tuples indexed in srcIds from the source array to the tuple locations indexed by dstIds in t...
vtkCPExodusIIResultsArrayTemplate
Map native Exodus II results arrays into the vtkDataArray interface.
Definition: vtkCPExodusIIResultsArrayTemplate.h:38
vtkArrayIterator
Abstract superclass to iterate over elements in an vtkAbstractArray.
Definition: vtkArrayIterator.h:52
vtkCPExodusIIResultsArrayTemplate::ClearLookup
void ClearLookup() override
Delete the associated fast lookup data structure on this array, if it exists.
VTK_NEWINSTANCE
#define VTK_NEWINSTANCE
Definition: vtkWrappingHints.h:39
vtkCPExodusIIResultsArrayTemplate::Initialize
void Initialize() override
Release storage and reset array to initial state.
vtkCPExodusIIResultsArrayTemplate::GetVariantValue
vtkVariant GetVariantValue(vtkIdType idx) override
Retrieve value from the array as a variant.
vtkCPExodusIIResultsArrayTemplate::SetTypedTuple
void SetTypedTuple(vtkIdType i, const Scalar *t) override
Set the tuple value at the ith location in the array.
vtkCPExodusIIResultsArrayTemplate::Allocate
vtkTypeBool Allocate(vtkIdType sz, vtkIdType ext) override
This container is read only – this method does nothing but print a warning.
vtkCPExodusIIResultsArrayTemplate::GetValue
ValueType GetValue(vtkIdType idx) const override
Get the data at a particular index.
vtkTypeBool
int vtkTypeBool
Definition: vtkABI.h:69
vtkCPExodusIIResultsArrayTemplate::SetVariantValue
void SetVariantValue(vtkIdType idx, vtkVariant value) override
Set a value in the array from a variant.
vtkCPExodusIIResultsArrayTemplate::vtkAbstractTemplateTypeMacro
vtkAbstractTemplateTypeMacro(vtkCPExodusIIResultsArrayTemplate< Scalar >, vtkMappedDataArray< Scalar >) vtkMappedDataArrayNewInstanceMacro(vtkCPExodusIIResultsArrayTemplate< Scalar >) static vtkCPExodusIIResultsArrayTemplate *New()