OGS
VtkMeshNodalCoordinatesTemplate.h
Go to the documentation of this file.
1
15#pragma once
16
17#include <vtkMappedDataArray.h>
18#include <vtkObjectFactory.h> // for vtkStandardNewMacro
19
20namespace MeshLib
21{
22class Node;
23}
24
25namespace MeshLib
26{
27template <class Scalar>
28class VtkMeshNodalCoordinatesTemplate : public vtkMappedDataArray<Scalar>
29{
30public:
32 vtkMappedDataArray<Scalar>)
33 vtkMappedDataArrayNewInstanceMacro(
35 Scalar>) static VtkMeshNodalCoordinatesTemplate* New();
36 void PrintSelf(std::ostream& os, vtkIndent indent) override;
37
38 using ValueType = typename Superclass::ValueType;
39
41 void SetNodes(std::vector<Node*> const& nodes);
42
43 // Reimplemented virtuals -- see superclasses for descriptions
44 void Initialize() override;
45 void GetTuples(vtkIdList* ptIds, vtkAbstractArray* output) override;
46 void GetTuples(vtkIdType p1, vtkIdType p2,
47 vtkAbstractArray* output) override;
48 void Squeeze() override;
49 vtkArrayIterator* NewIterator() override;
50 vtkIdType LookupValue(vtkVariant value) override;
51 void LookupValue(vtkVariant value, vtkIdList* ids) override;
52 vtkVariant GetVariantValue(vtkIdType idx) override;
53 void ClearLookup() override;
54 double* GetTuple(vtkIdType i) override;
55 void GetTuple(vtkIdType i, double* tuple) override;
56 vtkIdType LookupTypedValue(Scalar value) override;
57 void LookupTypedValue(Scalar value, vtkIdList* ids) override;
58 Scalar& GetValueReference(vtkIdType idx) override;
59
60 // This container is read only -- this method does nothing but print a
61 // warning.
62 int Allocate(vtkIdType sz, vtkIdType ext) override;
63 int Resize(vtkIdType numTuples) override;
64 void SetNumberOfTuples(vtkIdType number) override;
65 void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray* source) override;
66 void SetTuple(vtkIdType i, const float* source) override;
67 void SetTuple(vtkIdType i, const double* source) override;
68 void InsertTuple(vtkIdType i, vtkIdType j,
69 vtkAbstractArray* source) override;
70 void InsertTuple(vtkIdType i, const float* source) override;
71 void InsertTuple(vtkIdType i, const double* source) override;
72 void InsertTuples(vtkIdList* dstIds, vtkIdList* srcIds,
73 vtkAbstractArray* source) override;
74 void InsertTuples(vtkIdType /*unused*/, vtkIdType /*unused*/,
75 vtkIdType /*unused*/,
76 vtkAbstractArray* /*unused*/) override;
77 vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray* source) override;
78 vtkIdType InsertNextTuple(const float* source) override;
79 vtkIdType InsertNextTuple(const double* source) override;
80 void InsertVariantValue(vtkIdType idx, vtkVariant value) override;
81 void DeepCopy(vtkAbstractArray* aa) override;
82 void DeepCopy(vtkDataArray* da) override;
83 void InterpolateTuple(vtkIdType i, vtkIdList* ptIndices,
84 vtkAbstractArray* source, double* weights) override;
85 void InterpolateTuple(vtkIdType i, vtkIdType id1, vtkAbstractArray* source1,
86 vtkIdType id2, vtkAbstractArray* source2,
87 double t) override;
88 void SetVariantValue(vtkIdType idx, vtkVariant value) override;
89 void RemoveTuple(vtkIdType id) override;
90 void RemoveFirstTuple() override;
91 void RemoveLastTuple() override;
92 void SetValue(vtkIdType idx, Scalar value) override;
93 vtkIdType InsertNextValue(Scalar v) override;
94 void InsertValue(vtkIdType idx, Scalar v) override;
95
96 Scalar& GetValueReference(vtkIdType idx) const;
97 Scalar GetValue(vtkIdType idx) const override;
98 void GetTypedTuple(vtkIdType tupleId, Scalar* tuple) const override;
99 void SetTypedTuple(vtkIdType i, const Scalar* t) override;
100 void InsertTypedTuple(vtkIdType i, const Scalar* t) override;
101 vtkIdType InsertNextTypedTuple(const Scalar* t) override;
102
104 delete;
105 void operator=(const VtkMeshNodalCoordinatesTemplate&) = delete;
106
107protected:
110
111 const std::vector<Node*>* _nodes{nullptr};
112
113private:
114 vtkIdType Lookup(const Scalar& val, vtkIdType index);
115 double* TempDoubleArray{nullptr};
116};
117
118} // namespace MeshLib
119
Definition of the VtkMeshNodalCoordinatesTemplate class.
void SetValue(vtkIdType idx, Scalar value) override
void InsertTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
void GetTuples(vtkIdList *ptIds, vtkAbstractArray *output) override
void GetTypedTuple(vtkIdType tupleId, Scalar *tuple) const override
void PrintSelf(std::ostream &os, vtkIndent indent) override
void SetVariantValue(vtkIdType idx, vtkVariant value) override
void InsertTuples(vtkIdList *dstIds, vtkIdList *srcIds, vtkAbstractArray *source) override
void InsertVariantValue(vtkIdType idx, vtkVariant value) override
vtkAbstractTemplateTypeMacro(VtkMeshNodalCoordinatesTemplate< Scalar >, vtkMappedDataArray< Scalar >) vtkMappedDataArrayNewInstanceMacro(VtkMeshNodalCoordinatesTemplate< Scalar >) static VtkMeshNodalCoordinatesTemplate *New()
void SetTypedTuple(vtkIdType i, const Scalar *t) override
void SetNodes(std::vector< Node * > const &nodes)
Pass the nodes from OGS mesh.
void InterpolateTuple(vtkIdType i, vtkIdList *ptIndices, vtkAbstractArray *source, double *weights) override
void InsertTypedTuple(vtkIdType i, const Scalar *t) override
void SetTuple(vtkIdType i, vtkIdType j, vtkAbstractArray *source) override
vtkIdType InsertNextTuple(vtkIdType j, vtkAbstractArray *source) override
vtkIdType Lookup(const Scalar &val, vtkIdType index)